diff options
Diffstat (limited to 'src/main/javassist/tools/reflect/Reflection.java')
-rw-r--r-- | src/main/javassist/tools/reflect/Reflection.java | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/src/main/javassist/tools/reflect/Reflection.java b/src/main/javassist/tools/reflect/Reflection.java index 406ce3d5..dddd9a41 100644 --- a/src/main/javassist/tools/reflect/Reflection.java +++ b/src/main/javassist/tools/reflect/Reflection.java @@ -16,11 +16,19 @@ package javassist.tools.reflect; -import java.util.Iterator; -import javassist.*; +import javassist.CannotCompileException; +import javassist.ClassPool; +import javassist.CodeConverter; +import javassist.CtClass; +import javassist.CtField; +import javassist.CtMethod; import javassist.CtMethod.ConstParameter; -import javassist.bytecode.ClassFile; +import javassist.CtNewMethod; +import javassist.Modifier; +import javassist.NotFoundException; +import javassist.Translator; import javassist.bytecode.BadBytecode; +import javassist.bytecode.ClassFile; import javassist.bytecode.MethodInfo; /** @@ -105,6 +113,7 @@ public class Reflection implements Translator { /** * Initializes the object. */ + @Override public void start(ClassPool pool) throws NotFoundException { classPool = pool; final String msg @@ -130,6 +139,7 @@ public class Reflection implements Translator { * Inserts hooks for intercepting accesses to the fields declared * in reflective classes. */ + @Override public void onLoad(ClassPool pool, String classname) throws CannotCompileException, NotFoundException { @@ -176,8 +186,8 @@ public class Reflection implements Translator { * @see javassist.tools.reflect.Metaobject * @see javassist.tools.reflect.ClassMetaobject */ - public boolean makeReflective(Class clazz, - Class metaobject, Class metaclass) + public boolean makeReflective(Class<?> clazz, + Class<?> metaobject, Class<?> metaclass) throws CannotCompileException, NotFoundException { return makeReflective(clazz.getName(), metaobject.getName(), @@ -248,8 +258,7 @@ public class Reflection implements Translator { { if (clazz.getAttribute("Reflective") != null) return false; // this is already reflective. - else - clazz.setAttribute("Reflective", new byte[0]); + clazz.setAttribute("Reflective", new byte[0]); CtClass mlevel = classPool.get("javassist.tools.reflect.Metalevel"); boolean addMeta = !clazz.subtypeOf(mlevel); @@ -394,10 +403,7 @@ public class Reflection implements Translator { if (ClassFile.MAJOR_VERSION < ClassFile.JAVA_6) return; - Iterator methods = cf.getMethods().iterator(); - while (methods.hasNext()) { - MethodInfo mi = (MethodInfo)methods.next(); + for (MethodInfo mi:cf.getMethods()) mi.rebuildStackMap(classPool); - } } } |