Package org.objectweb.asm.tree

Examples of org.objectweb.asm.tree.ClassNode


                        MethodNode method = context.getMethodNode();
                        return method.name.equals(expected);
                    }

                    if (context.getClassNode() != null) {
                        ClassNode clazz = context.getClassNode();
                        return clazz.name.equals(expected);
                    }

                    // Parameters have no name in bytecode
View Full Code Here


    public ClassMetadataCollector(BindingRegistry registry, Reporter reporter) {
        super(Opcodes.ASM5);
        this.registry = registry;
        this.reporter = reporter;
        node = new ClassNode();
    }
View Full Code Here

      RemapClasses remapper = new RemapClasses(oldTemplateSlashName, materializedSlashName);
     
      Stopwatch t3;
      {
       
        ClassNode impl = getClassNodeFromByteCode(implementationClass);
        t2.stop();
        t3 = new Stopwatch().start();
       
       
        ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES);
View Full Code Here

  }

  private ClassNode getClassNodeFromByteCode(byte[] bytes) {
    ClassReader iReader = new ClassReader(bytes);
    ClassNode impl = new ClassNode();
    iReader.accept(impl, 0);
    return impl;
  }
View Full Code Here

    };
   
    public byte[] transformClass(byte[] in) throws Exception {
      
        ClassReader cr = new ClassReader(in);
        ClassNode node = new ClassNode();       
        cr.accept(node, 0);

//        String preCheck = verify( in );
//        if ( preCheck.trim().length() > 0 ) {
//            log( "Class " + node.name + " failed precheck:\n---\n" + preCheck + "---\n" );
//            throw new Exception( "Class " + node.name + " failed precheck\n---\n" + preCheck +"\n---\n" );
//        }
        logMessages.add("Transforming " + node.name);
        transformNode(node);
        int opts = 0;
        if( node.version > 50 ) {
          opts = ClassWriter.COMPUTE_FRAMES;
        }
        ClassWriter cw = new ClassWriter( opts );

        node.accept(new ClassVisitor( Opcodes.ASM4, cw) {});
        byte[] result = cw.toByteArray();
//        String postCheck = verify( result );
//        if ( postCheck.trim().length() > 0 ) {
//            log( "Class " + node.name + " failed postcheck:\n " + postCheck );
//            throw new Exception( "Class " + node.name + " failed postcheck:\n" + postCheck );
View Full Code Here

        return fails;
    }

    private boolean readClass(String clazz) throws IOException {
        ClassReader cr = new ClassReader(new FileInputStream(clazz));
        ClassNode ca = new ClassNode() {
            public void visitEnd() {
                //accept(cv);
            }
        };
        cr.accept(new CheckClassAdapter(ca), ClassWriter.COMPUTE_MAXS);
View Full Code Here

 
  @Test
  public void checkAnnotationLogic() throws Exception {
    PurrPackageSelector selector = new PurrPackageSelector();
    selector.classLoader = clb.makeUninstrumentedClassLoader();
    ClassNode cn = new ClassNode();
    MethodNode mn = new MethodNode();
    cn.name = "jcr/SampleTest";
    mn.name = "foo";
    // null annotations.
    assertFalse(selector.shouldVisit(cn, mn));
View Full Code Here

  }
 
  @Test
    public void testCheckForOldStyleJUnitTests() throws Exception {
      ClassNode cn = new ClassNode();
      cn.name = "jcr/OldStyleSampleTest";

      MethodNode mn = new MethodNode();
      mn.name = "testFoo";
View Full Code Here

            isVoid = description.returnType.equals("void");

            invocationClassName = String.format("%s$Invocation_%s_%s", className, description.methodName,
                    PlasticUtils.nextUID());

            invocationClassNode = new ClassNode();

            invocationClassNode.visit(V1_5, ACC_PUBLIC | ACC_FINAL, nameCache.toInternalName(invocationClassName),
                    null, ABSTRACT_METHOD_INVOCATION_INTERNAL_NAME, new String[]
                    { nameCache.toInternalName(MethodInvocation.class) });
View Full Code Here

     */
    public PlasticClassTransformation getPlasticClassTransformation(String className) throws ClassNotFoundException
    {
        assert PlasticInternalUtils.isNonBlank(className);

        ClassNode classNode = createClassNode(className);

        String baseClassName = PlasticInternalUtils.toClassName(classNode.superName);

        return createTransformation(baseClassName, classNode);
    }
View Full Code Here

TOP

Related Classes of org.objectweb.asm.tree.ClassNode

Copyright © 2018 www.massapicom. 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.