diff options
author | patriot1burke <patriot1burke@30ef5769-5b8d-40dd-aea6-55b5d6557bb3> | 2003-04-22 13:47:06 +0000 |
---|---|---|
committer | patriot1burke <patriot1burke@30ef5769-5b8d-40dd-aea6-55b5d6557bb3> | 2003-04-22 13:47:06 +0000 |
commit | 069bceaf72fd0d6ffad14ce4e3e00ca91a280bde (patch) | |
tree | b8230a15d3061c64d5a64bf9efa654d0d6311ff2 /src/main/javassist/convert | |
parent | f610083ba0adbcb3fe92a504015fb26fb5a42530 (diff) | |
download | javassist-069bceaf72fd0d6ffad14ce4e3e00ca91a280bde.tar.gz javassist-069bceaf72fd0d6ffad14ce4e3e00ca91a280bde.zip |
This commit was generated by cvs2svn to compensate for changes in r2, which
included commits to RCS files with non-trunk default branches.
git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@6 30ef5769-5b8d-40dd-aea6-55b5d6557bb3
Diffstat (limited to 'src/main/javassist/convert')
-rw-r--r-- | src/main/javassist/convert/TransformAfter.java | 56 | ||||
-rw-r--r-- | src/main/javassist/convert/TransformBefore.java | 114 | ||||
-rw-r--r-- | src/main/javassist/convert/TransformCall.java | 96 | ||||
-rw-r--r-- | src/main/javassist/convert/TransformFieldAccess.java | 92 | ||||
-rw-r--r-- | src/main/javassist/convert/TransformNew.java | 102 | ||||
-rw-r--r-- | src/main/javassist/convert/TransformReadField.java | 94 | ||||
-rw-r--r-- | src/main/javassist/convert/TransformWriteField.java | 82 | ||||
-rw-r--r-- | src/main/javassist/convert/Transformer.java | 55 |
8 files changed, 691 insertions, 0 deletions
diff --git a/src/main/javassist/convert/TransformAfter.java b/src/main/javassist/convert/TransformAfter.java new file mode 100644 index 00000000..e9704348 --- /dev/null +++ b/src/main/javassist/convert/TransformAfter.java @@ -0,0 +1,56 @@ +/* + * This file is part of the Javassist toolkit. + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * either http://www.mozilla.org/MPL/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * + * The Original Code is Javassist. + * + * The Initial Developer of the Original Code is Shigeru Chiba. Portions + * created by Shigeru Chiba are Copyright (C) 1999-2003 Shigeru Chiba. + * All Rights Reserved. + * + * Contributor(s): + * + * The development of this software is supported in part by the PRESTO + * program (Sakigake Kenkyu 21) of Japan Science and Technology Corporation. + */ + +package javassist.convert; + +import javassist.CtClass; +import javassist.CtMethod; +import javassist.NotFoundException; +import javassist.bytecode.*; +import javassist.CannotCompileException; + +public class TransformAfter extends TransformBefore { + public TransformAfter(Transformer next, + CtMethod origMethod, CtMethod afterMethod) + throws NotFoundException + { + super(next, origMethod, afterMethod); + } + + protected int match2(int pos, CodeIterator iterator) throws BadBytecode { + iterator.move(pos); + iterator.insert(saveCode); + iterator.insert(loadCode); + int p = iterator.insertGap(3); + iterator.insert(loadCode); + pos = iterator.next(); + iterator.writeByte(iterator.byteAt(pos), p); + iterator.write16bit(iterator.u16bitAt(pos + 1), p + 1); + iterator.writeByte(INVOKESTATIC, pos); + iterator.write16bit(newIndex, pos + 1); + iterator.move(p); + return iterator.next(); + } +} diff --git a/src/main/javassist/convert/TransformBefore.java b/src/main/javassist/convert/TransformBefore.java new file mode 100644 index 00000000..79deb10f --- /dev/null +++ b/src/main/javassist/convert/TransformBefore.java @@ -0,0 +1,114 @@ +/* + * This file is part of the Javassist toolkit. + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * either http://www.mozilla.org/MPL/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * + * The Original Code is Javassist. + * + * The Initial Developer of the Original Code is Shigeru Chiba. Portions + * created by Shigeru Chiba are Copyright (C) 1999-2003 Shigeru Chiba. + * All Rights Reserved. + * + * Contributor(s): + * + * The development of this software is supported in part by the PRESTO + * program (Sakigake Kenkyu 21) of Japan Science and Technology Corporation. + */ + +package javassist.convert; + +import javassist.CtClass; +import javassist.CtMethod; +import javassist.NotFoundException; +import javassist.bytecode.*; +import javassist.CannotCompileException; + +public class TransformBefore extends TransformCall { + protected CtClass[] parameterTypes; + protected int locals; + protected int maxLocals; + protected byte[] saveCode, loadCode; + + public TransformBefore(Transformer next, + CtMethod origMethod, CtMethod beforeMethod) + throws NotFoundException + { + super(next, origMethod, beforeMethod); + parameterTypes = origMethod.getParameterTypes(); + locals = 0; + maxLocals = 0; + saveCode = loadCode = null; + } + + public void initialize(ConstPool cp, CodeAttribute attr) { + super.initialize(cp, attr); + locals = 0; + maxLocals = attr.getMaxLocals(); + saveCode = loadCode = null; + } + + protected int match(int c, int pos, CodeIterator iterator, + int typedesc, ConstPool cp) throws BadBytecode + { + if (newIndex == 0) { + String desc = Descriptor.ofParameters(parameterTypes) + 'V'; + desc = Descriptor.insertParameter(classname, desc); + int nt = cp.addNameAndTypeInfo(newMethodname, desc); + int ci = cp.addClassInfo(newClassname); + newIndex = cp.addMethodrefInfo(ci, nt); + constPool = cp; + } + + if (saveCode == null) + makeCode(parameterTypes, cp); + + return match2(pos, iterator); + } + + protected int match2(int pos, CodeIterator iterator) throws BadBytecode { + iterator.move(pos); + iterator.insert(saveCode); + iterator.insert(loadCode); + int p = iterator.insertGap(3); + iterator.writeByte(INVOKESTATIC, p); + iterator.write16bit(newIndex, p + 1); + iterator.insert(loadCode); + return iterator.next(); + } + + public int extraLocals() { return locals; } + + protected void makeCode(CtClass[] paramTypes, ConstPool cp) { + Bytecode save = new Bytecode(cp, 0, 0); + Bytecode load = new Bytecode(cp, 0, 0); + + int var = maxLocals; + int len = (paramTypes == null) ? 0 : paramTypes.length; + load.addAload(var); + makeCode2(save, load, 0, len, paramTypes, var + 1); + save.addAstore(var); + + saveCode = save.get(); + loadCode = load.get(); + } + + private void makeCode2(Bytecode save, Bytecode load, + int i, int n, CtClass[] paramTypes, int var) + { + if (i < n) { + int size = load.addLoad(var, paramTypes[i]); + makeCode2(save, load, i + 1, n, paramTypes, var + size); + save.addStore(var, paramTypes[i]); + } + else + locals = var - maxLocals; + } +} diff --git a/src/main/javassist/convert/TransformCall.java b/src/main/javassist/convert/TransformCall.java new file mode 100644 index 00000000..985a8bbb --- /dev/null +++ b/src/main/javassist/convert/TransformCall.java @@ -0,0 +1,96 @@ +/* + * This file is part of the Javassist toolkit. + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * either http://www.mozilla.org/MPL/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * + * The Original Code is Javassist. + * + * The Initial Developer of the Original Code is Shigeru Chiba. Portions + * created by Shigeru Chiba are Copyright (C) 1999-2003 Shigeru Chiba. + * All Rights Reserved. + * + * Contributor(s): + * + * The development of this software is supported in part by the PRESTO + * program (Sakigake Kenkyu 21) of Japan Science and Technology Corporation. + */ + +package javassist.convert; + +import javassist.CtClass; +import javassist.CtMethod; +import javassist.bytecode.*; +import javassist.CannotCompileException; + +public class TransformCall extends Transformer { + protected String classname, methodname, methodDescriptor; + protected String newClassname, newMethodname; + + /* cache */ + protected int newIndex; + protected ConstPool constPool; + + public TransformCall(Transformer next, CtMethod origMethod, + CtMethod substMethod) + { + super(next); + this.classname = origMethod.getDeclaringClass().getName(); + this.methodname = origMethod.getName(); + this.methodDescriptor = origMethod.getMethodInfo2().getDescriptor(); + this.newClassname = substMethod.getDeclaringClass().getName(); + this.newMethodname = substMethod.getName(); + this.constPool = null; + } + + public void initialize(ConstPool cp, CodeAttribute attr) { + if (constPool != cp) + newIndex = 0; + } + + /** + * Modify INVOKEINTERFACE, INVOKESPECIAL, INVOKESTATIC and INVOKEVIRTUAL + * so that a different method is invoked. + */ + public int transform(CtClass clazz, int pos, CodeIterator iterator, + ConstPool cp) throws BadBytecode + { + int c = iterator.byteAt(pos); + if (c == INVOKEINTERFACE || c == INVOKESPECIAL + || c == INVOKESTATIC || c == INVOKEVIRTUAL) { + int index = iterator.u16bitAt(pos + 1); + int typedesc = cp.isMember(classname, methodname, index); + if (typedesc != 0) + if (cp.getUtf8Info(typedesc).equals(methodDescriptor)) + pos = match(c, pos, iterator, typedesc, cp); + } + + return pos; + } + + protected int match(int c, int pos, CodeIterator iterator, + int typedesc, ConstPool cp) throws BadBytecode + { + if (newIndex == 0) { + int nt = cp.addNameAndTypeInfo(cp.addUtf8Info(newMethodname), + typedesc); + int ci = cp.addClassInfo(newClassname); + if (c == INVOKEINTERFACE) + newIndex = cp.addInterfaceMethodrefInfo(ci, nt); + else + newIndex = cp.addMethodrefInfo(ci, nt); + + constPool = cp; + } + + iterator.write16bit(newIndex, pos + 1); + return pos; + } +} diff --git a/src/main/javassist/convert/TransformFieldAccess.java b/src/main/javassist/convert/TransformFieldAccess.java new file mode 100644 index 00000000..bce010da --- /dev/null +++ b/src/main/javassist/convert/TransformFieldAccess.java @@ -0,0 +1,92 @@ +/* + * This file is part of the Javassist toolkit. + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * either http://www.mozilla.org/MPL/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * + * The Original Code is Javassist. + * + * The Initial Developer of the Original Code is Shigeru Chiba. Portions + * created by Shigeru Chiba are Copyright (C) 1999-2003 Shigeru Chiba. + * All Rights Reserved. + * + * Contributor(s): + * + * The development of this software is supported in part by the PRESTO + * program (Sakigake Kenkyu 21) of Japan Science and Technology Corporation. + */ + +package javassist.convert; + +import javassist.bytecode.*; +import javassist.CtClass; +import javassist.CtField; +import javassist.Modifier; +import javassist.CannotCompileException; + +final public class TransformFieldAccess extends Transformer { + private String newClassname, newFieldname; + private String fieldname; + private CtClass fieldClass; + private boolean isPrivate; + + /* cache */ + private int newIndex; + private ConstPool constPool; + + public TransformFieldAccess(Transformer next, CtField field, + String newClassname, String newFieldname) + { + super(next); + this.fieldClass = field.getDeclaringClass(); + this.fieldname = field.getName(); + this.isPrivate = Modifier.isPrivate(field.getModifiers()); + this.newClassname = newClassname; + this.newFieldname = newFieldname; + this.constPool = null; + } + + public void initialize(ConstPool cp, CodeAttribute attr) { + if (constPool != cp) + newIndex = 0; + } + + /** + * Modify GETFIELD, GETSTATIC, PUTFIELD, and PUTSTATIC so that + * a different field is accessed. The new field must be declared + * in a superclass of the class in which the original field is + * declared. + */ + public int transform(CtClass clazz, int pos, + CodeIterator iterator, ConstPool cp) + { + int c = iterator.byteAt(pos); + if (c == GETFIELD || c == GETSTATIC + || c == PUTFIELD || c == PUTSTATIC) { + int index = iterator.u16bitAt(pos + 1); + String typedesc + = TransformReadField.isField(clazz.getClassPool(), cp, + fieldClass, fieldname, isPrivate, index); + if (typedesc != null) { + if (newIndex == 0) { + int nt = cp.addNameAndTypeInfo(newFieldname, + typedesc); + newIndex = cp.addFieldrefInfo( + cp.addClassInfo(newClassname), nt); + constPool = cp; + } + + iterator.write16bit(newIndex, pos + 1); + } + } + + return pos; + } +} diff --git a/src/main/javassist/convert/TransformNew.java b/src/main/javassist/convert/TransformNew.java new file mode 100644 index 00000000..a69918d8 --- /dev/null +++ b/src/main/javassist/convert/TransformNew.java @@ -0,0 +1,102 @@ +/* + * This file is part of the Javassist toolkit. + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * either http://www.mozilla.org/MPL/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * + * The Original Code is Javassist. + * + * The Initial Developer of the Original Code is Shigeru Chiba. Portions + * created by Shigeru Chiba are Copyright (C) 1999-2003 Shigeru Chiba. + * All Rights Reserved. + * + * Contributor(s): + * + * The development of this software is supported in part by the PRESTO + * program (Sakigake Kenkyu 21) of Japan Science and Technology Corporation. + */ + +package javassist.convert; + +import javassist.bytecode.*; +import javassist.CtClass; +import javassist.CannotCompileException; + +final public class TransformNew extends Transformer { + private int nested; + private String classname, trapClass, trapMethod; + + public TransformNew(Transformer next, + String classname, String trapClass, String trapMethod) { + super(next); + this.classname = classname; + this.trapClass = trapClass; + this.trapMethod = trapMethod; + } + + public void initialize(ConstPool cp, CodeAttribute attr) { + nested = 0; + } + + /** + * Replace a sequence of + * NEW classname + * DUP + * ... + * INVOKESPECIAL + * with + * NOP + * NOP + * ... + * INVOKESTATIC trapMethod in trapClass + */ + public int transform(CtClass clazz, int pos, CodeIterator iterator, + ConstPool cp) throws CannotCompileException + { + int index; + int c = iterator.byteAt(pos); + if (c == NEW) { + index = iterator.u16bitAt(pos + 1); + if (cp.getClassInfo(index).equals(classname)) { + if (iterator.byteAt(pos + 3) != DUP) + throw new CannotCompileException( + "NEW followed by no DUP was found"); + + iterator.writeByte(NOP, pos); + iterator.writeByte(NOP, pos + 1); + iterator.writeByte(NOP, pos + 2); + iterator.writeByte(NOP, pos + 3); + ++nested; + } + } + else if (c == INVOKESPECIAL) { + index = iterator.u16bitAt(pos + 1); + int typedesc = cp.isConstructor(classname, index); + if (typedesc != 0 && nested > 0) { + int methodref = computeMethodref(typedesc, cp); + iterator.writeByte(INVOKESTATIC, pos); + iterator.write16bit(methodref, pos + 1); + --nested; + } + } + + return pos; + } + + private int computeMethodref(int typedesc, ConstPool cp) { + int classIndex = cp.addClassInfo(trapClass); + int mnameIndex = cp.addUtf8Info(trapMethod); + typedesc = cp.addUtf8Info( + Descriptor.changeReturnType(classname, + cp.getUtf8Info(typedesc))); + return cp.addMethodrefInfo(classIndex, + cp.addNameAndTypeInfo(mnameIndex, typedesc)); + } +} diff --git a/src/main/javassist/convert/TransformReadField.java b/src/main/javassist/convert/TransformReadField.java new file mode 100644 index 00000000..fda192c1 --- /dev/null +++ b/src/main/javassist/convert/TransformReadField.java @@ -0,0 +1,94 @@ +/* + * This file is part of the Javassist toolkit. + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * either http://www.mozilla.org/MPL/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * + * The Original Code is Javassist. + * + * The Initial Developer of the Original Code is Shigeru Chiba. Portions + * created by Shigeru Chiba are Copyright (C) 1999-2003 Shigeru Chiba. + * All Rights Reserved. + * + * Contributor(s): + * + * The development of this software is supported in part by the PRESTO + * program (Sakigake Kenkyu 21) of Japan Science and Technology Corporation. + */ + +package javassist.convert; + +import javassist.bytecode.*; +import javassist.ClassPool; +import javassist.CtClass; +import javassist.CtField; +import javassist.CannotCompileException; +import javassist.NotFoundException; +import javassist.Modifier; + +public class TransformReadField extends Transformer { + protected String fieldname; + protected CtClass fieldClass; + protected boolean isPrivate; + protected String methodClassname, methodName; + + public TransformReadField(Transformer next, CtField field, + String methodClassname, String methodName) + { + super(next); + this.fieldClass = field.getDeclaringClass(); + this.fieldname = field.getName(); + this.methodClassname = methodClassname; + this.methodName = methodName; + this.isPrivate = Modifier.isPrivate(field.getModifiers()); + } + + static String isField(ClassPool pool, ConstPool cp, CtClass fclass, + String fname, boolean is_private, int index) { + if (!cp.getFieldrefName(index).equals(fname)) + return null; + + try { + CtClass c = pool.get(cp.getFieldrefClassName(index)); + if (is_private ? c == fclass : c.subclassOf(fclass)) + return cp.getFieldrefType(index); + } + catch (NotFoundException e) {} + return null; + } + + public int transform(CtClass tclazz, int pos, CodeIterator iterator, + ConstPool cp) throws BadBytecode + { + int c = iterator.byteAt(pos); + if (c == GETFIELD || c == GETSTATIC) { + int index = iterator.u16bitAt(pos + 1); + String typedesc = isField(tclazz.getClassPool(), cp, + fieldClass, fieldname, isPrivate, index); + if (typedesc != null) { + if (c == GETSTATIC) { + iterator.move(pos); + iterator.insertGap(1); // insertGap() may insert 4 bytes. + iterator.writeByte(ACONST_NULL, pos); + pos = iterator.next(); + } + + String type = "(Ljava/lang/Object;)" + typedesc; + int mi = cp.addClassInfo(methodClassname); + int methodref = cp.addMethodrefInfo(mi, methodName, type); + iterator.writeByte(INVOKESTATIC, pos); + iterator.write16bit(methodref, pos + 1); + return pos; + } + } + + return pos; + } +} diff --git a/src/main/javassist/convert/TransformWriteField.java b/src/main/javassist/convert/TransformWriteField.java new file mode 100644 index 00000000..8c37c7fd --- /dev/null +++ b/src/main/javassist/convert/TransformWriteField.java @@ -0,0 +1,82 @@ +/* + * This file is part of the Javassist toolkit. + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * either http://www.mozilla.org/MPL/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * + * The Original Code is Javassist. + * + * The Initial Developer of the Original Code is Shigeru Chiba. Portions + * created by Shigeru Chiba are Copyright (C) 1999-2003 Shigeru Chiba. + * All Rights Reserved. + * + * Contributor(s): + * + * The development of this software is supported in part by the PRESTO + * program (Sakigake Kenkyu 21) of Japan Science and Technology Corporation. + */ + +package javassist.convert; + +import javassist.CtClass; +import javassist.CtField; +import javassist.bytecode.*; +import javassist.CannotCompileException; + +final public class TransformWriteField extends TransformReadField { + public TransformWriteField(Transformer next, CtField field, + String methodClassname, String methodName) + { + super(next, field, methodClassname, methodName); + } + + public int transform(CtClass tclazz, int pos, CodeIterator iterator, + ConstPool cp) throws BadBytecode + { + int c = iterator.byteAt(pos); + if (c == PUTFIELD || c == PUTSTATIC) { + int index = iterator.u16bitAt(pos + 1); + String typedesc = isField(tclazz.getClassPool(), cp, + fieldClass, fieldname, isPrivate, index); + if (typedesc != null) { + if (c == PUTSTATIC) { + CodeAttribute ca = iterator.get(); + iterator.move(pos); + char c0 = typedesc.charAt(0); + if (c0 == 'J' || c0 == 'D') { // long or double + // insertGap() may insert 4 bytes. + iterator.insertGap(3); + iterator.writeByte(ACONST_NULL, pos); + iterator.writeByte(DUP_X2, pos + 1); + iterator.writeByte(POP, pos + 2); + ca.setMaxStack(ca.getMaxStack() + 2); + } + else { + // insertGap() may insert 4 bytes. + iterator.insertGap(2); + iterator.writeByte(ACONST_NULL, pos); + iterator.writeByte(SWAP, pos + 1); + ca.setMaxStack(ca.getMaxStack() + 1); + } + + pos = iterator.next(); + } + + int mi = cp.addClassInfo(methodClassname); + String type = "(Ljava/lang/Object;" + typedesc + ")V"; + int methodref = cp.addMethodrefInfo(mi, methodName, type); + iterator.writeByte(INVOKESTATIC, pos); + iterator.write16bit(methodref, pos + 1); + } + } + + return pos; + } +} diff --git a/src/main/javassist/convert/Transformer.java b/src/main/javassist/convert/Transformer.java new file mode 100644 index 00000000..f1a4b566 --- /dev/null +++ b/src/main/javassist/convert/Transformer.java @@ -0,0 +1,55 @@ +/* + * This file is part of the Javassist toolkit. + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * either http://www.mozilla.org/MPL/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * + * The Original Code is Javassist. + * + * The Initial Developer of the Original Code is Shigeru Chiba. Portions + * created by Shigeru Chiba are Copyright (C) 1999-2003 Shigeru Chiba. + * All Rights Reserved. + * + * Contributor(s): + * + * The development of this software is supported in part by the PRESTO + * program (Sakigake Kenkyu 21) of Japan Science and Technology Corporation. + */ + +package javassist.convert; + +import javassist.bytecode.*; +import javassist.CtClass; +import javassist.CannotCompileException; + +/** + * Transformer and its subclasses are used for executing + * code transformation specified by CodeConverter. + * + * @see javassist.CodeConverter + */ +public abstract class Transformer implements Opcode { + private Transformer next; + + public Transformer(Transformer t) { + next = t; + } + + public Transformer getNext() { return next; } + + public void initialize(ConstPool cp, CodeAttribute attr) {} + + public void clean() {} + + public abstract int transform(CtClass clazz, int pos, CodeIterator it, + ConstPool cp) throws CannotCompileException, BadBytecode; + + public int extraLocals() { return 0; } +} |