Package org.objectweb.asm

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


        method.athrow();
        method.end();
       
        cw.visitEnd();
       
        byte[] bytecode = cw.toByteArray();
       
        try {
            FileOutputStream fos = new FileOutputStream(classpath);
            fos.write(bytecode);
        } catch (Exception e) {
View Full Code Here


       
        // end class
        cw.visitEnd();
       
        // create the class
        byte[] bytes = cw.toByteArray();
        Class newClass = ruby.getJRubyClassLoader().defineClass(name, cw.toByteArray());
       
        if (DEBUG) {
            FileOutputStream fos = null;
            try {
View Full Code Here

        // end class
        cw.visitEnd();
       
        // create the class
        byte[] bytes = cw.toByteArray();
        Class newClass = ruby.getJRubyClassLoader().defineClass(name, cw.toByteArray());
       
        if (DEBUG) {
            FileOutputStream fos = null;
            try {
                fos = new FileOutputStream(name + ".class");
View Full Code Here

       
        // end class
        cw.visitEnd();
       
        // create the class
        byte[] bytes = cw.toByteArray();
        Class newClass;
        synchronized (ruby.getJRubyClassLoader()) {
            // try to load the specified name; only if that fails, try to define the class
            try {
                newClass = ruby.getJRubyClassLoader().loadClass(name);
View Full Code Here

        synchronized (ruby.getJRubyClassLoader()) {
            // try to load the specified name; only if that fails, try to define the class
            try {
                newClass = ruby.getJRubyClassLoader().loadClass(name);
            } catch (ClassNotFoundException cnfe) {
                newClass = ruby.getJRubyClassLoader().defineClass(name, cw.toByteArray());
            }
        }
       
        if (DEBUG) {
            FileOutputStream fos = null;
View Full Code Here

        ClassReader cr = new ClassReader(predicateAnalysisDataContainer._predicateSubjectBytecode.get(className));
        ClassWriter cw = new ClassWriter(cr, ClassWriter.COMPUTE_MAXS
                | ClassWriter.COMPUTE_FRAMES);
        PredicateSubjectTransformer cv = new PredicateSubjectTransformer(cw,className,predicateAnalysisDataContainer, embedProxy);
        cr.accept(cv, ClassReader.EXPAND_FRAMES);
        return cw.toByteArray();
    }

    private boolean accessAnalize(byte[] predicateBytecode,
            Method predicateMethod,
            PredicateSubjectAnalysisDataContainer predicateAnalysisDataContainer)
View Full Code Here

                | ClassWriter.COMPUTE_FRAMES);
        PredicateAnalizer cv = new PredicateAnalizer(cw,
                predicateMethod, predicateAnalysisDataContainer);//predicateAnalysisDataContainer._predicateAnalizer;
        cv.enableTransformation(true);
        cr.accept(cv, ClassReader.EXPAND_FRAMES);
        byte[] transformedPredicateBytecode = cw.toByteArray();
        defineClass(predicateClassName , transformedPredicateBytecode, 0, transformedPredicateBytecode.length);
        predicateAnalysisDataContainer._transformedQueryBytecode._predicateBytecode = transformedPredicateBytecode;
    }

    private boolean analizePredicateSubjectAccessFields(
View Full Code Here

  public static byte[] addStackMaps(World world, byte[] data) {
    try {
      ClassReader cr = new ClassReader(data);
      ClassWriter cw = new AspectJConnectClassWriter(world);
      cr.accept(cw, 0);
      return cw.toByteArray();
    } catch (Throwable t) {
      System.err.println("AspectJ Internal Error: unable to add stackmap attributes. " + t.getMessage());
      AsmDetector.isAsmAround = false;
      return data;
    }
View Full Code Here

   
    void serialize(IConstructor c,OutputStream output) throws IOException {
      ClassNode cn = buildClass(c);
      ClassWriter cw = new ClassWriter(COMPUTE_FRAMES);
      cn.accept(cw);
      output.write(cw.toByteArray());
      output.close();
    }

    ClassNode buildClass(IConstructor c) {
      ClassNode classNode = new ClassNode();
View Full Code Here

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

    /**
     * Generates a delegated method.
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.