Package org.objectweb.asm

Examples of org.objectweb.asm.ClassWriter.visitEnd()


        av0.visit("namespace", ns);
        av0.visitEnum("elementFormDefault",
                      getClassCode(XmlNsForm.class),
                      q ? "QUALIFIED" : "UNQUALIFIED");
        av0.visitEnd();
        cw.visitEnd();

        loadClass(className, clz, cw.toByteArray());
    }

    private void generateMessagePart(ClassWriter cw, MessagePartInfo mpi, Method method, String className) {
View Full Code Here


                BcNode.DeclField fd = (BcNode.DeclField) bcNode;
                cw.visitField(ACC_PUBLIC, fd.name, javaTypeOf(fd.type), null, null).visitEnd();
            }
        }

        cw.visitEnd();
        return cw.toByteArray();
    }

    private void visitConstr(List<BcNode> bc, ClassWriter cw) {
        MethodVisitor constrv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
View Full Code Here

                createGettersAndSetters(classWriter, modelIface, className, name, property);

            }

            createConstructor(classWriter, className, properties);
            classWriter.visitEnd();
            Class<?> newClass;
            try {
                newClass = defineClass(modelIface, className, classWriter.toByteArray());
            } catch (Exception ex) {
                throw new RuntimeException(ex);
View Full Code Here

        methodVisitor.visitVarInsn(Opcodes.ALOAD, 0);
        methodVisitor.visitMethodInsn(Opcodes.INVOKESPECIAL, "java/lang/Object", "<init>", "()V");
        methodVisitor.visitInsn(Opcodes.RETURN);
        methodVisitor.visitMaxs(1,1);
        methodVisitor.visitEnd();
        writer.visitEnd();
        byte[] bytecode = writer.toByteArray();
        ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
        try {
            Class<?> result = (Class<?>) defineClassMethod.invoke(classLoader, name.replace("/","."), bytecode, 0, bytecode.length);
            LOGGER.fine("Created class " + result.getName());
View Full Code Here

            }
            mv.visitInsn(ARETURN);
            mv.visitMaxs(0, 0);
            mv.visitEnd();

            cw.visitEnd();
            return cw.toByteArray();
    }

    protected void addCreator(MethodVisitor mv, Constructor<?> ctor)
    {
View Full Code Here

                           method.getName(),
                           argsAndReturn.toString(),
                           null,
                           new String[] {"java/rmi/RemoteException"});
        }
        cw.visitEnd();
        return cw.toByteArray();
    }

    public static Class<? extends Remote> generate(Class<?> javaInterface) {
        if (!Remote.class.isAssignableFrom(javaInterface)) {
View Full Code Here

                        joinPointType, cw, className, system, declaringClass,
                        joinPointHash, rttiInfo,
                        aroundAdvice, beforeAdvice, afterAdvice
                );

                cw.visitEnd();

                // load the generated class
                joinPointClass = AsmHelper.loadClass(loader, cw.toByteArray(), className.replace('/', '.'));
            }
View Full Code Here

                createGettersAndSetters(classWriter, modelIface, className, name, property);

            }

            createConstructor(classWriter, className, properties);
            classWriter.visitEnd();
            Class<?> newClass;
            try {
                newClass = defineClass(modelIface, className, classWriter.toByteArray());
            } catch (Exception ex) {
                throw new RuntimeException(ex);
View Full Code Here

                        joinPointSequence,
                        aroundAdvices,
                        null);
            }

            cw.visitEnd();

            if (DUMP_CLASSES) {
                AsmHelper.dumpClass(DUMP_DIR, joinPointClassName, cw);
            }
            return cw.toByteArray();
View Full Code Here

                    joinPointHash,
                    rttiInfo,
                    aroundAdvice,
                    beforeAdvice,
                    afterAdvice);
                cw.visitEnd();

                // FIXME: should be a VM option
                 //AsmHelper.dumpClass("_dump", className, cw);

                // load the generated class
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.