Package org.ow2.asm

Examples of org.ow2.asm.ClassReader.accept()


        final ClassReader reader = new ClassReader( stream );
        final ClassFieldVisitor visitor = new ClassFieldVisitor( clazz,
                                                                 includeFinalMethods,
                                                                 this );
        reader.accept( visitor,
                       0 );
        if ( clazz.getSuperclass() != null ) {
            final String name = getResourcePath( clazz.getSuperclass() );
            final InputStream parentStream = clazz.getResourceAsStream( name );
            if ( parentStream != null ) {
View Full Code Here


    }

    @Override
    public void test() throws Exception {
        ClassReader cr = new ClassReader(is);
        cr.accept(new EmptyVisitor() {
            @Override
            public void visit(
                int version,
                int access,
                String name,
View Full Code Here

    }

    @Override
    public void test() throws Exception {
        ClassReader cr = new ClassReader(is);
        cr.accept(new EmptyVisitor() {
            @Override
            public void visit(
                int version,
                int access,
                String name,
View Full Code Here

    public static void main(final String args[]) throws Exception {
        // loads the original class and adapts it
        ClassReader cr = new ClassReader("CommentAttribute");
        ClassWriter cw = new ClassWriter(0);
        ClassVisitor cv = new AddCommentClassAdapter(cw);
        cr.accept(cv, new Attribute[] { new CommentAttribute("") }, 0);
        byte[] b = cw.toByteArray();

        // stores the adapted class on disk
        FileOutputStream fos = new FileOutputStream("CommentAttribute.class.new");
        try {
View Full Code Here

        }
       
        // "disassembles" the adapted class
        cr = new ClassReader(b);
        cv = new TraceClassVisitor(new PrintWriter(System.out));
        cr.accept(cv, new Attribute[] { new CommentAttribute("") }, 0);
    }
}

class AddCommentClassAdapter extends ClassAdapter implements Opcodes {
View Full Code Here

    @Override
    public void test() throws Exception {
        ClassReader cr = new ClassReader(is);
        ClassNode cn = new ClassNode();
        cr.accept(cn, 0);
        List<MethodNode> methods = cn.methods;
        for (int i = 0; i < methods.size(); ++i) {
            MethodNode method = methods.get(i);
            Analyzer<BasicValue> a = new Analyzer<BasicValue>(new BasicInterpreter());
            a.analyze(cn.name, method);
View Full Code Here

            return;
        }

        StringWriter sw = new StringWriter();
        GASMifierClassVisitor cv = new GASMifierClassVisitor(new PrintWriter(sw));
        cr.accept(cv,
                new Attribute[] { new Comment(), new CodeComment() },
                ClassReader.EXPAND_FRAMES);

        String generated = sw.toString();
View Full Code Here

            trace(generated);
            throw ex;
        }

        ClassWriter cw = new ClassWriter(0);
        cr.accept(new ClassAdapter(cw) {
            @Override
            public MethodVisitor visitMethod(
                final int access,
                final String name,
                final String desc,
View Full Code Here

    }

    @Override
    public void test() throws Exception {
        ClassReader cr = new ClassReader(is);
        cr.accept(new SerialVersionUIDAdder(new EmptyVisitor()), 0);
    }
}
View Full Code Here

    }

    @Override
    public void test() throws Exception {
        ClassReader cr = new ClassReader(is);
        cr.accept(new ClassAdapter(new ClassWriter(0)) {
            @Override
            public MethodVisitor visitMethod(
                final int access,
                final String name,
                final String desc,
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.