Package org.kohsuke.asm3

Examples of org.kohsuke.asm3.ClassWriter.toByteArray()


            mv.visitInsn(RETURN);
            mv.visitMaxs(1, 1);
            mv.visitEnd();
            cw.visitEnd();

            bytes = cw.toByteArray();
        }

        return Archive.archive().add(subclassNameInternal + ".class", bytes).asJar();
    }
View Full Code Here


        final FieldAdderClassVisitor visitor = new FieldAdderClassVisitor(classWriter);

        final ClassReader classReader = new ClassReader(origBytes);
        classReader.accept(visitor, 0);

        return classWriter.toByteArray();
    }

    public static class FieldAdderClassVisitor extends ClassVisitor {
        public FieldAdderClassVisitor(final ClassVisitor classVisitor) {
            super(Opcodes.ASM5, classVisitor);
View Full Code Here

            mv.visitInsn(RETURN);
            mv.visitMaxs(1, 1);
            mv.visitEnd();
            cw.visitEnd();

            bytes = cw.toByteArray();
        }

        return Archive.archive().add(subclassNameInternal + ".class", bytes).asJar();
    }
View Full Code Here

        // This should never be reached, but just in case
        for (final MethodVisitor visitor : visitors.values()) {
            visitor.visitEnd();
        }

        return cw.toByteArray();
    }

    private static MethodVisitor visitConstructor(final ClassWriter cw, final String proxyClassFileName, final String classFileName, final Constructor<?> constructor) {
        final String descriptor = Type.getConstructorDescriptor(constructor);
View Full Code Here

        if (interceptedMethods != null)
        {
            delegateInterceptedMethods(classLoader, cw, proxyClassFileName, classToProxy, interceptedMethods);
        }

        return cw.toByteArray();
    }


    /**
     * The 'defineClass' method on the ClassLoader is protected, thus we need to invoke it via reflection.
View Full Code Here

                    processMethod(cw, method, proxyClassFileName, NON_BUSINESS_HANDLER_NAME);
                }
            }
        }

        return cw.toByteArray();
    }

    private static void getNonPrivateMethods(Class<?> clazz, final Map<String, List<Method>> methodMap) {
        while (clazz != null) {
            for (final Method method : clazz.getDeclaredMethods()) {
View Full Code Here

        // This should never be reached, but just in case
        for (final MethodVisitor visitor : visitors.values()) {
            visitor.visitEnd();
        }

        return cw.toByteArray();
    }

    private static MethodVisitor visitConstructor(final ClassWriter cw, final String proxyClassFileName, final String classFileName, final Constructor<?> constructor) {
        final String descriptor = Type.getConstructorDescriptor(constructor);
View Full Code Here

        if (interceptedMethods != null)
        {
            delegateInterceptedMethods(classLoader, cw, proxyClassFileName, classToProxy, interceptedMethods);
        }

        return cw.toByteArray();
    }


    /**
     * The 'defineClass' method on the ClassLoader is protected, thus we need to invoke it via reflection.
View Full Code Here

            m.visitMaxs(index,index);
            m.visitEnd();
        }

        cw.visitEnd();
        byte[] image = cw.toByteArray();

        Class<? extends T> c = defineClass(name, image, 0, image.length).asSubclass(base);

        Jenkins h = Jenkins.getInstance();
        if (h!=null)    // null only during tests.
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.