} catch (ClassNotFoundException e) { try { final ClassFile file = new ClassFile(NAME, SerializationHackProxy.class.getName());
public byte[] createTokenizer(final String[] httpVerbs, String[] httpVersions, String[] standardHeaders) { final String className = existingClassName + CLASS_NAME_SUFFIX; final ClassFile file = new ClassFile(className, existingClassName); final ClassMethod ctor = file.addMethod(AccessFlag.PUBLIC, "<init>", "V", DescriptorUtils.parameterDescriptors(constructorDescriptor)); ctor.getCodeAttribute().aload(0); ctor.getCodeAttribute().loadMethodParameters(); ctor.getCodeAttribute().invokespecial(existingClassName, "<init>", constructorDescriptor); ctor.getCodeAttribute().returnInstruction(); final ClassMethod sctor = file.addMethod(AccessFlag.PUBLIC | AccessFlag.STATIC, "<clinit>", "V"); final AtomicInteger fieldCounter = new AtomicInteger(1); sctor.getCodeAttribute().invokestatic(existingClassName, "httpStrings", "()" + DescriptorUtils.makeDescriptor(Map.class)); sctor.getCodeAttribute().astore(CONSTRUCTOR_HTTP_STRING_MAP_VAR); createStateMachines(httpVerbs, httpVersions, standardHeaders, className, file, sctor, fieldCounter); sctor.getCodeAttribute().returnInstruction(); return file.toBytecode(); }
Class<?> superclass, String stubClassName) { final ClassFile asm = new ClassFile(stubClassName, superclass.getName(), interfaceAnalysis.getCls().getName());
private ClassFile newClassFile(String name, int accessFlags, String superclass, String... interfaces) { try { if (classLoader == null) { // initiate without the CL information as CL is null return new ClassFile(name, accessFlags, superclass, interfaces); } else { // initiate with the CL information return new ClassFile(name, accessFlags, superclass, classLoader, interfaces); } } catch (Exception e) { throw BeanLogger.LOG.unableToCreateClassFile(name, e.getCause()); } }
private ClassFile newClassFile(String name, int accessFlags, String superclass, String... interfaces) { try { if (classLoader == null) { // initiate without the CL information as CL is null return new ClassFile(name, accessFlags, superclass, interfaces); } else { // initiate with the CL information return new ClassFile(name, accessFlags, superclass, classLoader, interfaces); } } catch (Exception e) { throw BeanLogger.LOG.unableToCreateClassFile(name, e.getCause()); } }
private ClassFile newClassFile(String name, int accessFlags, String superclass, String... interfaces) { try { if (classLoader == null) { // initiate without the CL information as CL is null return new ClassFile(name, accessFlags, superclass, interfaces); } else { // initiate with the CL information return new ClassFile(name, accessFlags, superclass, classLoader, interfaces); } } catch (Exception e) { throw BeanLogger.LOG.unableToCreateClassFile(name, e.getCause()); } }
private ClassFile newClassFile(String name, int accessFlags, String superclass, String... interfaces) { try { if (classLoader == null) { // initiate without the CL information as CL is null return new ClassFile(name, accessFlags, superclass, interfaces); } else { // initiate with the CL information return new ClassFile(name, accessFlags, superclass, classLoader, interfaces); } } catch (Exception e) { throw BeanLogger.LOG.unableToCreateClassFile(name, e.getCause()); } }
private ClassFile newClassFile(String name, int accessFlags, String superclass, String... interfaces) { try { if (classLoader == null) { // initiate without the CL information as CL is null return new ClassFile(name, accessFlags, superclass, interfaces); } else { // initiate with the CL information return new ClassFile(name, accessFlags, superclass, classLoader, interfaces); } } catch (Exception e) { throw BeanLogger.LOG.unableToCreateClassFile(name, e.getCause()); } }
private ClassFile newClassFile(String name, int accessFlags, String superclass, String... interfaces) { try { if (CONFIGURABLE_CLASSLOADER_CONSTRUCTOR != null) { return CONFIGURABLE_CLASSLOADER_CONSTRUCTOR.newInstance(name, accessFlags, superclass, classLoader, interfaces); } else if (CONFIGURABLE_ACCESS_FLAGS) { return new ClassFile(name, accessFlags, superclass, interfaces); } else { return new ClassFile(name, superclass, interfaces); } } catch (Exception e) { throw BeanLogger.LOG.unableToCreateClassFile(name, e.getCause()); } }
/** * Construct a new instance. * * @param className the generated class name * @param superClass the superclass of the generated class * @param classLoader the class loader used to load the class * @param protectionDomain the protection domain of the class */ protected AbstractClassFactory(String className, Class<T> superClass, ClassLoader classLoader, ProtectionDomain protectionDomain) { if (classLoader == null) { throw new IllegalArgumentException("ClassLoader cannot be null when attempting to proxy " + superClass + ". If you are trying to proxy a JDK class you must specify the class loader explicitly to prevent memory leaks"); } if(superClass == null) { throw new IllegalArgumentException("Superclass cannot be null for proxy " + className); } if(className == null) { throw new IllegalArgumentException("Class name cannot be null"); } this.className = className; this.superClass = superClass; this.classLoader = classLoader; this.protectionDomain = protectionDomain; classFile = new ClassFile(className, superClass.getName()); }
} catch (ClassNotFoundException e) { try { final ClassFile file = new ClassFile(NAME, SerializationHackProxy.class.getName());
Class superclass, String stubClassName) { final ClassFile asm = new ClassFile(stubClassName, superclass.getName(), interfaceAnalysis.getCls().getName());