diff --git a/fine-cglib/src/com/fr/third/net/sf/cglib/beans/BeanCopier.java b/fine-cglib/src/com/fr/third/net/sf/cglib/beans/BeanCopier.java index 393ab2fc3..b8830eb2d 100644 --- a/fine-cglib/src/com/fr/third/net/sf/cglib/beans/BeanCopier.java +++ b/fine-cglib/src/com/fr/third/net/sf/cglib/beans/BeanCopier.java @@ -18,7 +18,20 @@ package com.fr.third.net.sf.cglib.beans; import java.beans.PropertyDescriptor; import java.lang.reflect.*; import java.security.ProtectionDomain; -import com.fr.third.net.sf.cglib.core.*; + +import com.fr.third.net.sf.cglib.core.AbstractClassGenerator; +import com.fr.third.net.sf.cglib.core.ClassEmitter; +import com.fr.third.net.sf.cglib.core.CodeEmitter; +import com.fr.third.net.sf.cglib.core.Constants; +import com.fr.third.net.sf.cglib.core.Converter; +import com.fr.third.net.sf.cglib.core.EmitUtils; +import com.fr.third.net.sf.cglib.core.KeyFactory; +import com.fr.third.net.sf.cglib.core.Local; +import com.fr.third.net.sf.cglib.core.MethodInfo; +import com.fr.third.net.sf.cglib.core.ReflectUtils; +import com.fr.third.net.sf.cglib.core.Signature; +import com.fr.third.net.sf.cglib.core.TypeUtils; +import net.sf.cglib.core.*; import com.fr.third.org.objectweb.asm.ClassVisitor; import com.fr.third.org.objectweb.asm.Type; import java.util.*; @@ -29,11 +42,11 @@ import java.util.*; abstract public class BeanCopier { private static final BeanCopierKey KEY_FACTORY = - (BeanCopierKey)KeyFactory.create(BeanCopierKey.class); + (BeanCopierKey) KeyFactory.create(BeanCopierKey.class); private static final Type CONVERTER = - TypeUtils.parseType("com.fr.third.net.sf.cglib.core.Converter"); + TypeUtils.parseType("net.sf.cglib.core.Converter"); private static final Type BEAN_COPIER = - TypeUtils.parseType("com.fr.third.net.sf.cglib.beans.BeanCopier"); + TypeUtils.parseType("net.sf.cglib.beans.BeanCopier"); private static final Signature COPY = new Signature("copy", Type.VOID_TYPE, new Type[]{ Constants.TYPE_OBJECT, Constants.TYPE_OBJECT, CONVERTER }); private static final Signature CONVERT = diff --git a/fine-cglib/src/com/fr/third/net/sf/cglib/beans/BeanGenerator.java b/fine-cglib/src/com/fr/third/net/sf/cglib/beans/BeanGenerator.java index 51ef40ffe..3425f9532 100644 --- a/fine-cglib/src/com/fr/third/net/sf/cglib/beans/BeanGenerator.java +++ b/fine-cglib/src/com/fr/third/net/sf/cglib/beans/BeanGenerator.java @@ -18,7 +18,14 @@ package com.fr.third.net.sf.cglib.beans; import java.beans.PropertyDescriptor; import java.security.ProtectionDomain; import java.util.*; -import com.fr.third.net.sf.cglib.core.*; + +import com.fr.third.net.sf.cglib.core.AbstractClassGenerator; +import com.fr.third.net.sf.cglib.core.ClassEmitter; +import com.fr.third.net.sf.cglib.core.Constants; +import com.fr.third.net.sf.cglib.core.EmitUtils; +import com.fr.third.net.sf.cglib.core.KeyFactory; +import com.fr.third.net.sf.cglib.core.ReflectUtils; +import net.sf.cglib.core.*; import com.fr.third.org.objectweb.asm.ClassVisitor; import com.fr.third.org.objectweb.asm.Type; @@ -29,7 +36,7 @@ public class BeanGenerator extends AbstractClassGenerator { private static final Source SOURCE = new Source(BeanGenerator.class.getName()); private static final BeanGeneratorKey KEY_FACTORY = - (BeanGeneratorKey)KeyFactory.create(BeanGeneratorKey.class); + (BeanGeneratorKey) KeyFactory.create(BeanGeneratorKey.class); interface BeanGeneratorKey { public Object newInstance(String superclass, Map props); diff --git a/fine-cglib/src/com/fr/third/net/sf/cglib/beans/BeanMap.java b/fine-cglib/src/com/fr/third/net/sf/cglib/beans/BeanMap.java index 9dddac1b4..83fc8b4f3 100644 --- a/fine-cglib/src/com/fr/third/net/sf/cglib/beans/BeanMap.java +++ b/fine-cglib/src/com/fr/third/net/sf/cglib/beans/BeanMap.java @@ -16,11 +16,12 @@ package com.fr.third.net.sf.cglib.beans; import java.security.ProtectionDomain; -import java.beans.*; -import java.lang.reflect.Constructor; -import java.lang.reflect.Method; import java.util.*; -import com.fr.third.net.sf.cglib.core.*; + +import com.fr.third.net.sf.cglib.core.AbstractClassGenerator; +import com.fr.third.net.sf.cglib.core.KeyFactory; +import com.fr.third.net.sf.cglib.core.ReflectUtils; +import net.sf.cglib.core.*; import com.fr.third.org.objectweb.asm.ClassVisitor; /** @@ -63,7 +64,7 @@ abstract public class BeanMap implements Map { private static final Source SOURCE = new Source(BeanMap.class.getName()); private static final BeanMapKey KEY_FACTORY = - (BeanMapKey)KeyFactory.create(BeanMapKey.class, KeyFactory.CLASS_BY_NAME); + (BeanMapKey) KeyFactory.create(BeanMapKey.class, KeyFactory.CLASS_BY_NAME); interface BeanMapKey { public Object newInstance(Class type, int require); diff --git a/fine-cglib/src/com/fr/third/net/sf/cglib/beans/BeanMapEmitter.java b/fine-cglib/src/com/fr/third/net/sf/cglib/beans/BeanMapEmitter.java index 1284f33ba..a8e27c3be 100644 --- a/fine-cglib/src/com/fr/third/net/sf/cglib/beans/BeanMapEmitter.java +++ b/fine-cglib/src/com/fr/third/net/sf/cglib/beans/BeanMapEmitter.java @@ -17,16 +17,26 @@ package com.fr.third.net.sf.cglib.beans; import java.beans.*; import java.util.*; -import com.fr.third.net.sf.cglib.core.*; + +import com.fr.third.net.sf.cglib.core.ClassEmitter; +import com.fr.third.net.sf.cglib.core.CodeEmitter; +import com.fr.third.net.sf.cglib.core.Constants; +import com.fr.third.net.sf.cglib.core.EmitUtils; +import com.fr.third.net.sf.cglib.core.MethodInfo; +import com.fr.third.net.sf.cglib.core.ObjectSwitchCallback; +import com.fr.third.net.sf.cglib.core.ReflectUtils; +import com.fr.third.net.sf.cglib.core.Signature; +import com.fr.third.net.sf.cglib.core.TypeUtils; +import net.sf.cglib.core.*; import com.fr.third.org.objectweb.asm.ClassVisitor; import com.fr.third.org.objectweb.asm.Label; import com.fr.third.org.objectweb.asm.Type; class BeanMapEmitter extends ClassEmitter { private static final Type BEAN_MAP = - TypeUtils.parseType("com.fr.third.net.sf.cglib.beans.BeanMap"); + TypeUtils.parseType("net.sf.cglib.beans.BeanMap"); private static final Type FIXED_KEY_SET = - TypeUtils.parseType("com.fr.third.net.sf.cglib.beans.FixedKeySet"); + TypeUtils.parseType("net.sf.cglib.beans.FixedKeySet"); private static final Signature CSTRUCT_OBJECT = TypeUtils.parseConstructor("Object"); private static final Signature CSTRUCT_STRING_ARRAY = diff --git a/fine-cglib/src/com/fr/third/net/sf/cglib/beans/BulkBean.java b/fine-cglib/src/com/fr/third/net/sf/cglib/beans/BulkBean.java index 9d6946ba5..49bd1a0bd 100644 --- a/fine-cglib/src/com/fr/third/net/sf/cglib/beans/BulkBean.java +++ b/fine-cglib/src/com/fr/third/net/sf/cglib/beans/BulkBean.java @@ -15,12 +15,12 @@ */ package com.fr.third.net.sf.cglib.beans; -import java.lang.reflect.Constructor; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; import java.security.ProtectionDomain; -import java.util.*; -import com.fr.third.net.sf.cglib.core.*; + +import com.fr.third.net.sf.cglib.core.AbstractClassGenerator; +import com.fr.third.net.sf.cglib.core.KeyFactory; +import com.fr.third.net.sf.cglib.core.ReflectUtils; +import net.sf.cglib.core.*; import com.fr.third.org.objectweb.asm.ClassVisitor; /** @@ -29,7 +29,7 @@ import com.fr.third.org.objectweb.asm.ClassVisitor; abstract public class BulkBean { private static final BulkBeanKey KEY_FACTORY = - (BulkBeanKey)KeyFactory.create(BulkBeanKey.class); + (BulkBeanKey) KeyFactory.create(BulkBeanKey.class); interface BulkBeanKey { public Object newInstance(String target, String[] getters, String[] setters, String[] types); diff --git a/fine-cglib/src/com/fr/third/net/sf/cglib/beans/BulkBeanEmitter.java b/fine-cglib/src/com/fr/third/net/sf/cglib/beans/BulkBeanEmitter.java index 9aaf2b985..aae25c6b4 100644 --- a/fine-cglib/src/com/fr/third/net/sf/cglib/beans/BulkBeanEmitter.java +++ b/fine-cglib/src/com/fr/third/net/sf/cglib/beans/BulkBeanEmitter.java @@ -15,11 +15,20 @@ */ package com.fr.third.net.sf.cglib.beans; -import java.lang.reflect.Constructor; import java.lang.reflect.Method; import java.lang.reflect.Modifier; -import java.util.*; -import com.fr.third.net.sf.cglib.core.*; + +import com.fr.third.net.sf.cglib.core.Block; +import com.fr.third.net.sf.cglib.core.ClassEmitter; +import com.fr.third.net.sf.cglib.core.CodeEmitter; +import com.fr.third.net.sf.cglib.core.Constants; +import com.fr.third.net.sf.cglib.core.EmitUtils; +import com.fr.third.net.sf.cglib.core.Local; +import com.fr.third.net.sf.cglib.core.MethodInfo; +import com.fr.third.net.sf.cglib.core.ReflectUtils; +import com.fr.third.net.sf.cglib.core.Signature; +import com.fr.third.net.sf.cglib.core.TypeUtils; +import net.sf.cglib.core.*; import com.fr.third.org.objectweb.asm.ClassVisitor; import com.fr.third.org.objectweb.asm.Type; @@ -31,9 +40,9 @@ class BulkBeanEmitter extends ClassEmitter { private static final Signature CSTRUCT_EXCEPTION = TypeUtils.parseConstructor("Throwable, int"); private static final Type BULK_BEAN = - TypeUtils.parseType("com.fr.third.net.sf.cglib.beans.BulkBean"); + TypeUtils.parseType("net.sf.cglib.beans.BulkBean"); private static final Type BULK_BEAN_EXCEPTION = - TypeUtils.parseType("com.fr.third.net.sf.cglib.beans.BulkBeanException"); + TypeUtils.parseType("net.sf.cglib.beans.BulkBeanException"); public BulkBeanEmitter(ClassVisitor v, String className, @@ -56,7 +65,7 @@ class BulkBeanEmitter extends ClassEmitter { private void generateGet(final Class target, final Method[] getters) { CodeEmitter e = begin_method(Constants.ACC_PUBLIC, GET_PROPERTY_VALUES, null); - if (getters.length >= 0) { + if (getters.length > 0) { e.load_arg(0); e.checkcast(Type.getType(target)); Local bean = e.make_local(); diff --git a/fine-cglib/src/com/fr/third/net/sf/cglib/beans/BulkBeanException.java b/fine-cglib/src/com/fr/third/net/sf/cglib/beans/BulkBeanException.java index 34c8983b2..bf7a8c523 100644 --- a/fine-cglib/src/com/fr/third/net/sf/cglib/beans/BulkBeanException.java +++ b/fine-cglib/src/com/fr/third/net/sf/cglib/beans/BulkBeanException.java @@ -15,8 +15,6 @@ */ package com.fr.third.net.sf.cglib.beans; -import com.fr.third.net.sf.cglib.core.CodeGenerationException; - public class BulkBeanException extends RuntimeException { private int index; diff --git a/fine-cglib/src/com/fr/third/net/sf/cglib/beans/ImmutableBean.java b/fine-cglib/src/com/fr/third/net/sf/cglib/beans/ImmutableBean.java index 1424a1e28..980e36fa0 100644 --- a/fine-cglib/src/com/fr/third/net/sf/cglib/beans/ImmutableBean.java +++ b/fine-cglib/src/com/fr/third/net/sf/cglib/beans/ImmutableBean.java @@ -18,7 +18,17 @@ package com.fr.third.net.sf.cglib.beans; import java.beans.PropertyDescriptor; import java.lang.reflect.Method; import java.security.ProtectionDomain; -import com.fr.third.net.sf.cglib.core.*; + +import com.fr.third.net.sf.cglib.core.AbstractClassGenerator; +import com.fr.third.net.sf.cglib.core.ClassEmitter; +import com.fr.third.net.sf.cglib.core.CodeEmitter; +import com.fr.third.net.sf.cglib.core.Constants; +import com.fr.third.net.sf.cglib.core.EmitUtils; +import com.fr.third.net.sf.cglib.core.MethodInfo; +import com.fr.third.net.sf.cglib.core.ReflectUtils; +import com.fr.third.net.sf.cglib.core.Signature; +import com.fr.third.net.sf.cglib.core.TypeUtils; +import net.sf.cglib.core.*; import com.fr.third.org.objectweb.asm.ClassVisitor; import com.fr.third.org.objectweb.asm.Type; /** diff --git a/fine-cglib/src/com/fr/third/net/sf/cglib/core/AbstractClassGenerator.java b/fine-cglib/src/com/fr/third/net/sf/cglib/core/AbstractClassGenerator.java index 928004a9a..2bc4e3c03 100644 --- a/fine-cglib/src/com/fr/third/net/sf/cglib/core/AbstractClassGenerator.java +++ b/fine-cglib/src/com/fr/third/net/sf/cglib/core/AbstractClassGenerator.java @@ -15,6 +15,7 @@ */ package com.fr.third.net.sf.cglib.core; +import com.fr.third.net.sf.cglib.proxy.Enhancer; import com.fr.third.net.sf.cglib.core.internal.Function; import com.fr.third.net.sf.cglib.core.internal.LoadingCache; import com.fr.third.org.objectweb.asm.ClassReader; @@ -39,13 +40,16 @@ implements ClassGenerator private static volatile Map CACHE = new WeakHashMap(); + private static final boolean DEFAULT_USE_CACHE = + Boolean.parseBoolean(System.getProperty("cglib.useCache", "true")); + private GeneratorStrategy strategy = DefaultGeneratorStrategy.INSTANCE; private NamingPolicy namingPolicy = DefaultNamingPolicy.INSTANCE; private Source source; private ClassLoader classLoader; private String namePrefix; private Object key; - private boolean useCache = true; + private boolean useCache = DEFAULT_USE_CACHE; private String className; private boolean attemptLoad; @@ -53,7 +57,7 @@ implements ClassGenerator private final Set reservedClassNames = new HashSet(); /** - * {@link AbstractClassGenerator} here holds "cache key" (e.g. {@link com.fr.third.net.sf.cglib.proxy.Enhancer} + * {@link AbstractClassGenerator} here holds "cache key" (e.g. {@link Enhancer} * configuration), and the value is the generated class plus some additional values * (see {@link #unwrapCachedValue(Object)}. *

The generated classes can be reused as long as their classloader is reachable.

diff --git a/fine-cglib/src/com/fr/third/net/sf/cglib/core/AsmApi.java b/fine-cglib/src/com/fr/third/net/sf/cglib/core/AsmApi.java new file mode 100644 index 000000000..bfefe2367 --- /dev/null +++ b/fine-cglib/src/com/fr/third/net/sf/cglib/core/AsmApi.java @@ -0,0 +1,16 @@ +package com.fr.third.net.sf.cglib.core; + +import com.fr.third.org.objectweb.asm.Opcodes; + +final class AsmApi { + + /** + * Returns the latest stable ASM API value in {@link Opcodes}. + */ + static int value() { + return Opcodes.ASM7; + } + + private AsmApi() { + } +} diff --git a/fine-cglib/src/com/fr/third/net/sf/cglib/core/ClassEmitter.java b/fine-cglib/src/com/fr/third/net/sf/cglib/core/ClassEmitter.java index fd156dfd5..272037172 100644 --- a/fine-cglib/src/com/fr/third/net/sf/cglib/core/ClassEmitter.java +++ b/fine-cglib/src/com/fr/third/net/sf/cglib/core/ClassEmitter.java @@ -20,7 +20,6 @@ import com.fr.third.net.sf.cglib.transform.ClassTransformer; import com.fr.third.org.objectweb.asm.ClassVisitor; import com.fr.third.org.objectweb.asm.FieldVisitor; import com.fr.third.org.objectweb.asm.MethodVisitor; -import com.fr.third.org.objectweb.asm.Opcodes; import com.fr.third.org.objectweb.asm.Type; import java.util.HashMap; @@ -44,7 +43,7 @@ public class ClassEmitter extends ClassTransformer { } public ClassEmitter() { - super(Opcodes.ASM6); + super(Constants.ASM_API); } public void setTarget(ClassVisitor cv) { @@ -148,7 +147,7 @@ public class ClassEmitter extends ClassTransformer { TypeUtils.toInternalNames(exceptions)); if (sig.equals(Constants.SIG_STATIC) && !TypeUtils.isInterface(getAccess())) { rawStaticInit = v; - MethodVisitor wrapped = new MethodVisitor(Opcodes.ASM6, v) { + MethodVisitor wrapped = new MethodVisitor(Constants.ASM_API, v) { public void visitMaxs(int maxStack, int maxLocals) { // ignore } diff --git a/fine-cglib/src/com/fr/third/net/sf/cglib/core/ClassInfo.java b/fine-cglib/src/com/fr/third/net/sf/cglib/core/ClassInfo.java index 5f71d22fe..c8b275e36 100644 --- a/fine-cglib/src/com/fr/third/net/sf/cglib/core/ClassInfo.java +++ b/fine-cglib/src/com/fr/third/net/sf/cglib/core/ClassInfo.java @@ -15,7 +15,6 @@ */ package com.fr.third.net.sf.cglib.core; -import com.fr.third.org.objectweb.asm.Attribute; import com.fr.third.org.objectweb.asm.Type; abstract public class ClassInfo { diff --git a/fine-cglib/src/com/fr/third/net/sf/cglib/core/ClassNameReader.java b/fine-cglib/src/com/fr/third/net/sf/cglib/core/ClassNameReader.java index 66fb320fa..4d8e6fba7 100644 --- a/fine-cglib/src/com/fr/third/net/sf/cglib/core/ClassNameReader.java +++ b/fine-cglib/src/com/fr/third/net/sf/cglib/core/ClassNameReader.java @@ -17,7 +17,6 @@ package com.fr.third.net.sf.cglib.core; import com.fr.third.org.objectweb.asm.ClassReader; import com.fr.third.org.objectweb.asm.ClassVisitor; -import com.fr.third.org.objectweb.asm.Opcodes; import java.util.*; @@ -38,7 +37,7 @@ public class ClassNameReader { public static String[] getClassInfo(ClassReader r) { final List array = new ArrayList(); try { - r.accept(new ClassVisitor(Opcodes.ASM6, null) { + r.accept(new ClassVisitor(Constants.ASM_API, null) { public void visit(int version, int access, String name, diff --git a/fine-cglib/src/com/fr/third/net/sf/cglib/core/CodeEmitter.java b/fine-cglib/src/com/fr/third/net/sf/cglib/core/CodeEmitter.java index 5ac119198..73995ed92 100644 --- a/fine-cglib/src/com/fr/third/net/sf/cglib/core/CodeEmitter.java +++ b/fine-cglib/src/com/fr/third/net/sf/cglib/core/CodeEmitter.java @@ -15,7 +15,6 @@ */ package com.fr.third.net.sf.cglib.core; -import java.io.*; import java.util.*; import com.fr.third.org.objectweb.asm.*; @@ -40,23 +39,23 @@ public class CodeEmitter extends LocalVariablesSorter { private static final Signature CSTRUCT_STRING = TypeUtils.parseConstructor("String"); - public static final int ADD = Constants.IADD; - public static final int MUL = Constants.IMUL; - public static final int XOR = Constants.IXOR; - public static final int USHR = Constants.IUSHR; - public static final int SUB = Constants.ISUB; - public static final int DIV = Constants.IDIV; - public static final int NEG = Constants.INEG; - public static final int REM = Constants.IREM; - public static final int AND = Constants.IAND; - public static final int OR = Constants.IOR; - - public static final int GT = Constants.IFGT; - public static final int LT = Constants.IFLT; - public static final int GE = Constants.IFGE; - public static final int LE = Constants.IFLE; - public static final int NE = Constants.IFNE; - public static final int EQ = Constants.IFEQ; + public static final int ADD = com.fr.third.net.sf.cglib.core.Constants.IADD; + public static final int MUL = com.fr.third.net.sf.cglib.core.Constants.IMUL; + public static final int XOR = com.fr.third.net.sf.cglib.core.Constants.IXOR; + public static final int USHR = com.fr.third.net.sf.cglib.core.Constants.IUSHR; + public static final int SUB = com.fr.third.net.sf.cglib.core.Constants.ISUB; + public static final int DIV = com.fr.third.net.sf.cglib.core.Constants.IDIV; + public static final int NEG = com.fr.third.net.sf.cglib.core.Constants.INEG; + public static final int REM = com.fr.third.net.sf.cglib.core.Constants.IREM; + public static final int AND = com.fr.third.net.sf.cglib.core.Constants.IAND; + public static final int OR = com.fr.third.net.sf.cglib.core.Constants.IOR; + + public static final int GT = com.fr.third.net.sf.cglib.core.Constants.IFGT; + public static final int LT = com.fr.third.net.sf.cglib.core.Constants.IFLT; + public static final int GE = com.fr.third.net.sf.cglib.core.Constants.IFGE; + public static final int LE = com.fr.third.net.sf.cglib.core.Constants.IFLE; + public static final int NE = com.fr.third.net.sf.cglib.core.Constants.IFNE; + public static final int EQ = com.fr.third.net.sf.cglib.core.Constants.IFEQ; private ClassEmitter ce; private State state; @@ -152,9 +151,9 @@ public class CodeEmitter extends LocalVariablesSorter { exception.getInternalName()); } - public void goTo(Label label) { mv.visitJumpInsn(Constants.GOTO, label); } - public void ifnull(Label label) { mv.visitJumpInsn(Constants.IFNULL, label); } - public void ifnonnull(Label label) { mv.visitJumpInsn(Constants.IFNONNULL, label); } + public void goTo(Label label) { mv.visitJumpInsn(com.fr.third.net.sf.cglib.core.Constants.GOTO, label); } + public void ifnull(Label label) { mv.visitJumpInsn(com.fr.third.net.sf.cglib.core.Constants.IFNULL, label); } + public void ifnonnull(Label label) { mv.visitJumpInsn(com.fr.third.net.sf.cglib.core.Constants.IFNONNULL, label); } public void if_jump(int mode, Label label) { mv.visitJumpInsn(mode, label); @@ -173,33 +172,33 @@ public class CodeEmitter extends LocalVariablesSorter { } switch (type.getSort()) { case Type.LONG: - mv.visitInsn(Constants.LCMP); + mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.LCMP); break; case Type.DOUBLE: - mv.visitInsn(Constants.DCMPG); + mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.DCMPG); break; case Type.FLOAT: - mv.visitInsn(Constants.FCMPG); + mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.FCMPG); break; case Type.ARRAY: case Type.OBJECT: switch (mode) { case EQ: - mv.visitJumpInsn(Constants.IF_ACMPEQ, label); + mv.visitJumpInsn(com.fr.third.net.sf.cglib.core.Constants.IF_ACMPEQ, label); return; case NE: - mv.visitJumpInsn(Constants.IF_ACMPNE, label); + mv.visitJumpInsn(com.fr.third.net.sf.cglib.core.Constants.IF_ACMPNE, label); return; } throw new IllegalArgumentException("Bad comparison for type " + type); default: switch (mode) { - case EQ: intOp = Constants.IF_ICMPEQ; break; - case NE: intOp = Constants.IF_ICMPNE; break; + case EQ: intOp = com.fr.third.net.sf.cglib.core.Constants.IF_ICMPEQ; break; + case NE: intOp = com.fr.third.net.sf.cglib.core.Constants.IF_ICMPNE; break; case GE: swap(); /* fall through */ - case LT: intOp = Constants.IF_ICMPLT; break; + case LT: intOp = com.fr.third.net.sf.cglib.core.Constants.IF_ICMPLT; break; case LE: swap(); /* fall through */ - case GT: intOp = Constants.IF_ICMPGT; break; + case GT: intOp = com.fr.third.net.sf.cglib.core.Constants.IF_ICMPGT; break; } mv.visitJumpInsn(intOp, label); return; @@ -207,16 +206,16 @@ public class CodeEmitter extends LocalVariablesSorter { if_jump(jumpmode, label); } - public void pop() { mv.visitInsn(Constants.POP); } - public void pop2() { mv.visitInsn(Constants.POP2); } - public void dup() { mv.visitInsn(Constants.DUP); } - public void dup2() { mv.visitInsn(Constants.DUP2); } - public void dup_x1() { mv.visitInsn(Constants.DUP_X1); } - public void dup_x2() { mv.visitInsn(Constants.DUP_X2); } - public void dup2_x1() { mv.visitInsn(Constants.DUP2_X1); } - public void dup2_x2() { mv.visitInsn(Constants.DUP2_X2); } - public void swap() { mv.visitInsn(Constants.SWAP); } - public void aconst_null() { mv.visitInsn(Constants.ACONST_NULL); } + public void pop() { mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.POP); } + public void pop2() { mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.POP2); } + public void dup() { mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.DUP); } + public void dup2() { mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.DUP2); } + public void dup_x1() { mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.DUP_X1); } + public void dup_x2() { mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.DUP_X2); } + public void dup2_x1() { mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.DUP2_X1); } + public void dup2_x2() { mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.DUP2_X2); } + public void swap() { mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.SWAP); } + public void aconst_null() { mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.ACONST_NULL); } public void swap(Type prev, Type type) { if (type.getSize() == 1) { @@ -237,13 +236,13 @@ public class CodeEmitter extends LocalVariablesSorter { } } - public void monitorenter() { mv.visitInsn(Constants.MONITORENTER); } - public void monitorexit() { mv.visitInsn(Constants.MONITOREXIT); } + public void monitorenter() { mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.MONITORENTER); } + public void monitorexit() { mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.MONITOREXIT); } public void math(int op, Type type) { mv.visitInsn(type.getOpcode(op)); } - public void array_load(Type type) { mv.visitInsn(type.getOpcode(Constants.IALOAD)); } - public void array_store(Type type) { mv.visitInsn(type.getOpcode(Constants.IASTORE)); } + public void array_load(Type type) { mv.visitInsn(type.getOpcode(com.fr.third.net.sf.cglib.core.Constants.IALOAD)); } + public void array_store(Type type) { mv.visitInsn(type.getOpcode(com.fr.third.net.sf.cglib.core.Constants.IASTORE)); } /** * Casts from one primitive numeric type to another @@ -252,44 +251,44 @@ public class CodeEmitter extends LocalVariablesSorter { if (from != to) { if (from == Type.DOUBLE_TYPE) { if (to == Type.FLOAT_TYPE) { - mv.visitInsn(Constants.D2F); + mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.D2F); } else if (to == Type.LONG_TYPE) { - mv.visitInsn(Constants.D2L); + mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.D2L); } else { - mv.visitInsn(Constants.D2I); + mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.D2I); cast_numeric(Type.INT_TYPE, to); } } else if (from == Type.FLOAT_TYPE) { if (to == Type.DOUBLE_TYPE) { - mv.visitInsn(Constants.F2D); + mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.F2D); } else if (to == Type.LONG_TYPE) { - mv.visitInsn(Constants.F2L); + mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.F2L); } else { - mv.visitInsn(Constants.F2I); + mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.F2I); cast_numeric(Type.INT_TYPE, to); } } else if (from == Type.LONG_TYPE) { if (to == Type.DOUBLE_TYPE) { - mv.visitInsn(Constants.L2D); + mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.L2D); } else if (to == Type.FLOAT_TYPE) { - mv.visitInsn(Constants.L2F); + mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.L2F); } else { - mv.visitInsn(Constants.L2I); + mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.L2I); cast_numeric(Type.INT_TYPE, to); } } else { if (to == Type.BYTE_TYPE) { - mv.visitInsn(Constants.I2B); + mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.I2B); } else if (to == Type.CHAR_TYPE) { - mv.visitInsn(Constants.I2C); + mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.I2C); } else if (to == Type.DOUBLE_TYPE) { - mv.visitInsn(Constants.I2D); + mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.I2D); } else if (to == Type.FLOAT_TYPE) { - mv.visitInsn(Constants.I2F); + mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.I2F); } else if (to == Type.LONG_TYPE) { - mv.visitInsn(Constants.I2L); + mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.I2L); } else if (to == Type.SHORT_TYPE) { - mv.visitInsn(Constants.I2S); + mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.I2S); } } } @@ -301,9 +300,9 @@ public class CodeEmitter extends LocalVariablesSorter { } else if (i <= 5) { mv.visitInsn(TypeUtils.ICONST(i)); } else if (i <= Byte.MAX_VALUE) { - mv.visitIntInsn(Constants.BIPUSH, i); + mv.visitIntInsn(com.fr.third.net.sf.cglib.core.Constants.BIPUSH, i); } else if (i <= Short.MAX_VALUE) { - mv.visitIntInsn(Constants.SIPUSH, i); + mv.visitIntInsn(com.fr.third.net.sf.cglib.core.Constants.SIPUSH, i); } else { mv.visitLdcInsn(new Integer(i)); } @@ -337,26 +336,26 @@ public class CodeEmitter extends LocalVariablesSorter { } public void newarray() { - newarray(Constants.TYPE_OBJECT); + newarray(com.fr.third.net.sf.cglib.core.Constants.TYPE_OBJECT); } public void newarray(Type type) { if (TypeUtils.isPrimitive(type)) { - mv.visitIntInsn(Constants.NEWARRAY, TypeUtils.NEWARRAY(type)); + mv.visitIntInsn(com.fr.third.net.sf.cglib.core.Constants.NEWARRAY, TypeUtils.NEWARRAY(type)); } else { - emit_type(Constants.ANEWARRAY, type); + emit_type(com.fr.third.net.sf.cglib.core.Constants.ANEWARRAY, type); } } public void arraylength() { - mv.visitInsn(Constants.ARRAYLENGTH); + mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.ARRAYLENGTH); } public void load_this() { if (TypeUtils.isStatic(state.access)) { throw new IllegalStateException("no 'this' pointer within static method"); } - mv.visitVarInsn(Constants.ALOAD, 0); + mv.visitVarInsn(com.fr.third.net.sf.cglib.core.Constants.ALOAD, 0); } /** @@ -395,12 +394,12 @@ public class CodeEmitter extends LocalVariablesSorter { private void load_local(Type t, int pos) { // TODO: make t == null ok? - mv.visitVarInsn(t.getOpcode(Constants.ILOAD), pos); + mv.visitVarInsn(t.getOpcode(com.fr.third.net.sf.cglib.core.Constants.ILOAD), pos); } private void store_local(Type t, int pos) { // TODO: make t == null ok? - mv.visitVarInsn(t.getOpcode(Constants.ISTORE), pos); + mv.visitVarInsn(t.getOpcode(com.fr.third.net.sf.cglib.core.Constants.ISTORE), pos); } public void iinc(Local local, int amount) { @@ -416,51 +415,51 @@ public class CodeEmitter extends LocalVariablesSorter { } public void return_value() { - mv.visitInsn(state.sig.getReturnType().getOpcode(Constants.IRETURN)); + mv.visitInsn(state.sig.getReturnType().getOpcode(com.fr.third.net.sf.cglib.core.Constants.IRETURN)); } public void getfield(String name) { ClassEmitter.FieldInfo info = ce.getFieldInfo(name); - int opcode = TypeUtils.isStatic(info.access) ? Constants.GETSTATIC : Constants.GETFIELD; + int opcode = TypeUtils.isStatic(info.access) ? com.fr.third.net.sf.cglib.core.Constants.GETSTATIC : com.fr.third.net.sf.cglib.core.Constants.GETFIELD; emit_field(opcode, ce.getClassType(), name, info.type); } public void putfield(String name) { ClassEmitter.FieldInfo info = ce.getFieldInfo(name); - int opcode = TypeUtils.isStatic(info.access) ? Constants.PUTSTATIC : Constants.PUTFIELD; + int opcode = TypeUtils.isStatic(info.access) ? com.fr.third.net.sf.cglib.core.Constants.PUTSTATIC : com.fr.third.net.sf.cglib.core.Constants.PUTFIELD; emit_field(opcode, ce.getClassType(), name, info.type); } public void super_getfield(String name, Type type) { - emit_field(Constants.GETFIELD, ce.getSuperType(), name, type); + emit_field(com.fr.third.net.sf.cglib.core.Constants.GETFIELD, ce.getSuperType(), name, type); } public void super_putfield(String name, Type type) { - emit_field(Constants.PUTFIELD, ce.getSuperType(), name, type); + emit_field(com.fr.third.net.sf.cglib.core.Constants.PUTFIELD, ce.getSuperType(), name, type); } public void super_getstatic(String name, Type type) { - emit_field(Constants.GETSTATIC, ce.getSuperType(), name, type); + emit_field(com.fr.third.net.sf.cglib.core.Constants.GETSTATIC, ce.getSuperType(), name, type); } public void super_putstatic(String name, Type type) { - emit_field(Constants.PUTSTATIC, ce.getSuperType(), name, type); + emit_field(com.fr.third.net.sf.cglib.core.Constants.PUTSTATIC, ce.getSuperType(), name, type); } public void getfield(Type owner, String name, Type type) { - emit_field(Constants.GETFIELD, owner, name, type); + emit_field(com.fr.third.net.sf.cglib.core.Constants.GETFIELD, owner, name, type); } public void putfield(Type owner, String name, Type type) { - emit_field(Constants.PUTFIELD, owner, name, type); + emit_field(com.fr.third.net.sf.cglib.core.Constants.PUTFIELD, owner, name, type); } public void getstatic(Type owner, String name, Type type) { - emit_field(Constants.GETSTATIC, owner, name, type); + emit_field(com.fr.third.net.sf.cglib.core.Constants.GETSTATIC, owner, name, type); } public void putstatic(Type owner, String name, Type type) { - emit_field(Constants.PUTSTATIC, owner, name, type); + emit_field(com.fr.third.net.sf.cglib.core.Constants.PUTSTATIC, owner, name, type); } // package-protected for EmitUtils, try to fix @@ -476,7 +475,7 @@ public class CodeEmitter extends LocalVariablesSorter { } public void super_invoke(Signature sig) { - emit_invoke(Constants.INVOKESPECIAL, ce.getSuperType(), sig); + emit_invoke(com.fr.third.net.sf.cglib.core.Constants.INVOKESPECIAL, ce.getSuperType(), sig); } public void invoke_constructor(Type type) { @@ -492,9 +491,9 @@ public class CodeEmitter extends LocalVariablesSorter { } private void emit_invoke(int opcode, Type type, Signature sig) { - if (sig.getName().equals(Constants.CONSTRUCTOR_NAME) && - ((opcode == Constants.INVOKEVIRTUAL) || - (opcode == Constants.INVOKESTATIC))) { + if (sig.getName().equals(com.fr.third.net.sf.cglib.core.Constants.CONSTRUCTOR_NAME) && + ((opcode == com.fr.third.net.sf.cglib.core.Constants.INVOKEVIRTUAL) || + (opcode == com.fr.third.net.sf.cglib.core.Constants.INVOKESTATIC))) { // TODO: error } mv.visitMethodInsn(opcode, @@ -505,15 +504,15 @@ public class CodeEmitter extends LocalVariablesSorter { } public void invoke_interface(Type owner, Signature sig) { - emit_invoke(Constants.INVOKEINTERFACE, owner, sig); + emit_invoke(com.fr.third.net.sf.cglib.core.Constants.INVOKEINTERFACE, owner, sig); } public void invoke_virtual(Type owner, Signature sig) { - emit_invoke(Constants.INVOKEVIRTUAL, owner, sig); + emit_invoke(com.fr.third.net.sf.cglib.core.Constants.INVOKEVIRTUAL, owner, sig); } public void invoke_static(Type owner, Signature sig) { - emit_invoke(Constants.INVOKESTATIC, owner, sig); + emit_invoke(com.fr.third.net.sf.cglib.core.Constants.INVOKESTATIC, owner, sig); } public void invoke_virtual_this(Signature sig) { @@ -525,7 +524,7 @@ public class CodeEmitter extends LocalVariablesSorter { } public void invoke_constructor(Type type, Signature sig) { - emit_invoke(Constants.INVOKESPECIAL, type, sig); + emit_invoke(com.fr.third.net.sf.cglib.core.Constants.INVOKESPECIAL, type, sig); } public void invoke_constructor_this(Signature sig) { @@ -541,7 +540,7 @@ public class CodeEmitter extends LocalVariablesSorter { } public void new_instance(Type type) { - emit_type(Constants.NEW, type); + emit_type(com.fr.third.net.sf.cglib.core.Constants.NEW, type); } private void emit_type(int opcode, Type type) { @@ -559,16 +558,16 @@ public class CodeEmitter extends LocalVariablesSorter { aaload(); } - public void aaload() { mv.visitInsn(Constants.AALOAD); } - public void aastore() { mv.visitInsn(Constants.AASTORE); } - public void athrow() { mv.visitInsn(Constants.ATHROW); } + public void aaload() { mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.AALOAD); } + public void aastore() { mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.AASTORE); } + public void athrow() { mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.ATHROW); } public Label make_label() { return new Label(); } public Local make_local() { - return make_local(Constants.TYPE_OBJECT); + return make_local(com.fr.third.net.sf.cglib.core.Constants.TYPE_OBJECT); } public Local make_local(Type type) { @@ -580,13 +579,13 @@ public class CodeEmitter extends LocalVariablesSorter { } public void checkcast(Type type) { - if (!type.equals(Constants.TYPE_OBJECT)) { - emit_type(Constants.CHECKCAST, type); + if (!type.equals(com.fr.third.net.sf.cglib.core.Constants.TYPE_OBJECT)) { + emit_type(com.fr.third.net.sf.cglib.core.Constants.CHECKCAST, type); } } public void instance_of(Type type) { - emit_type(Constants.INSTANCEOF, type); + emit_type(com.fr.third.net.sf.cglib.core.Constants.INSTANCEOF, type); } public void instance_of_this() { @@ -718,7 +717,7 @@ public class CodeEmitter extends LocalVariablesSorter { dup_x1(); swap(); } - invoke_constructor(boxed, new Signature(Constants.CONSTRUCTOR_NAME, Type.VOID_TYPE, new Type[]{ type })); + invoke_constructor(boxed, new Signature(com.fr.third.net.sf.cglib.core.Constants.CONSTRUCTOR_NAME, Type.VOID_TYPE, new Type[]{ type })); } } } @@ -731,17 +730,17 @@ public class CodeEmitter extends LocalVariablesSorter { * @return true if the value was unboxed */ public void unbox(Type type) { - Type t = Constants.TYPE_NUMBER; + Type t = com.fr.third.net.sf.cglib.core.Constants.TYPE_NUMBER; Signature sig = null; switch (type.getSort()) { case Type.VOID: return; case Type.CHAR: - t = Constants.TYPE_CHARACTER; + t = com.fr.third.net.sf.cglib.core.Constants.TYPE_CHARACTER; sig = CHAR_VALUE; break; case Type.BOOLEAN: - t = Constants.TYPE_BOOLEAN; + t = com.fr.third.net.sf.cglib.core.Constants.TYPE_BOOLEAN; sig = BOOLEAN_VALUE; break; case Type.DOUBLE: @@ -847,7 +846,7 @@ public class CodeEmitter extends LocalVariablesSorter { ClassInfo classInfo = method.getClassInfo(); Type type = classInfo.getType(); Signature sig = method.getSignature(); - if (sig.getName().equals(Constants.CONSTRUCTOR_NAME)) { + if (sig.getName().equals(com.fr.third.net.sf.cglib.core.Constants.CONSTRUCTOR_NAME)) { invoke_constructor(type, sig); } else if (TypeUtils.isInterface(classInfo.getModifiers())) { invoke_interface(type, sig); diff --git a/fine-cglib/src/com/fr/third/net/sf/cglib/core/CollectionUtils.java b/fine-cglib/src/com/fr/third/net/sf/cglib/core/CollectionUtils.java index d9424f339..28ee76816 100644 --- a/fine-cglib/src/com/fr/third/net/sf/cglib/core/CollectionUtils.java +++ b/fine-cglib/src/com/fr/third/net/sf/cglib/core/CollectionUtils.java @@ -16,7 +16,6 @@ package com.fr.third.net.sf.cglib.core; import java.util.*; -import java.lang.reflect.Array; /** * @author Chris Nokleberg diff --git a/fine-cglib/src/com/fr/third/net/sf/cglib/core/Constants.java b/fine-cglib/src/com/fr/third/net/sf/cglib/core/Constants.java index 08da2d0cb..70e90e4ae 100644 --- a/fine-cglib/src/com/fr/third/net/sf/cglib/core/Constants.java +++ b/fine-cglib/src/com/fr/third/net/sf/cglib/core/Constants.java @@ -22,6 +22,10 @@ import com.fr.third.org.objectweb.asm.Type; * @version $Id: Constants.java,v 1.21 2006/03/05 02:43:19 herbyderby Exp $ */ public interface Constants extends com.fr.third.org.objectweb.asm.Opcodes { + + /* Indicates the ASM API version that is used throughout cglib */ + public static final int ASM_API = AsmApi.value(); + public static final Class[] EMPTY_CLASS_ARRAY = {}; public static final Type[] TYPES_EMPTY = {}; @@ -52,7 +56,7 @@ public interface Constants extends com.fr.third.org.objectweb.asm.Opcodes { public static final Type TYPE_RUNTIME_EXCEPTION = TypeUtils.parseType("RuntimeException"); public static final Type TYPE_ERROR = TypeUtils.parseType("Error"); public static final Type TYPE_SYSTEM = TypeUtils.parseType("System"); - public static final Type TYPE_SIGNATURE = TypeUtils.parseType("com.fr.third.net.sf.cglib.core.Signature"); + public static final Type TYPE_SIGNATURE = TypeUtils.parseType("net.sf.cglib.core.Signature"); public static final Type TYPE_TYPE = Type.getType(Type.class); public static final String CONSTRUCTOR_NAME = ""; diff --git a/fine-cglib/src/com/fr/third/net/sf/cglib/core/DebuggingClassWriter.java b/fine-cglib/src/com/fr/third/net/sf/cglib/core/DebuggingClassWriter.java index a6706c4b6..5b5efc807 100644 --- a/fine-cglib/src/com/fr/third/net/sf/cglib/core/DebuggingClassWriter.java +++ b/fine-cglib/src/com/fr/third/net/sf/cglib/core/DebuggingClassWriter.java @@ -18,7 +18,6 @@ package com.fr.third.net.sf.cglib.core; import com.fr.third.org.objectweb.asm.ClassWriter; import com.fr.third.org.objectweb.asm.ClassReader; import com.fr.third.org.objectweb.asm.ClassVisitor; -import com.fr.third.org.objectweb.asm.Opcodes; import java.io.*; import java.lang.reflect.Constructor; @@ -46,7 +45,7 @@ public class DebuggingClassWriter extends ClassVisitor { } public DebuggingClassWriter(int flags) { - super(Opcodes.ASM6, new ClassWriter(flags)); + super(Constants.ASM_API, new ClassWriter(flags)); } public void visit(int version, diff --git a/fine-cglib/src/com/fr/third/net/sf/cglib/core/DefaultNamingPolicy.java b/fine-cglib/src/com/fr/third/net/sf/cglib/core/DefaultNamingPolicy.java index 6609ef9fd..04f158fe4 100644 --- a/fine-cglib/src/com/fr/third/net/sf/cglib/core/DefaultNamingPolicy.java +++ b/fine-cglib/src/com/fr/third/net/sf/cglib/core/DefaultNamingPolicy.java @@ -15,12 +15,10 @@ */ package com.fr.third.net.sf.cglib.core; -import java.util.Set; - /** * The default policy used by {@link AbstractClassGenerator}. * Generates names such as - *

com.fr.third.net.sf.cglib.Foo$$EnhancerByCGLIB$$38272841

+ *

net.sf.cglib.Foo$$EnhancerByCGLIB$$38272841

* This is composed of a prefix based on the name of the superclass, a fixed * string incorporating the CGLIB class responsible for generation, and a * hashcode derived from the parameters used to create the object. If the same @@ -33,11 +31,11 @@ public class DefaultNamingPolicy implements NamingPolicy { /** * This allows to test collisions of {@code key.hashCode()}. */ - private final static boolean STRESS_HASH_CODE = Boolean.getBoolean("com.fr.third.net.sf.cglib.test.stressHashCodes"); + private final static boolean STRESS_HASH_CODE = Boolean.getBoolean("net.sf.cglib.test.stressHashCodes"); public String getClassName(String prefix, String source, Object key, Predicate names) { if (prefix == null) { - prefix = "com.fr.third.net.sf.cglib.empty.Object"; + prefix = "net.sf.cglib.empty.Object"; } else if (prefix.startsWith("java")) { prefix = "$" + prefix; } diff --git a/fine-cglib/src/com/fr/third/net/sf/cglib/core/DuplicatesPredicate.java b/fine-cglib/src/com/fr/third/net/sf/cglib/core/DuplicatesPredicate.java index 67c2204ec..ee3b8bc56 100644 --- a/fine-cglib/src/com/fr/third/net/sf/cglib/core/DuplicatesPredicate.java +++ b/fine-cglib/src/com/fr/third/net/sf/cglib/core/DuplicatesPredicate.java @@ -15,13 +15,150 @@ */ package com.fr.third.net.sf.cglib.core; +import java.io.IOException; +import java.io.InputStream; import java.lang.reflect.Method; -import java.util.*; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import com.fr.third.org.objectweb.asm.ClassReader; +import com.fr.third.org.objectweb.asm.ClassVisitor; +import com.fr.third.org.objectweb.asm.MethodVisitor; +import com.fr.third.org.objectweb.asm.Opcodes; public class DuplicatesPredicate implements Predicate { - private Set unique = new HashSet(); + private final Set unique; + private final Set rejected; - public boolean evaluate(Object arg) { - return unique.add(MethodWrapper.create((Method)arg)); + /** + * Constructs a DuplicatesPredicate that will allow subclass bridge methods to be preferred over + * superclass non-bridge methods. + */ + public DuplicatesPredicate() { + unique = new HashSet(); + rejected = Collections.emptySet(); + } + + /** + * Constructs a DuplicatesPredicate that prefers using superclass non-bridge methods despite a + * subclass method with the same signtaure existing (if the subclass is a bridge method). + */ + public DuplicatesPredicate(List allMethods) { + rejected = new HashSet(); + unique = new HashSet(); + + // Traverse through the methods and capture ones that are bridge + // methods when a subsequent method (from a non-interface superclass) + // has the same signature but isn't a bridge. Record these so that + // we avoid using them when filtering duplicates. + Map scanned = new HashMap(); + Map suspects = new HashMap(); + for (Object o : allMethods) { + Method method = (Method) o; + Object sig = MethodWrapper.create(method); + Method existing = (Method) scanned.get(sig); + if (existing == null) { + scanned.put(sig, method); + } else if (!suspects.containsKey(sig) && existing.isBridge() && !method.isBridge()) { + // TODO: this currently only will capture a single bridge. it will not work + // if there's Child.bridge1 Middle.bridge2 Parent.concrete. (we'd offer the 2nd bridge). + // no idea if that's even possible tho... + suspects.put(sig, existing); + } + } + + if (!suspects.isEmpty()) { + Set classes = new HashSet(); + UnnecessaryBridgeFinder finder = new UnnecessaryBridgeFinder(rejected); + for (Object o : suspects.values()) { + Method m = (Method) o; + classes.add(m.getDeclaringClass()); + finder.addSuspectMethod(m); + } + for (Object o : classes) { + Class c = (Class) o; + try { + ClassLoader cl = getClassLoader(c); + if (cl == null) { + continue; + } + InputStream is = cl.getResourceAsStream(c.getName().replace('.', '/') + ".class"); + if (is == null) { + continue; + } + try { + new ClassReader(is).accept(finder, ClassReader.SKIP_FRAMES | ClassReader.SKIP_DEBUG); + } finally { + is.close(); + } + } catch (IOException ignored) { + } + } + } + } + + public boolean evaluate(Object arg) { + return !rejected.contains(arg) && unique.add(MethodWrapper.create((Method) arg)); + } + + private static ClassLoader getClassLoader(Class c) { + ClassLoader cl = c.getClassLoader(); + if (cl == null) { + cl = DuplicatesPredicate.class.getClassLoader(); + } + if (cl == null) { + cl = Thread.currentThread().getContextClassLoader(); + } + return cl; + } + + private static class UnnecessaryBridgeFinder extends ClassVisitor { + private final Set rejected; + + private Signature currentMethodSig = null; + private Map methods = new HashMap(); + + UnnecessaryBridgeFinder(Set rejected) { + super(Constants.ASM_API); + this.rejected = rejected; + } + + void addSuspectMethod(Method m) { + methods.put(ReflectUtils.getSignature(m), m); + } + + public void visit( + int version, + int access, + String name, + String signature, + String superName, + String[] interfaces) {} + + public MethodVisitor visitMethod( + int access, String name, String desc, String signature, String[] exceptions) { + Signature sig = new Signature(name, desc); + final Method currentMethod = (Method) methods.remove(sig); + if (currentMethod != null) { + currentMethodSig = sig; + return new MethodVisitor(Constants.ASM_API) { + public void visitMethodInsn( + int opcode, String owner, String name, String desc, boolean itf) { + if (opcode == Opcodes.INVOKESPECIAL && currentMethodSig != null) { + Signature target = new Signature(name, desc); + if (target.equals(currentMethodSig)) { + rejected.add(currentMethod); + } + currentMethodSig = null; + } + } + }; + } else { + return null; + } } + } } diff --git a/fine-cglib/src/com/fr/third/net/sf/cglib/core/KeyFactory.java b/fine-cglib/src/com/fr/third/net/sf/cglib/core/KeyFactory.java index f1d5cea1e..2e9947f4e 100644 --- a/fine-cglib/src/com/fr/third/net/sf/cglib/core/KeyFactory.java +++ b/fine-cglib/src/com/fr/third/net/sf/cglib/core/KeyFactory.java @@ -69,7 +69,7 @@ abstract public class KeyFactory { private static final Signature APPEND_STRING = TypeUtils.parseSignature("StringBuffer append(String)"); private static final Type KEY_FACTORY = - TypeUtils.parseType("com.fr.third.net.sf.cglib.core.KeyFactory"); + TypeUtils.parseType("net.sf.cglib.core.KeyFactory"); private static final Signature GET_SORT = TypeUtils.parseSignature("int getSort()"); diff --git a/fine-cglib/src/com/fr/third/net/sf/cglib/core/LocalVariablesSorter.java b/fine-cglib/src/com/fr/third/net/sf/cglib/core/LocalVariablesSorter.java index f80ce99ca..6de1a5401 100644 --- a/fine-cglib/src/com/fr/third/net/sf/cglib/core/LocalVariablesSorter.java +++ b/fine-cglib/src/com/fr/third/net/sf/cglib/core/LocalVariablesSorter.java @@ -63,7 +63,7 @@ public class LocalVariablesSorter extends MethodVisitor { final String desc, final MethodVisitor mv) { - super(Opcodes.ASM6, mv); + super(Constants.ASM_API, mv); state = new State(); Type[] args = Type.getArgumentTypes(desc); state.nextLocal = ((Opcodes.ACC_STATIC & access) != 0) ? 0 : 1; @@ -74,7 +74,7 @@ public class LocalVariablesSorter extends MethodVisitor { } public LocalVariablesSorter(LocalVariablesSorter lvs) { - super(Opcodes.ASM6, lvs.mv); + super(Constants.ASM_API, lvs.mv); state = lvs.state; firstLocal = lvs.firstLocal; } diff --git a/fine-cglib/src/com/fr/third/net/sf/cglib/core/MethodInfo.java b/fine-cglib/src/com/fr/third/net/sf/cglib/core/MethodInfo.java index daee5afa3..403d4e86e 100644 --- a/fine-cglib/src/com/fr/third/net/sf/cglib/core/MethodInfo.java +++ b/fine-cglib/src/com/fr/third/net/sf/cglib/core/MethodInfo.java @@ -15,7 +15,6 @@ */ package com.fr.third.net.sf.cglib.core; -import com.fr.third.org.objectweb.asm.Attribute; import com.fr.third.org.objectweb.asm.Type; abstract public class MethodInfo { diff --git a/fine-cglib/src/com/fr/third/net/sf/cglib/core/NamingPolicy.java b/fine-cglib/src/com/fr/third/net/sf/cglib/core/NamingPolicy.java index d240cc4e1..b4a4fde15 100644 --- a/fine-cglib/src/com/fr/third/net/sf/cglib/core/NamingPolicy.java +++ b/fine-cglib/src/com/fr/third/net/sf/cglib/core/NamingPolicy.java @@ -15,8 +15,6 @@ */ package com.fr.third.net.sf.cglib.core; -import java.util.Set; - /** * Customize the generated class name for {@link AbstractClassGenerator}-based utilities. */ @@ -24,7 +22,7 @@ public interface NamingPolicy { /** * Choose a name for a generated class. * @param prefix a dotted-name chosen by the generating class (possibly to put the generated class in a particular package) - * @param source the fully-qualified class name of the generating class (for example "com.fr.third.net.sf.cglib.Enhancer") + * @param source the fully-qualified class name of the generating class (for example "net.sf.cglib.Enhancer") * @param key A key object representing the state of the parameters; for caching to work properly, equal keys should result * in the same generated class name. The default policy incorporates key.hashCode() into the class name. * @param names a predicate that returns true if the given classname has already been used in the same ClassLoader. diff --git a/fine-cglib/src/com/fr/third/net/sf/cglib/core/internal/CustomizerRegistry.java b/fine-cglib/src/com/fr/third/net/sf/cglib/core/internal/CustomizerRegistry.java index b8732803c..b06442437 100644 --- a/fine-cglib/src/com/fr/third/net/sf/cglib/core/internal/CustomizerRegistry.java +++ b/fine-cglib/src/com/fr/third/net/sf/cglib/core/internal/CustomizerRegistry.java @@ -1,7 +1,6 @@ package com.fr.third.net.sf.cglib.core.internal; import com.fr.third.net.sf.cglib.core.Customizer; -import com.fr.third.net.sf.cglib.core.FieldTypeCustomizer; import com.fr.third.net.sf.cglib.core.KeyFactoryCustomizer; import java.util.*; diff --git a/fine-cglib/src/com/fr/third/net/sf/cglib/proxy/BridgeMethodResolver.java b/fine-cglib/src/com/fr/third/net/sf/cglib/proxy/BridgeMethodResolver.java index 7d77d7c79..57604f21d 100644 --- a/fine-cglib/src/com/fr/third/net/sf/cglib/proxy/BridgeMethodResolver.java +++ b/fine-cglib/src/com/fr/third/net/sf/cglib/proxy/BridgeMethodResolver.java @@ -22,22 +22,21 @@ import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Set; - +import com.fr.third.net.sf.cglib.core.Constants; import com.fr.third.net.sf.cglib.core.Signature; - -import com.fr.third.org.objectweb.asm.AnnotationVisitor; -import com.fr.third.org.objectweb.asm.Attribute; import com.fr.third.org.objectweb.asm.ClassReader; import com.fr.third.org.objectweb.asm.ClassVisitor; -import com.fr.third.org.objectweb.asm.FieldVisitor; -import com.fr.third.org.objectweb.asm.Label; import com.fr.third.org.objectweb.asm.MethodVisitor; import com.fr.third.org.objectweb.asm.Opcodes; /** - * Uses bytecode reflection to figure out the targets of all bridge methods - * that use invokespecial, so that we can later rewrite them to use invokevirtual. - * + * Uses bytecode reflection to figure out the targets of all bridge methods that use invokespecial + * and invokeinterface, so that we can later rewrite them to use invokevirtual. + * + *

For interface bridges, using invokesuper will fail since the method being bridged to is in a + * superinterface, not a superclass. Starting in Java 8, javac emits default bridge methods in + * interfaces, which use invokeinterface to bridge to the target method. + * * @author sberlin@gmail.com (Sam Berlin) */ class BridgeMethodResolver { @@ -84,7 +83,7 @@ class BridgeMethodResolver { private Signature currentMethod = null; BridgedFinder(Set eligibleMethods, Map resolved) { - super(Opcodes.ASM6); + super(Constants.ASM_API); this.resolved = resolved; this.eligibleMethods = eligibleMethods; } @@ -98,10 +97,12 @@ class BridgeMethodResolver { Signature sig = new Signature(name, desc); if (eligibleMethods.remove(sig)) { currentMethod = sig; - return new MethodVisitor(Opcodes.ASM6) { - public void visitMethodInsn(int opcode, String owner, String name, - String desc, boolean itf) { - if (opcode == Opcodes.INVOKESPECIAL && currentMethod != null) { + return new MethodVisitor(Constants.ASM_API) { + public void visitMethodInsn( + int opcode, String owner, String name, String desc, boolean itf) { + if ((opcode == Opcodes.INVOKESPECIAL + || (itf && opcode == Opcodes.INVOKEINTERFACE)) + && currentMethod != null) { Signature target = new Signature(name, desc); // If the target signature is the same as the current, // we shouldn't change our bridge becaues invokespecial diff --git a/fine-cglib/src/com/fr/third/net/sf/cglib/proxy/CallbackGenerator.java b/fine-cglib/src/com/fr/third/net/sf/cglib/proxy/CallbackGenerator.java index 66c1957d6..1c239c180 100644 --- a/fine-cglib/src/com/fr/third/net/sf/cglib/proxy/CallbackGenerator.java +++ b/fine-cglib/src/com/fr/third/net/sf/cglib/proxy/CallbackGenerator.java @@ -16,7 +16,12 @@ package com.fr.third.net.sf.cglib.proxy; import java.util.List; -import com.fr.third.net.sf.cglib.core.*; + +import com.fr.third.net.sf.cglib.core.ClassEmitter; +import com.fr.third.net.sf.cglib.core.CodeEmitter; +import com.fr.third.net.sf.cglib.core.MethodInfo; +import com.fr.third.net.sf.cglib.core.Signature; +import net.sf.cglib.core.*; interface CallbackGenerator { diff --git a/fine-cglib/src/com/fr/third/net/sf/cglib/proxy/DispatcherGenerator.java b/fine-cglib/src/com/fr/third/net/sf/cglib/proxy/DispatcherGenerator.java index 8c34d1dd6..0f25ccd85 100644 --- a/fine-cglib/src/com/fr/third/net/sf/cglib/proxy/DispatcherGenerator.java +++ b/fine-cglib/src/com/fr/third/net/sf/cglib/proxy/DispatcherGenerator.java @@ -16,7 +16,13 @@ package com.fr.third.net.sf.cglib.proxy; import java.util.*; -import com.fr.third.net.sf.cglib.core.*; + +import com.fr.third.net.sf.cglib.core.ClassEmitter; +import com.fr.third.net.sf.cglib.core.CodeEmitter; +import com.fr.third.net.sf.cglib.core.MethodInfo; +import com.fr.third.net.sf.cglib.core.Signature; +import com.fr.third.net.sf.cglib.core.TypeUtils; +import net.sf.cglib.core.*; import com.fr.third.org.objectweb.asm.Type; class DispatcherGenerator implements CallbackGenerator { @@ -26,9 +32,9 @@ class DispatcherGenerator implements CallbackGenerator { new DispatcherGenerator(true); private static final Type DISPATCHER = - TypeUtils.parseType("com.fr.third.net.sf.cglib.proxy.Dispatcher"); + TypeUtils.parseType("net.sf.cglib.proxy.Dispatcher"); private static final Type PROXY_REF_DISPATCHER = - TypeUtils.parseType("com.fr.third.net.sf.cglib.proxy.ProxyRefDispatcher"); + TypeUtils.parseType("net.sf.cglib.proxy.ProxyRefDispatcher"); private static final Signature LOAD_OBJECT = TypeUtils.parseSignature("Object loadObject()"); private static final Signature PROXY_REF_LOAD_OBJECT = diff --git a/fine-cglib/src/com/fr/third/net/sf/cglib/proxy/Enhancer.java b/fine-cglib/src/com/fr/third/net/sf/cglib/proxy/Enhancer.java index 873a88bab..b8191283c 100644 --- a/fine-cglib/src/com/fr/third/net/sf/cglib/proxy/Enhancer.java +++ b/fine-cglib/src/com/fr/third/net/sf/cglib/proxy/Enhancer.java @@ -23,7 +23,29 @@ import java.lang.reflect.Method; import java.security.ProtectionDomain; import java.util.*; -import com.fr.third.net.sf.cglib.core.*; +import com.fr.third.net.sf.cglib.core.AbstractClassGenerator; +import com.fr.third.net.sf.cglib.core.ClassEmitter; +import com.fr.third.net.sf.cglib.core.CodeEmitter; +import com.fr.third.net.sf.cglib.core.CodeGenerationException; +import com.fr.third.net.sf.cglib.core.CollectionUtils; +import com.fr.third.net.sf.cglib.core.Constants; +import com.fr.third.net.sf.cglib.core.DuplicatesPredicate; +import com.fr.third.net.sf.cglib.core.EmitUtils; +import com.fr.third.net.sf.cglib.core.KeyFactory; +import com.fr.third.net.sf.cglib.core.Local; +import com.fr.third.net.sf.cglib.core.MethodInfo; +import com.fr.third.net.sf.cglib.core.MethodInfoTransformer; +import com.fr.third.net.sf.cglib.core.MethodWrapper; +import com.fr.third.net.sf.cglib.core.ObjectSwitchCallback; +import com.fr.third.net.sf.cglib.core.ProcessSwitchCallback; +import com.fr.third.net.sf.cglib.core.ReflectUtils; +import com.fr.third.net.sf.cglib.core.RejectModifierPredicate; +import com.fr.third.net.sf.cglib.core.Signature; +import com.fr.third.net.sf.cglib.core.Transformer; +import com.fr.third.net.sf.cglib.core.TypeUtils; +import com.fr.third.net.sf.cglib.core.VisibilityPredicate; +import com.fr.third.net.sf.cglib.core.WeakCacheKey; +import net.sf.cglib.core.*; import com.fr.third.org.objectweb.asm.ClassVisitor; import com.fr.third.org.objectweb.asm.Type; import com.fr.third.org.objectweb.asm.Label; @@ -70,7 +92,7 @@ public class Enhancer extends AbstractClassGenerator private static final Source SOURCE = new Source(Enhancer.class.getName()); private static final EnhancerKey KEY_FACTORY = - (EnhancerKey)KeyFactory.create(EnhancerKey.class, KeyFactory.HASH_ASM_TYPE, null); + (EnhancerKey) KeyFactory.create(EnhancerKey.class, KeyFactory.HASH_ASM_TYPE, null); private static final String BOUND_FIELD = "CGLIB$BOUND"; private static final String FACTORY_DATA_FIELD = "CGLIB$FACTORY_DATA"; @@ -80,7 +102,7 @@ public class Enhancer extends AbstractClassGenerator private static final String SET_STATIC_CALLBACKS_NAME = "CGLIB$SET_STATIC_CALLBACKS"; private static final String CONSTRUCTED_FIELD = "CGLIB$CONSTRUCTED"; /** - * {@link com.fr.third.net.sf.cglib.core.AbstractClassGenerator.ClassLoaderData#generatedClasses} requires to keep cache key + * {@link AbstractClassGenerator.ClassLoaderData#generatedClasses} requires to keep cache key * in a good shape (the keys should be up and running if the proxy class is alive), and one of the cache keys is * {@link CallbackFilter}. That is why the generated class contains static field that keeps strong reference to * the {@link #filter}. @@ -93,7 +115,7 @@ public class Enhancer extends AbstractClassGenerator private static final Type OBJECT_TYPE = TypeUtils.parseType("Object"); private static final Type FACTORY = - TypeUtils.parseType("com.fr.third.net.sf.cglib.proxy.Factory"); + TypeUtils.parseType("net.sf.cglib.proxy.Factory"); private static final Type ILLEGAL_STATE_EXCEPTION = TypeUtils.parseType("IllegalStateException"); private static final Type ILLEGAL_ARGUMENT_EXCEPTION = @@ -101,7 +123,7 @@ public class Enhancer extends AbstractClassGenerator private static final Type THREAD_LOCAL = TypeUtils.parseType("ThreadLocal"); private static final Type CALLBACK = - TypeUtils.parseType("com.fr.third.net.sf.cglib.proxy.Callback"); + TypeUtils.parseType("net.sf.cglib.proxy.Callback"); private static final Type CALLBACK_ARRAY = Type.getType(Callback[].class); private static final Signature CSTRUCT_NULL = @@ -554,7 +576,7 @@ public class Enhancer extends AbstractClassGenerator } CollectionUtils.filter(methods, new RejectModifierPredicate(Constants.ACC_STATIC)); CollectionUtils.filter(methods, new VisibilityPredicate(superclass, true)); - CollectionUtils.filter(methods, new DuplicatesPredicate()); + CollectionUtils.filter(methods, new DuplicatesPredicate(methods)); CollectionUtils.filter(methods, new RejectModifierPredicate(Constants.ACC_FINAL)); } diff --git a/fine-cglib/src/com/fr/third/net/sf/cglib/proxy/FixedValueGenerator.java b/fine-cglib/src/com/fr/third/net/sf/cglib/proxy/FixedValueGenerator.java index 3bc09044a..55b777082 100644 --- a/fine-cglib/src/com/fr/third/net/sf/cglib/proxy/FixedValueGenerator.java +++ b/fine-cglib/src/com/fr/third/net/sf/cglib/proxy/FixedValueGenerator.java @@ -16,13 +16,19 @@ package com.fr.third.net.sf.cglib.proxy; import java.util.*; -import com.fr.third.net.sf.cglib.core.*; + +import com.fr.third.net.sf.cglib.core.ClassEmitter; +import com.fr.third.net.sf.cglib.core.CodeEmitter; +import com.fr.third.net.sf.cglib.core.MethodInfo; +import com.fr.third.net.sf.cglib.core.Signature; +import com.fr.third.net.sf.cglib.core.TypeUtils; +import net.sf.cglib.core.*; import com.fr.third.org.objectweb.asm.Type; class FixedValueGenerator implements CallbackGenerator { public static final FixedValueGenerator INSTANCE = new FixedValueGenerator(); private static final Type FIXED_VALUE = - TypeUtils.parseType("com.fr.third.net.sf.cglib.proxy.FixedValue"); + TypeUtils.parseType("net.sf.cglib.proxy.FixedValue"); private static final Signature LOAD_OBJECT = TypeUtils.parseSignature("Object loadObject()"); diff --git a/fine-cglib/src/com/fr/third/net/sf/cglib/proxy/InterfaceMaker.java b/fine-cglib/src/com/fr/third/net/sf/cglib/proxy/InterfaceMaker.java index 41c185dab..8dcea280f 100644 --- a/fine-cglib/src/com/fr/third/net/sf/cglib/proxy/InterfaceMaker.java +++ b/fine-cglib/src/com/fr/third/net/sf/cglib/proxy/InterfaceMaker.java @@ -17,7 +17,13 @@ package com.fr.third.net.sf.cglib.proxy; import java.lang.reflect.*; import java.util.*; -import com.fr.third.net.sf.cglib.core.*; + +import com.fr.third.net.sf.cglib.core.AbstractClassGenerator; +import com.fr.third.net.sf.cglib.core.ClassEmitter; +import com.fr.third.net.sf.cglib.core.Constants; +import com.fr.third.net.sf.cglib.core.ReflectUtils; +import com.fr.third.net.sf.cglib.core.Signature; +import net.sf.cglib.core.*; import com.fr.third.org.objectweb.asm.ClassVisitor; import com.fr.third.org.objectweb.asm.Type; diff --git a/fine-cglib/src/com/fr/third/net/sf/cglib/proxy/InvocationHandlerGenerator.java b/fine-cglib/src/com/fr/third/net/sf/cglib/proxy/InvocationHandlerGenerator.java index 7b8b66aa4..c57bc24ed 100644 --- a/fine-cglib/src/com/fr/third/net/sf/cglib/proxy/InvocationHandlerGenerator.java +++ b/fine-cglib/src/com/fr/third/net/sf/cglib/proxy/InvocationHandlerGenerator.java @@ -15,7 +15,15 @@ */ package com.fr.third.net.sf.cglib.proxy; -import com.fr.third.net.sf.cglib.core.*; +import com.fr.third.net.sf.cglib.core.Block; +import com.fr.third.net.sf.cglib.core.ClassEmitter; +import com.fr.third.net.sf.cglib.core.CodeEmitter; +import com.fr.third.net.sf.cglib.core.Constants; +import com.fr.third.net.sf.cglib.core.EmitUtils; +import com.fr.third.net.sf.cglib.core.MethodInfo; +import com.fr.third.net.sf.cglib.core.Signature; +import com.fr.third.net.sf.cglib.core.TypeUtils; +import net.sf.cglib.core.*; import java.util.*; import com.fr.third.org.objectweb.asm.Type; @@ -25,9 +33,9 @@ implements CallbackGenerator public static final InvocationHandlerGenerator INSTANCE = new InvocationHandlerGenerator(); private static final Type INVOCATION_HANDLER = - TypeUtils.parseType("com.fr.third.net.sf.cglib.proxy.InvocationHandler"); + TypeUtils.parseType("net.sf.cglib.proxy.InvocationHandler"); private static final Type UNDECLARED_THROWABLE_EXCEPTION = - TypeUtils.parseType("com.fr.third.net.sf.cglib.proxy.UndeclaredThrowableException"); + TypeUtils.parseType("net.sf.cglib.proxy.UndeclaredThrowableException"); private static final Type METHOD = TypeUtils.parseType("java.lang.reflect.Method"); private static final Signature INVOKE = diff --git a/fine-cglib/src/com/fr/third/net/sf/cglib/proxy/LazyLoaderGenerator.java b/fine-cglib/src/com/fr/third/net/sf/cglib/proxy/LazyLoaderGenerator.java index 2900ab18b..1e0c7436a 100644 --- a/fine-cglib/src/com/fr/third/net/sf/cglib/proxy/LazyLoaderGenerator.java +++ b/fine-cglib/src/com/fr/third/net/sf/cglib/proxy/LazyLoaderGenerator.java @@ -16,17 +16,24 @@ package com.fr.third.net.sf.cglib.proxy; import java.util.*; -import com.fr.third.net.sf.cglib.core.*; + +import com.fr.third.net.sf.cglib.core.ClassEmitter; +import com.fr.third.net.sf.cglib.core.CodeEmitter; +import com.fr.third.net.sf.cglib.core.Constants; +import com.fr.third.net.sf.cglib.core.MethodInfo; +import com.fr.third.net.sf.cglib.core.Signature; +import com.fr.third.net.sf.cglib.core.TypeUtils; +import net.sf.cglib.core.*; import com.fr.third.org.objectweb.asm.Label; import com.fr.third.org.objectweb.asm.Type; class LazyLoaderGenerator implements CallbackGenerator { public static final LazyLoaderGenerator INSTANCE = new LazyLoaderGenerator(); - private static final Signature LOAD_OBJECT = + private static final Signature LOAD_OBJECT = TypeUtils.parseSignature("Object loadObject()"); private static final Type LAZY_LOADER = - TypeUtils.parseType("com.fr.third.net.sf.cglib.proxy.LazyLoader"); + TypeUtils.parseType("net.sf.cglib.proxy.LazyLoader"); public void generate(ClassEmitter ce, Context context, List methods) { Set indexes = new HashSet(); diff --git a/fine-cglib/src/com/fr/third/net/sf/cglib/proxy/MethodInterceptorGenerator.java b/fine-cglib/src/com/fr/third/net/sf/cglib/proxy/MethodInterceptorGenerator.java index 857605112..cf8e41424 100644 --- a/fine-cglib/src/com/fr/third/net/sf/cglib/proxy/MethodInterceptorGenerator.java +++ b/fine-cglib/src/com/fr/third/net/sf/cglib/proxy/MethodInterceptorGenerator.java @@ -15,9 +15,21 @@ */ package com.fr.third.net.sf.cglib.proxy; -import java.lang.reflect.Method; import java.util.*; -import com.fr.third.net.sf.cglib.core.*; + +import com.fr.third.net.sf.cglib.core.ClassEmitter; +import com.fr.third.net.sf.cglib.core.ClassInfo; +import com.fr.third.net.sf.cglib.core.CodeEmitter; +import com.fr.third.net.sf.cglib.core.CollectionUtils; +import com.fr.third.net.sf.cglib.core.Constants; +import com.fr.third.net.sf.cglib.core.EmitUtils; +import com.fr.third.net.sf.cglib.core.Local; +import com.fr.third.net.sf.cglib.core.MethodInfo; +import com.fr.third.net.sf.cglib.core.ObjectSwitchCallback; +import com.fr.third.net.sf.cglib.core.Signature; +import com.fr.third.net.sf.cglib.core.Transformer; +import com.fr.third.net.sf.cglib.core.TypeUtils; +import net.sf.cglib.core.*; import com.fr.third.org.objectweb.asm.Label; import com.fr.third.org.objectweb.asm.Type; @@ -35,11 +47,11 @@ implements CallbackGenerator private static final Type METHOD = TypeUtils.parseType("java.lang.reflect.Method"); private static final Type REFLECT_UTILS = - TypeUtils.parseType("com.fr.third.net.sf.cglib.core.ReflectUtils"); + TypeUtils.parseType("net.sf.cglib.core.ReflectUtils"); private static final Type METHOD_PROXY = - TypeUtils.parseType("com.fr.third.net.sf.cglib.proxy.MethodProxy"); + TypeUtils.parseType("net.sf.cglib.proxy.MethodProxy"); private static final Type METHOD_INTERCEPTOR = - TypeUtils.parseType("com.fr.third.net.sf.cglib.proxy.MethodInterceptor"); + TypeUtils.parseType("net.sf.cglib.proxy.MethodInterceptor"); private static final Signature GET_DECLARED_METHODS = TypeUtils.parseSignature("java.lang.reflect.Method[] getDeclaredMethods()"); private static final Signature GET_DECLARING_CLASS = diff --git a/fine-cglib/src/com/fr/third/net/sf/cglib/proxy/MethodProxy.java b/fine-cglib/src/com/fr/third/net/sf/cglib/proxy/MethodProxy.java index 002f2e654..936d6e779 100644 --- a/fine-cglib/src/com/fr/third/net/sf/cglib/proxy/MethodProxy.java +++ b/fine-cglib/src/com/fr/third/net/sf/cglib/proxy/MethodProxy.java @@ -18,6 +18,7 @@ package com.fr.third.net.sf.cglib.proxy; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; +import com.fr.third.net.sf.cglib.reflect.FastMethod; import com.fr.third.net.sf.cglib.core.AbstractClassGenerator; import com.fr.third.net.sf.cglib.core.CodeGenerationException; import com.fr.third.net.sf.cglib.core.GeneratorStrategy; @@ -41,7 +42,7 @@ public class MethodProxy { private volatile FastClassInfo fastClassInfo; /** - * For internal use by {@link Enhancer} only; see the {@link com.fr.third.net.sf.cglib.reflect.FastMethod} class + * For internal use by {@link Enhancer} only; see the {@link FastMethod} class * for similar functionality. */ public static MethodProxy create(Class c1, Class c2, String desc, String name1, String name2) { @@ -142,7 +143,7 @@ public class MethodProxy { } /** - * Return the {@link com.fr.third.net.sf.cglib.reflect.FastClass} method index + * Return the {@link FastClass} method index * for the method used by {@link #invokeSuper}. This index uniquely * identifies the method within the generated proxy, and therefore * can be useful to reference external metadata. diff --git a/fine-cglib/src/com/fr/third/net/sf/cglib/proxy/Mixin.java b/fine-cglib/src/com/fr/third/net/sf/cglib/proxy/Mixin.java index 07a3669df..146106db9 100644 --- a/fine-cglib/src/com/fr/third/net/sf/cglib/proxy/Mixin.java +++ b/fine-cglib/src/com/fr/third/net/sf/cglib/proxy/Mixin.java @@ -16,10 +16,13 @@ package com.fr.third.net.sf.cglib.proxy; import java.security.ProtectionDomain; -import java.lang.reflect.Constructor; -import java.lang.reflect.Modifier; import java.util.*; -import com.fr.third.net.sf.cglib.core.*; + +import com.fr.third.net.sf.cglib.core.AbstractClassGenerator; +import com.fr.third.net.sf.cglib.core.ClassesKey; +import com.fr.third.net.sf.cglib.core.KeyFactory; +import com.fr.third.net.sf.cglib.core.ReflectUtils; +import net.sf.cglib.core.*; import com.fr.third.org.objectweb.asm.ClassVisitor; @@ -34,7 +37,7 @@ import com.fr.third.org.objectweb.asm.ClassVisitor; */ abstract public class Mixin { private static final MixinKey KEY_FACTORY = - (MixinKey)KeyFactory.create(MixinKey.class, KeyFactory.CLASS_BY_NAME); + (MixinKey) KeyFactory.create(MixinKey.class, KeyFactory.CLASS_BY_NAME); private static final Map ROUTE_CACHE = Collections.synchronizedMap(new HashMap()); public static final int STYLE_INTERFACES = 0; diff --git a/fine-cglib/src/com/fr/third/net/sf/cglib/proxy/MixinEmitter.java b/fine-cglib/src/com/fr/third/net/sf/cglib/proxy/MixinEmitter.java index be262043c..565753bb3 100644 --- a/fine-cglib/src/com/fr/third/net/sf/cglib/proxy/MixinEmitter.java +++ b/fine-cglib/src/com/fr/third/net/sf/cglib/proxy/MixinEmitter.java @@ -17,7 +17,17 @@ package com.fr.third.net.sf.cglib.proxy; import java.lang.reflect.Method; import java.util.*; -import com.fr.third.net.sf.cglib.core.*; + +import com.fr.third.net.sf.cglib.core.ClassEmitter; +import com.fr.third.net.sf.cglib.core.CodeEmitter; +import com.fr.third.net.sf.cglib.core.Constants; +import com.fr.third.net.sf.cglib.core.EmitUtils; +import com.fr.third.net.sf.cglib.core.MethodInfo; +import com.fr.third.net.sf.cglib.core.MethodWrapper; +import com.fr.third.net.sf.cglib.core.ReflectUtils; +import com.fr.third.net.sf.cglib.core.Signature; +import com.fr.third.net.sf.cglib.core.TypeUtils; +import net.sf.cglib.core.*; import com.fr.third.org.objectweb.asm.ClassVisitor; import com.fr.third.org.objectweb.asm.Type; @@ -30,7 +40,7 @@ class MixinEmitter extends ClassEmitter { private static final Signature CSTRUCT_OBJECT_ARRAY = TypeUtils.parseConstructor("Object[]"); private static final Type MIXIN = - TypeUtils.parseType("com.fr.third.net.sf.cglib.proxy.Mixin"); + TypeUtils.parseType("net.sf.cglib.proxy.Mixin"); private static final Signature NEW_INSTANCE = new Signature("newInstance", MIXIN, new Type[]{ Constants.TYPE_OBJECT_ARRAY }); diff --git a/fine-cglib/src/com/fr/third/net/sf/cglib/proxy/NoOpGenerator.java b/fine-cglib/src/com/fr/third/net/sf/cglib/proxy/NoOpGenerator.java index 830e74df4..c3dc42f9b 100644 --- a/fine-cglib/src/com/fr/third/net/sf/cglib/proxy/NoOpGenerator.java +++ b/fine-cglib/src/com/fr/third/net/sf/cglib/proxy/NoOpGenerator.java @@ -17,7 +17,13 @@ package com.fr.third.net.sf.cglib.proxy; import java.util.Iterator; import java.util.List; -import com.fr.third.net.sf.cglib.core.*; + +import com.fr.third.net.sf.cglib.core.ClassEmitter; +import com.fr.third.net.sf.cglib.core.CodeEmitter; +import com.fr.third.net.sf.cglib.core.EmitUtils; +import com.fr.third.net.sf.cglib.core.MethodInfo; +import com.fr.third.net.sf.cglib.core.TypeUtils; +import net.sf.cglib.core.*; class NoOpGenerator implements CallbackGenerator diff --git a/fine-cglib/src/com/fr/third/net/sf/cglib/proxy/Proxy.java b/fine-cglib/src/com/fr/third/net/sf/cglib/proxy/Proxy.java index 68d156f2a..ff666c256 100644 --- a/fine-cglib/src/com/fr/third/net/sf/cglib/proxy/Proxy.java +++ b/fine-cglib/src/com/fr/third/net/sf/cglib/proxy/Proxy.java @@ -17,7 +17,7 @@ package com.fr.third.net.sf.cglib.proxy; import java.io.Serializable; import java.lang.reflect.Method; -import java.lang.reflect.Member; + import com.fr.third.net.sf.cglib.core.CodeGenerationException; /** diff --git a/fine-cglib/src/com/fr/third/net/sf/cglib/reflect/ConstructorDelegate.java b/fine-cglib/src/com/fr/third/net/sf/cglib/reflect/ConstructorDelegate.java index 64d3cef36..8e9180c16 100644 --- a/fine-cglib/src/com/fr/third/net/sf/cglib/reflect/ConstructorDelegate.java +++ b/fine-cglib/src/com/fr/third/net/sf/cglib/reflect/ConstructorDelegate.java @@ -17,7 +17,16 @@ package com.fr.third.net.sf.cglib.reflect; import java.lang.reflect.*; import java.security.ProtectionDomain; -import com.fr.third.net.sf.cglib.core.*; + +import com.fr.third.net.sf.cglib.core.AbstractClassGenerator; +import com.fr.third.net.sf.cglib.core.ClassEmitter; +import com.fr.third.net.sf.cglib.core.CodeEmitter; +import com.fr.third.net.sf.cglib.core.Constants; +import com.fr.third.net.sf.cglib.core.EmitUtils; +import com.fr.third.net.sf.cglib.core.KeyFactory; +import com.fr.third.net.sf.cglib.core.ReflectUtils; +import com.fr.third.net.sf.cglib.core.TypeUtils; +import net.sf.cglib.core.*; import com.fr.third.org.objectweb.asm.ClassVisitor; import com.fr.third.org.objectweb.asm.Type; @@ -27,7 +36,7 @@ import com.fr.third.org.objectweb.asm.Type; */ abstract public class ConstructorDelegate { private static final ConstructorKey KEY_FACTORY = - (ConstructorKey)KeyFactory.create(ConstructorKey.class, KeyFactory.CLASS_BY_NAME); + (ConstructorKey) KeyFactory.create(ConstructorKey.class, KeyFactory.CLASS_BY_NAME); interface ConstructorKey { public Object newInstance(String declaring, String iface); @@ -46,7 +55,7 @@ abstract public class ConstructorDelegate { public static class Generator extends AbstractClassGenerator { private static final Source SOURCE = new Source(ConstructorDelegate.class.getName()); private static final Type CONSTRUCTOR_DELEGATE = - TypeUtils.parseType("com.fr.third.net.sf.cglib.reflect.ConstructorDelegate"); + TypeUtils.parseType("net.sf.cglib.reflect.ConstructorDelegate"); private Class iface; private Class targetClass; diff --git a/fine-cglib/src/com/fr/third/net/sf/cglib/reflect/FastClass.java b/fine-cglib/src/com/fr/third/net/sf/cglib/reflect/FastClass.java index afa83ba17..180e5ae96 100644 --- a/fine-cglib/src/com/fr/third/net/sf/cglib/reflect/FastClass.java +++ b/fine-cglib/src/com/fr/third/net/sf/cglib/reflect/FastClass.java @@ -15,7 +15,11 @@ */ package com.fr.third.net.sf.cglib.reflect; -import com.fr.third.net.sf.cglib.core.*; +import com.fr.third.net.sf.cglib.core.AbstractClassGenerator; +import com.fr.third.net.sf.cglib.core.Constants; +import com.fr.third.net.sf.cglib.core.ReflectUtils; +import com.fr.third.net.sf.cglib.core.Signature; +import net.sf.cglib.core.*; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; diff --git a/fine-cglib/src/com/fr/third/net/sf/cglib/reflect/FastClassEmitter.java b/fine-cglib/src/com/fr/third/net/sf/cglib/reflect/FastClassEmitter.java index 022e27959..2e09b39cf 100644 --- a/fine-cglib/src/com/fr/third/net/sf/cglib/reflect/FastClassEmitter.java +++ b/fine-cglib/src/com/fr/third/net/sf/cglib/reflect/FastClassEmitter.java @@ -17,7 +17,24 @@ package com.fr.third.net.sf.cglib.reflect; import java.lang.reflect.*; import java.util.*; -import com.fr.third.net.sf.cglib.core.*; + +import com.fr.third.net.sf.cglib.core.Block; +import com.fr.third.net.sf.cglib.core.ClassEmitter; +import com.fr.third.net.sf.cglib.core.CodeEmitter; +import com.fr.third.net.sf.cglib.core.CollectionUtils; +import com.fr.third.net.sf.cglib.core.Constants; +import com.fr.third.net.sf.cglib.core.DuplicatesPredicate; +import com.fr.third.net.sf.cglib.core.EmitUtils; +import com.fr.third.net.sf.cglib.core.MethodInfo; +import com.fr.third.net.sf.cglib.core.MethodInfoTransformer; +import com.fr.third.net.sf.cglib.core.ObjectSwitchCallback; +import com.fr.third.net.sf.cglib.core.ProcessSwitchCallback; +import com.fr.third.net.sf.cglib.core.ReflectUtils; +import com.fr.third.net.sf.cglib.core.Signature; +import com.fr.third.net.sf.cglib.core.Transformer; +import com.fr.third.net.sf.cglib.core.TypeUtils; +import com.fr.third.net.sf.cglib.core.VisibilityPredicate; +import net.sf.cglib.core.*; import com.fr.third.org.objectweb.asm.ClassVisitor; import com.fr.third.org.objectweb.asm.Label; import com.fr.third.org.objectweb.asm.Type; @@ -42,7 +59,7 @@ class FastClassEmitter extends ClassEmitter { private static final Signature GET_SIGNATURE_WITHOUT_RETURN_TYPE = TypeUtils.parseSignature("String getSignatureWithoutReturnType(String, Class[])"); private static final Type FAST_CLASS = - TypeUtils.parseType("com.fr.third.net.sf.cglib.reflect.FastClass"); + TypeUtils.parseType("net.sf.cglib.reflect.FastClass"); private static final Type ILLEGAL_ARGUMENT_EXCEPTION = TypeUtils.parseType("IllegalArgumentException"); private static final Type INVOCATION_TARGET_EXCEPTION = diff --git a/fine-cglib/src/com/fr/third/net/sf/cglib/reflect/MethodDelegate.java b/fine-cglib/src/com/fr/third/net/sf/cglib/reflect/MethodDelegate.java index ae9070c0c..92790bdae 100644 --- a/fine-cglib/src/com/fr/third/net/sf/cglib/reflect/MethodDelegate.java +++ b/fine-cglib/src/com/fr/third/net/sf/cglib/reflect/MethodDelegate.java @@ -17,8 +17,19 @@ package com.fr.third.net.sf.cglib.reflect; import java.lang.reflect.*; import java.security.ProtectionDomain; -import com.fr.third.net.sf.cglib.*; -import com.fr.third.net.sf.cglib.core.*; + +import com.fr.third.net.sf.cglib.core.AbstractClassGenerator; +import com.fr.third.net.sf.cglib.core.ClassEmitter; +import com.fr.third.net.sf.cglib.core.CodeEmitter; +import com.fr.third.net.sf.cglib.core.Constants; +import com.fr.third.net.sf.cglib.core.EmitUtils; +import com.fr.third.net.sf.cglib.core.KeyFactory; +import com.fr.third.net.sf.cglib.core.MethodInfo; +import com.fr.third.net.sf.cglib.core.ReflectUtils; +import com.fr.third.net.sf.cglib.core.Signature; +import com.fr.third.net.sf.cglib.core.TypeUtils; +import net.sf.cglib.*; +import net.sf.cglib.core.*; import com.fr.third.org.objectweb.asm.ClassVisitor; import com.fr.third.org.objectweb.asm.Type; @@ -107,7 +118,7 @@ import com.fr.third.org.objectweb.asm.Type; */ abstract public class MethodDelegate { private static final MethodDelegateKey KEY_FACTORY = - (MethodDelegateKey)KeyFactory.create(MethodDelegateKey.class, KeyFactory.CLASS_BY_NAME); + (MethodDelegateKey) KeyFactory.create(MethodDelegateKey.class, KeyFactory.CLASS_BY_NAME); protected Object target; protected String eqMethod; @@ -150,7 +161,7 @@ abstract public class MethodDelegate { public static class Generator extends AbstractClassGenerator { private static final Source SOURCE = new Source(MethodDelegate.class.getName()); private static final Type METHOD_DELEGATE = - TypeUtils.parseType("com.fr.third.net.sf.cglib.reflect.MethodDelegate"); + TypeUtils.parseType("net.sf.cglib.reflect.MethodDelegate"); private static final Signature NEW_INSTANCE = new Signature("newInstance", METHOD_DELEGATE, new Type[]{ Constants.TYPE_OBJECT }); diff --git a/fine-cglib/src/com/fr/third/net/sf/cglib/reflect/MulticastDelegate.java b/fine-cglib/src/com/fr/third/net/sf/cglib/reflect/MulticastDelegate.java index ca80a2648..0c48ff20f 100644 --- a/fine-cglib/src/com/fr/third/net/sf/cglib/reflect/MulticastDelegate.java +++ b/fine-cglib/src/com/fr/third/net/sf/cglib/reflect/MulticastDelegate.java @@ -15,12 +15,22 @@ */ package com.fr.third.net.sf.cglib.reflect; -import java.lang.reflect.*; import java.security.ProtectionDomain; import java.util.*; -import com.fr.third.net.sf.cglib.core.*; + +import com.fr.third.net.sf.cglib.core.AbstractClassGenerator; +import com.fr.third.net.sf.cglib.core.ClassEmitter; +import com.fr.third.net.sf.cglib.core.CodeEmitter; +import com.fr.third.net.sf.cglib.core.Constants; +import com.fr.third.net.sf.cglib.core.EmitUtils; +import com.fr.third.net.sf.cglib.core.Local; +import com.fr.third.net.sf.cglib.core.MethodInfo; +import com.fr.third.net.sf.cglib.core.ProcessArrayCallback; +import com.fr.third.net.sf.cglib.core.ReflectUtils; +import com.fr.third.net.sf.cglib.core.Signature; +import com.fr.third.net.sf.cglib.core.TypeUtils; +import net.sf.cglib.core.*; import com.fr.third.org.objectweb.asm.ClassVisitor; -import com.fr.third.org.objectweb.asm.MethodVisitor; import com.fr.third.org.objectweb.asm.Type; abstract public class MulticastDelegate implements Cloneable { @@ -67,7 +77,7 @@ abstract public class MulticastDelegate implements Cloneable { public static class Generator extends AbstractClassGenerator { private static final Source SOURCE = new Source(MulticastDelegate.class.getName()); private static final Type MULTICAST_DELEGATE = - TypeUtils.parseType("com.fr.third.net.sf.cglib.reflect.MulticastDelegate"); + TypeUtils.parseType("net.sf.cglib.reflect.MulticastDelegate"); private static final Signature NEW_INSTANCE = new Signature("newInstance", MULTICAST_DELEGATE, new Type[0]); private static final Signature ADD_DELEGATE = diff --git a/fine-cglib/src/com/fr/third/net/sf/cglib/transform/AbstractClassTransformer.java b/fine-cglib/src/com/fr/third/net/sf/cglib/transform/AbstractClassTransformer.java index 94e61cf71..df4f79768 100644 --- a/fine-cglib/src/com/fr/third/net/sf/cglib/transform/AbstractClassTransformer.java +++ b/fine-cglib/src/com/fr/third/net/sf/cglib/transform/AbstractClassTransformer.java @@ -15,12 +15,12 @@ */ package com.fr.third.net.sf.cglib.transform; +import com.fr.third.net.sf.cglib.core.Constants; import com.fr.third.org.objectweb.asm.ClassVisitor; -import com.fr.third.org.objectweb.asm.Opcodes; abstract public class AbstractClassTransformer extends ClassTransformer { protected AbstractClassTransformer() { - super(Opcodes.ASM6); + super(Constants.ASM_API); } public void setTarget(ClassVisitor target) { diff --git a/fine-cglib/src/com/fr/third/net/sf/cglib/transform/AnnotationVisitorTee.java b/fine-cglib/src/com/fr/third/net/sf/cglib/transform/AnnotationVisitorTee.java index dac8b57f2..1cf536ae9 100644 --- a/fine-cglib/src/com/fr/third/net/sf/cglib/transform/AnnotationVisitorTee.java +++ b/fine-cglib/src/com/fr/third/net/sf/cglib/transform/AnnotationVisitorTee.java @@ -15,8 +15,8 @@ */ package com.fr.third.net.sf.cglib.transform; +import com.fr.third.net.sf.cglib.core.Constants; import com.fr.third.org.objectweb.asm.AnnotationVisitor; -import com.fr.third.org.objectweb.asm.Opcodes; public class AnnotationVisitorTee extends AnnotationVisitor { private AnnotationVisitor av1, av2; @@ -30,7 +30,7 @@ public class AnnotationVisitorTee extends AnnotationVisitor { } public AnnotationVisitorTee(AnnotationVisitor av1, AnnotationVisitor av2) { - super(Opcodes.ASM6); + super(Constants.ASM_API); this.av1 = av1; this.av2 = av2; } diff --git a/fine-cglib/src/com/fr/third/net/sf/cglib/transform/ClassFilterTransformer.java b/fine-cglib/src/com/fr/third/net/sf/cglib/transform/ClassFilterTransformer.java index 23932b9e9..7b7d178a4 100644 --- a/fine-cglib/src/com/fr/third/net/sf/cglib/transform/ClassFilterTransformer.java +++ b/fine-cglib/src/com/fr/third/net/sf/cglib/transform/ClassFilterTransformer.java @@ -15,8 +15,6 @@ */ package com.fr.third.net.sf.cglib.transform; -import com.fr.third.org.objectweb.asm.*; - public class ClassFilterTransformer extends AbstractClassFilterTransformer { private ClassFilter filter; diff --git a/fine-cglib/src/com/fr/third/net/sf/cglib/transform/ClassTransformer.java b/fine-cglib/src/com/fr/third/net/sf/cglib/transform/ClassTransformer.java index 95d41e7bd..039828a93 100644 --- a/fine-cglib/src/com/fr/third/net/sf/cglib/transform/ClassTransformer.java +++ b/fine-cglib/src/com/fr/third/net/sf/cglib/transform/ClassTransformer.java @@ -15,12 +15,12 @@ */ package com.fr.third.net.sf.cglib.transform; +import com.fr.third.net.sf.cglib.core.Constants; import com.fr.third.org.objectweb.asm.ClassVisitor; -import com.fr.third.org.objectweb.asm.Opcodes; public abstract class ClassTransformer extends ClassVisitor { public ClassTransformer() { - super(Opcodes.ASM6); + super(Constants.ASM_API); } public ClassTransformer(int opcode) { super(opcode); diff --git a/fine-cglib/src/com/fr/third/net/sf/cglib/transform/ClassTransformerTee.java b/fine-cglib/src/com/fr/third/net/sf/cglib/transform/ClassTransformerTee.java index 44088b969..80d910c99 100644 --- a/fine-cglib/src/com/fr/third/net/sf/cglib/transform/ClassTransformerTee.java +++ b/fine-cglib/src/com/fr/third/net/sf/cglib/transform/ClassTransformerTee.java @@ -15,14 +15,14 @@ */ package com.fr.third.net.sf.cglib.transform; +import com.fr.third.net.sf.cglib.core.Constants; import com.fr.third.org.objectweb.asm.ClassVisitor; -import com.fr.third.org.objectweb.asm.Opcodes; public class ClassTransformerTee extends ClassTransformer { private ClassVisitor branch; public ClassTransformerTee(ClassVisitor branch) { - super(Opcodes.ASM6); + super(Constants.ASM_API); this.branch = branch; } diff --git a/fine-cglib/src/com/fr/third/net/sf/cglib/transform/ClassVisitorTee.java b/fine-cglib/src/com/fr/third/net/sf/cglib/transform/ClassVisitorTee.java index 58ad46684..5d8a110af 100644 --- a/fine-cglib/src/com/fr/third/net/sf/cglib/transform/ClassVisitorTee.java +++ b/fine-cglib/src/com/fr/third/net/sf/cglib/transform/ClassVisitorTee.java @@ -15,13 +15,14 @@ */ package com.fr.third.net.sf.cglib.transform; +import com.fr.third.net.sf.cglib.core.Constants; import com.fr.third.org.objectweb.asm.*; public class ClassVisitorTee extends ClassVisitor { private ClassVisitor cv1, cv2; public ClassVisitorTee(ClassVisitor cv1, ClassVisitor cv2) { - super(Opcodes.ASM6); + super(Constants.ASM_API); this.cv1 = cv1; this.cv2 = cv2; } diff --git a/fine-cglib/src/com/fr/third/net/sf/cglib/transform/FieldVisitorTee.java b/fine-cglib/src/com/fr/third/net/sf/cglib/transform/FieldVisitorTee.java index 526d93ab9..7fe31316c 100644 --- a/fine-cglib/src/com/fr/third/net/sf/cglib/transform/FieldVisitorTee.java +++ b/fine-cglib/src/com/fr/third/net/sf/cglib/transform/FieldVisitorTee.java @@ -15,17 +15,17 @@ */ package com.fr.third.net.sf.cglib.transform; +import com.fr.third.net.sf.cglib.core.Constants; import com.fr.third.org.objectweb.asm.AnnotationVisitor; import com.fr.third.org.objectweb.asm.Attribute; import com.fr.third.org.objectweb.asm.FieldVisitor; -import com.fr.third.org.objectweb.asm.Opcodes; import com.fr.third.org.objectweb.asm.TypePath; public class FieldVisitorTee extends FieldVisitor { private FieldVisitor fv1, fv2; public FieldVisitorTee(FieldVisitor fv1, FieldVisitor fv2) { - super(Opcodes.ASM6); + super(Constants.ASM_API); this.fv1 = fv1; this.fv2 = fv2; } diff --git a/fine-cglib/src/com/fr/third/net/sf/cglib/transform/MethodVisitorTee.java b/fine-cglib/src/com/fr/third/net/sf/cglib/transform/MethodVisitorTee.java index bea2a3197..cbde6d8b1 100644 --- a/fine-cglib/src/com/fr/third/net/sf/cglib/transform/MethodVisitorTee.java +++ b/fine-cglib/src/com/fr/third/net/sf/cglib/transform/MethodVisitorTee.java @@ -15,6 +15,7 @@ */ package com.fr.third.net.sf.cglib.transform; +import com.fr.third.net.sf.cglib.core.Constants; import com.fr.third.org.objectweb.asm.*; public class MethodVisitorTee extends MethodVisitor { @@ -22,7 +23,7 @@ public class MethodVisitorTee extends MethodVisitor { private final MethodVisitor mv2; public MethodVisitorTee(MethodVisitor mv1, MethodVisitor mv2) { - super(Opcodes.ASM6); + super(Constants.ASM_API); this.mv1 = mv1; this.mv2 = mv2; } diff --git a/fine-cglib/src/com/fr/third/net/sf/cglib/transform/TransformingClassGenerator.java b/fine-cglib/src/com/fr/third/net/sf/cglib/transform/TransformingClassGenerator.java index 84fb715a4..7c9c3ec14 100644 --- a/fine-cglib/src/com/fr/third/net/sf/cglib/transform/TransformingClassGenerator.java +++ b/fine-cglib/src/com/fr/third/net/sf/cglib/transform/TransformingClassGenerator.java @@ -16,7 +16,6 @@ package com.fr.third.net.sf.cglib.transform; import com.fr.third.net.sf.cglib.core.ClassGenerator; -import com.fr.third.net.sf.cglib.core.Transformer; import com.fr.third.org.objectweb.asm.ClassVisitor; public class TransformingClassGenerator implements ClassGenerator { diff --git a/fine-cglib/src/com/fr/third/net/sf/cglib/transform/TransformingClassLoader.java b/fine-cglib/src/com/fr/third/net/sf/cglib/transform/TransformingClassLoader.java index c26681a23..e6002c672 100644 --- a/fine-cglib/src/com/fr/third/net/sf/cglib/transform/TransformingClassLoader.java +++ b/fine-cglib/src/com/fr/third/net/sf/cglib/transform/TransformingClassLoader.java @@ -15,7 +15,6 @@ */ package com.fr.third.net.sf.cglib.transform; -import java.util.*; import com.fr.third.net.sf.cglib.core.ClassGenerator; import com.fr.third.org.objectweb.asm.*; diff --git a/fine-cglib/src/com/fr/third/net/sf/cglib/transform/impl/AccessFieldTransformer.java b/fine-cglib/src/com/fr/third/net/sf/cglib/transform/impl/AccessFieldTransformer.java index 957bca066..af2ab3e5f 100644 --- a/fine-cglib/src/com/fr/third/net/sf/cglib/transform/impl/AccessFieldTransformer.java +++ b/fine-cglib/src/com/fr/third/net/sf/cglib/transform/impl/AccessFieldTransformer.java @@ -15,11 +15,13 @@ */ package com.fr.third.net.sf.cglib.transform.impl; -import com.fr.third.net.sf.cglib.transform.*; -import com.fr.third.net.sf.cglib.core.*; -import com.fr.third.org.objectweb.asm.ClassVisitor; -import com.fr.third.org.objectweb.asm.MethodVisitor; -import com.fr.third.org.objectweb.asm.Attribute; +import com.fr.third.net.sf.cglib.core.CodeEmitter; +import com.fr.third.net.sf.cglib.core.Constants; +import com.fr.third.net.sf.cglib.core.Signature; +import com.fr.third.net.sf.cglib.core.TypeUtils; +import com.fr.third.net.sf.cglib.transform.ClassEmitterTransformer; +import net.sf.cglib.transform.*; +import net.sf.cglib.core.*; import com.fr.third.org.objectweb.asm.Type; public class AccessFieldTransformer extends ClassEmitterTransformer { diff --git a/fine-cglib/src/com/fr/third/net/sf/cglib/transform/impl/AddDelegateTransformer.java b/fine-cglib/src/com/fr/third/net/sf/cglib/transform/impl/AddDelegateTransformer.java index 3234966ed..442982ab5 100644 --- a/fine-cglib/src/com/fr/third/net/sf/cglib/transform/impl/AddDelegateTransformer.java +++ b/fine-cglib/src/com/fr/third/net/sf/cglib/transform/impl/AddDelegateTransformer.java @@ -15,11 +15,17 @@ */ package com.fr.third.net.sf.cglib.transform.impl; -import com.fr.third.net.sf.cglib.transform.*; +import com.fr.third.net.sf.cglib.core.CodeEmitter; +import com.fr.third.net.sf.cglib.core.CodeGenerationException; +import com.fr.third.net.sf.cglib.core.Constants; +import com.fr.third.net.sf.cglib.core.ReflectUtils; +import com.fr.third.net.sf.cglib.core.Signature; +import com.fr.third.net.sf.cglib.core.TypeUtils; +import com.fr.third.net.sf.cglib.transform.ClassEmitterTransformer; +import net.sf.cglib.transform.*; import java.lang.reflect.*; -import java.util.*; -import com.fr.third.net.sf.cglib.core.*; -import com.fr.third.org.objectweb.asm.Attribute; + +import net.sf.cglib.core.*; import com.fr.third.org.objectweb.asm.Type; /** diff --git a/fine-cglib/src/com/fr/third/net/sf/cglib/transform/impl/AddInitTransformer.java b/fine-cglib/src/com/fr/third/net/sf/cglib/transform/impl/AddInitTransformer.java index 6708f2bbb..4359f849b 100644 --- a/fine-cglib/src/com/fr/third/net/sf/cglib/transform/impl/AddInitTransformer.java +++ b/fine-cglib/src/com/fr/third/net/sf/cglib/transform/impl/AddInitTransformer.java @@ -24,7 +24,6 @@ import com.fr.third.net.sf.cglib.core.ReflectUtils; import com.fr.third.net.sf.cglib.core.Signature; import com.fr.third.net.sf.cglib.transform.ClassEmitterTransformer; -import com.fr.third.org.objectweb.asm.Attribute; import com.fr.third.org.objectweb.asm.Type; /** diff --git a/fine-cglib/src/com/fr/third/net/sf/cglib/transform/impl/AddPropertyTransformer.java b/fine-cglib/src/com/fr/third/net/sf/cglib/transform/impl/AddPropertyTransformer.java index 5d9553526..4475f872d 100644 --- a/fine-cglib/src/com/fr/third/net/sf/cglib/transform/impl/AddPropertyTransformer.java +++ b/fine-cglib/src/com/fr/third/net/sf/cglib/transform/impl/AddPropertyTransformer.java @@ -15,9 +15,12 @@ */ package com.fr.third.net.sf.cglib.transform.impl; -import com.fr.third.net.sf.cglib.transform.*; +import com.fr.third.net.sf.cglib.core.EmitUtils; +import com.fr.third.net.sf.cglib.core.TypeUtils; +import com.fr.third.net.sf.cglib.transform.ClassEmitterTransformer; +import net.sf.cglib.transform.*; import java.util.*; -import com.fr.third.net.sf.cglib.core.*; +import net.sf.cglib.core.*; import com.fr.third.org.objectweb.asm.Type; public class AddPropertyTransformer extends ClassEmitterTransformer { diff --git a/fine-cglib/src/com/fr/third/net/sf/cglib/transform/impl/AddStaticInitTransformer.java b/fine-cglib/src/com/fr/third/net/sf/cglib/transform/impl/AddStaticInitTransformer.java index dc3c36560..f0e1a7d18 100644 --- a/fine-cglib/src/com/fr/third/net/sf/cglib/transform/impl/AddStaticInitTransformer.java +++ b/fine-cglib/src/com/fr/third/net/sf/cglib/transform/impl/AddStaticInitTransformer.java @@ -16,8 +16,16 @@ package com.fr.third.net.sf.cglib.transform.impl; import java.lang.reflect.Method; -import com.fr.third.net.sf.cglib.core.*; -import com.fr.third.net.sf.cglib.transform.*; + +import com.fr.third.net.sf.cglib.core.CodeEmitter; +import com.fr.third.net.sf.cglib.core.Constants; +import com.fr.third.net.sf.cglib.core.EmitUtils; +import com.fr.third.net.sf.cglib.core.MethodInfo; +import com.fr.third.net.sf.cglib.core.ReflectUtils; +import com.fr.third.net.sf.cglib.core.TypeUtils; +import com.fr.third.net.sf.cglib.transform.ClassEmitterTransformer; +import net.sf.cglib.core.*; +import net.sf.cglib.transform.*; import com.fr.third.org.objectweb.asm.Type; /** diff --git a/fine-cglib/src/com/fr/third/net/sf/cglib/transform/impl/FieldProviderTransformer.java b/fine-cglib/src/com/fr/third/net/sf/cglib/transform/impl/FieldProviderTransformer.java index 5778f3db5..05305f29a 100644 --- a/fine-cglib/src/com/fr/third/net/sf/cglib/transform/impl/FieldProviderTransformer.java +++ b/fine-cglib/src/com/fr/third/net/sf/cglib/transform/impl/FieldProviderTransformer.java @@ -15,10 +15,18 @@ */ package com.fr.third.net.sf.cglib.transform.impl; -import com.fr.third.net.sf.cglib.transform.*; +import com.fr.third.net.sf.cglib.core.CodeEmitter; +import com.fr.third.net.sf.cglib.core.CodeGenerationException; +import com.fr.third.net.sf.cglib.core.Constants; +import com.fr.third.net.sf.cglib.core.EmitUtils; +import com.fr.third.net.sf.cglib.core.ObjectSwitchCallback; +import com.fr.third.net.sf.cglib.core.ProcessSwitchCallback; +import com.fr.third.net.sf.cglib.core.Signature; +import com.fr.third.net.sf.cglib.core.TypeUtils; +import com.fr.third.net.sf.cglib.transform.ClassEmitterTransformer; +import net.sf.cglib.transform.*; import java.util.*; -import com.fr.third.net.sf.cglib.core.*; -import com.fr.third.org.objectweb.asm.Attribute; +import net.sf.cglib.core.*; import com.fr.third.org.objectweb.asm.Label; import com.fr.third.org.objectweb.asm.Type; @@ -28,7 +36,7 @@ public class FieldProviderTransformer extends ClassEmitterTransformer { private static final String FIELD_TYPES = "CGLIB$FIELD_TYPES"; private static final Type FIELD_PROVIDER = - TypeUtils.parseType("com.fr.third.net.sf.cglib.transform.impl.FieldProvider"); + TypeUtils.parseType("net.sf.cglib.transform.impl.FieldProvider"); private static final Type ILLEGAL_ARGUMENT_EXCEPTION = TypeUtils.parseType("IllegalArgumentException"); private static final Signature PROVIDER_GET = diff --git a/fine-cglib/src/com/fr/third/net/sf/cglib/transform/impl/InterceptFieldTransformer.java b/fine-cglib/src/com/fr/third/net/sf/cglib/transform/impl/InterceptFieldTransformer.java index 29111ce9f..6161d4f35 100644 --- a/fine-cglib/src/com/fr/third/net/sf/cglib/transform/impl/InterceptFieldTransformer.java +++ b/fine-cglib/src/com/fr/third/net/sf/cglib/transform/impl/InterceptFieldTransformer.java @@ -15,8 +15,14 @@ */ package com.fr.third.net.sf.cglib.transform.impl; -import com.fr.third.net.sf.cglib.transform.*; -import com.fr.third.net.sf.cglib.core.*; +import com.fr.third.net.sf.cglib.core.CodeEmitter; +import com.fr.third.net.sf.cglib.core.Constants; +import com.fr.third.net.sf.cglib.core.Local; +import com.fr.third.net.sf.cglib.core.Signature; +import com.fr.third.net.sf.cglib.core.TypeUtils; +import com.fr.third.net.sf.cglib.transform.ClassEmitterTransformer; +import net.sf.cglib.transform.*; +import net.sf.cglib.core.*; import com.fr.third.org.objectweb.asm.Label; import com.fr.third.org.objectweb.asm.Type; @@ -26,9 +32,9 @@ import com.fr.third.org.objectweb.asm.Type; public class InterceptFieldTransformer extends ClassEmitterTransformer { private static final String CALLBACK_FIELD = "$CGLIB_READ_WRITE_CALLBACK"; private static final Type CALLBACK = - TypeUtils.parseType("com.fr.third.net.sf.cglib.transform.impl.InterceptFieldCallback"); + TypeUtils.parseType("net.sf.cglib.transform.impl.InterceptFieldCallback"); private static final Type ENABLED = - TypeUtils.parseType("com.fr.third.net.sf.cglib.transform.impl.InterceptFieldEnabled"); + TypeUtils.parseType("net.sf.cglib.transform.impl.InterceptFieldEnabled"); private static final Signature ENABLED_SET = new Signature("setInterceptFieldCallback", Type.VOID_TYPE, new Type[]{ CALLBACK }); private static final Signature ENABLED_GET = diff --git a/fine-cglib/src/com/fr/third/net/sf/cglib/transform/impl/UndeclaredThrowableStrategy.java b/fine-cglib/src/com/fr/third/net/sf/cglib/transform/impl/UndeclaredThrowableStrategy.java index 61213f683..dfb5ba899 100644 --- a/fine-cglib/src/com/fr/third/net/sf/cglib/transform/impl/UndeclaredThrowableStrategy.java +++ b/fine-cglib/src/com/fr/third/net/sf/cglib/transform/impl/UndeclaredThrowableStrategy.java @@ -15,17 +15,17 @@ */ package com.fr.third.net.sf.cglib.transform.impl; +import com.fr.third.net.sf.cglib.transform.ClassTransformer; +import com.fr.third.net.sf.cglib.transform.MethodFilter; +import com.fr.third.net.sf.cglib.transform.TransformingClassGenerator; import com.fr.third.net.sf.cglib.core.ClassGenerator; import com.fr.third.net.sf.cglib.core.DefaultGeneratorStrategy; import com.fr.third.net.sf.cglib.core.GeneratorStrategy; import com.fr.third.net.sf.cglib.core.TypeUtils; -import com.fr.third.net.sf.cglib.transform.ClassTransformer; -import com.fr.third.net.sf.cglib.transform.MethodFilter; import com.fr.third.net.sf.cglib.transform.MethodFilterTransformer; -import com.fr.third.net.sf.cglib.transform.TransformingClassGenerator; /** - * A {@link GeneratorStrategy} suitable for use with {@link com.fr.third.net.sf.cglib.Enhancer} which + * A {@link GeneratorStrategy} suitable for use with {@link net.sf.cglib.Enhancer} which * causes all undeclared exceptions thrown from within a proxied method to be wrapped * in an alternative exception of your choice. */ @@ -53,7 +53,7 @@ public class UndeclaredThrowableStrategy extends DefaultGeneratorStrategy { }; protected ClassGenerator transform(ClassGenerator cg) throws Exception { - ClassTransformer tr = new UndeclaredThrowableTransformer(wrapper); + ClassTransformer tr = new UndeclaredThrowableTransformer(wrapper); tr = new MethodFilterTransformer(TRANSFORM_FILTER, tr); return new TransformingClassGenerator(cg, tr); } diff --git a/fine-cglib/src/com/fr/third/net/sf/cglib/transform/impl/UndeclaredThrowableTransformer.java b/fine-cglib/src/com/fr/third/net/sf/cglib/transform/impl/UndeclaredThrowableTransformer.java index 619fab259..3dadce269 100644 --- a/fine-cglib/src/com/fr/third/net/sf/cglib/transform/impl/UndeclaredThrowableTransformer.java +++ b/fine-cglib/src/com/fr/third/net/sf/cglib/transform/impl/UndeclaredThrowableTransformer.java @@ -16,11 +16,17 @@ package com.fr.third.net.sf.cglib.transform.impl; import java.lang.reflect.Constructor; -import com.fr.third.net.sf.cglib.core.*; -import com.fr.third.net.sf.cglib.transform.*; -import com.fr.third.org.objectweb.asm.Attribute; + +import com.fr.third.net.sf.cglib.core.Block; +import com.fr.third.net.sf.cglib.core.CodeEmitter; +import com.fr.third.net.sf.cglib.core.Constants; +import com.fr.third.net.sf.cglib.core.EmitUtils; +import com.fr.third.net.sf.cglib.core.Signature; +import com.fr.third.net.sf.cglib.core.TypeUtils; +import com.fr.third.net.sf.cglib.transform.ClassEmitterTransformer; +import net.sf.cglib.core.*; +import net.sf.cglib.transform.*; import com.fr.third.org.objectweb.asm.Type; -import com.fr.third.org.objectweb.asm.ClassVisitor; public class UndeclaredThrowableTransformer extends ClassEmitterTransformer { private Type wrapper; diff --git a/fine-cglib/src/com/fr/third/net/sf/cglib/util/ParallelSorter.java b/fine-cglib/src/com/fr/third/net/sf/cglib/util/ParallelSorter.java index e7bd121b7..28af9f1b0 100644 --- a/fine-cglib/src/com/fr/third/net/sf/cglib/util/ParallelSorter.java +++ b/fine-cglib/src/com/fr/third/net/sf/cglib/util/ParallelSorter.java @@ -15,9 +15,12 @@ */ package com.fr.third.net.sf.cglib.util; -import java.lang.reflect.*; import java.util.Comparator; -import com.fr.third.net.sf.cglib.core.*; + +import com.fr.third.net.sf.cglib.core.AbstractClassGenerator; +import com.fr.third.net.sf.cglib.core.ClassesKey; +import com.fr.third.net.sf.cglib.core.ReflectUtils; +import net.sf.cglib.core.*; import com.fr.third.org.objectweb.asm.ClassVisitor; /** @@ -284,7 +287,7 @@ abstract public class ParallelSorter extends SorterTemplate { } protected Object firstInstance(Class type) { - return ((ParallelSorter)ReflectUtils.newInstance(type)).newInstance(arrays); + return ((ParallelSorter) ReflectUtils.newInstance(type)).newInstance(arrays); } protected Object nextInstance(Object instance) { diff --git a/fine-cglib/src/com/fr/third/net/sf/cglib/util/ParallelSorterEmitter.java b/fine-cglib/src/com/fr/third/net/sf/cglib/util/ParallelSorterEmitter.java index eefb63013..d183100bc 100644 --- a/fine-cglib/src/com/fr/third/net/sf/cglib/util/ParallelSorterEmitter.java +++ b/fine-cglib/src/com/fr/third/net/sf/cglib/util/ParallelSorterEmitter.java @@ -15,15 +15,20 @@ */ package com.fr.third.net.sf.cglib.util; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; -import com.fr.third.net.sf.cglib.core.*; +import com.fr.third.net.sf.cglib.core.ClassEmitter; +import com.fr.third.net.sf.cglib.core.CodeEmitter; +import com.fr.third.net.sf.cglib.core.Constants; +import com.fr.third.net.sf.cglib.core.EmitUtils; +import com.fr.third.net.sf.cglib.core.Local; +import com.fr.third.net.sf.cglib.core.Signature; +import com.fr.third.net.sf.cglib.core.TypeUtils; +import net.sf.cglib.core.*; import com.fr.third.org.objectweb.asm.ClassVisitor; import com.fr.third.org.objectweb.asm.Type; class ParallelSorterEmitter extends ClassEmitter { private static final Type PARALLEL_SORTER = - TypeUtils.parseType("com.fr.third.net.sf.cglib.util.ParallelSorter"); + TypeUtils.parseType("net.sf.cglib.util.ParallelSorter"); private static final Signature CSTRUCT_OBJECT_ARRAY = TypeUtils.parseConstructor("Object[]"); private static final Signature NEW_INSTANCE = diff --git a/fine-cglib/src/com/fr/third/net/sf/cglib/util/StringSwitcher.java b/fine-cglib/src/com/fr/third/net/sf/cglib/util/StringSwitcher.java index 126b76e31..be9383df4 100644 --- a/fine-cglib/src/com/fr/third/net/sf/cglib/util/StringSwitcher.java +++ b/fine-cglib/src/com/fr/third/net/sf/cglib/util/StringSwitcher.java @@ -16,7 +16,18 @@ package com.fr.third.net.sf.cglib.util; import java.util.*; -import com.fr.third.net.sf.cglib.core.*; + +import com.fr.third.net.sf.cglib.core.AbstractClassGenerator; +import com.fr.third.net.sf.cglib.core.ClassEmitter; +import com.fr.third.net.sf.cglib.core.CodeEmitter; +import com.fr.third.net.sf.cglib.core.Constants; +import com.fr.third.net.sf.cglib.core.EmitUtils; +import com.fr.third.net.sf.cglib.core.KeyFactory; +import com.fr.third.net.sf.cglib.core.ObjectSwitchCallback; +import com.fr.third.net.sf.cglib.core.ReflectUtils; +import com.fr.third.net.sf.cglib.core.Signature; +import com.fr.third.net.sf.cglib.core.TypeUtils; +import net.sf.cglib.core.*; import com.fr.third.org.objectweb.asm.ClassVisitor; import com.fr.third.org.objectweb.asm.Label; import com.fr.third.org.objectweb.asm.Type; @@ -26,11 +37,11 @@ import com.fr.third.org.objectweb.asm.Type; */ abstract public class StringSwitcher { private static final Type STRING_SWITCHER = - TypeUtils.parseType("com.fr.third.net.sf.cglib.util.StringSwitcher"); + TypeUtils.parseType("net.sf.cglib.util.StringSwitcher"); private static final Signature INT_VALUE = TypeUtils.parseSignature("int intValue(String)"); private static final StringSwitcherKey KEY_FACTORY = - (StringSwitcherKey)KeyFactory.create(StringSwitcherKey.class); + (StringSwitcherKey) KeyFactory.create(StringSwitcherKey.class); interface StringSwitcherKey { public Object newInstance(String[] strings, int[] ints, boolean fixedInput); @@ -144,7 +155,7 @@ abstract public class StringSwitcher { } protected Object firstInstance(Class type) { - return (StringSwitcher)ReflectUtils.newInstance(type); + return (StringSwitcher) ReflectUtils.newInstance(type); } protected Object nextInstance(Object instance) {