Package org.objectweb.asm

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


      long t = System.currentTimeMillis();
      for (int j = 0; j < classes.size() / 10; ++j) {
        byte[] b = (byte[]) classes.get(j);
        ClassReader cr = new ClassReader(b);
        ClassNode cn = new ClassNode();
        cr.accept(cn, 0);
        List methods = cn.methods;
        for (int k = 0; k < methods.size(); ++k) {
          MethodNode method = (MethodNode) methods.get(k);
          if (method.instructions.size() > 0) {
            Analyzer a = new Analyzer(new BasicInterpreter());
View Full Code Here


      long t = System.currentTimeMillis();
      for (int j = 0; j < classes.size() / 10; ++j) {
        byte[] b = (byte[]) classes.get(j);
        ClassReader cr = new ClassReader(b);
        ClassNode cn = new ClassNode();
        cr.accept(cn, 0);
        List methods = cn.methods;
        for (int k = 0; k < methods.size(); ++k) {
          MethodNode method = (MethodNode) methods.get(k);
          if (method.instructions.size() > 0) {
            Analyzer a = new Analyzer(new SimpleVerifier());
View Full Code Here

                                                   className.replace('.', '/'),
                                                   classLoader,
                                                   classLoader.archive.getBundleId(),
                                                   this);

      cr.accept(trans, 0);

      byte[] newBytes = cw.toByteArray();

      if(bDumpClasses) {
        dumpClassBytes(className, newBytes);
View Full Code Here

  public synchronized void analyseClass(InputStream clsIn, String fileName)
  {
    try {
      ClassReader cr = new ClassReader(clsIn);
      currentClassFile = new File(fileName);
      cr.accept(this, 0);
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
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,
View Full Code Here

        ClassReader cr = new ClassReader(predicateBytecode);
        ClassWriter cw = new ClassWriter(cr, ClassWriter.COMPUTE_MAXS
                | ClassWriter.COMPUTE_FRAMES);
        PredicateAnalizer cv = predicateAnalysisDataContainer._predicateAnalizer = new PredicateAnalizer(cw,
                predicateMethod, predicateAnalysisDataContainer);
        cr.accept(cv, ClassReader.EXPAND_FRAMES);
        if (cv.isNotEligible()) {
            return false;
        }
        return analizePredicateSubjectAccessFields(predicateAnalysisDataContainer);
    }
View Full Code Here

        ClassWriter cw = new ClassWriter(cr, ClassWriter.COMPUTE_MAXS
                | 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;
    }
View Full Code Here

                    .get(nextClass);
            ClassReader cr = new ClassReader(bytecode);
            ClassWriter cw = new ClassWriter(cr, ClassWriter.COMPUTE_MAXS
                    | ClassWriter.COMPUTE_FRAMES);
            SubjectFieldAccessAnalizer predicateSubjectFieldAccessAnalizer = new SubjectFieldAccessAnalizer(cw, nextClass, predicateAnalysisDataContainer);
            cr.accept(predicateSubjectFieldAccessAnalizer,
                    ClassReader.EXPAND_FRAMES);
            if(predicateSubjectFieldAccessAnalizer._totalMethodsAnalized > 0){
                int currentHierarchyIndex = predicateAnalysisDataContainer._predicateSubjectClassDescriptor.getHierarchyTypeIndex(nextClass);
                predicateAnalysisDataContainer._lowestClassInHieratchyToModify = Math.min(predicateAnalysisDataContainer._lowestClassInHieratchyToModify, currentHierarchyIndex);
                predicateAnalysisDataContainer._classesForTransformation.put(nextClass, null);
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

        @JRubyMethod(name = "inspect_bytecode")
        public static IRubyObject compiled_script_inspect_bytecode(IRubyObject recv) {
            StringWriter sw = new StringWriter();
            ClassReader cr = new ClassReader((byte[])org.jruby.javasupport.JavaUtil.convertRubyToJava(recv.getInstanceVariables().fastGetInstanceVariable("@code"),byte[].class));
            TraceClassVisitor cv = new TraceClassVisitor(new PrintWriter(sw));
            cr.accept(cv, ClassReader.SKIP_DEBUG);
            return recv.getRuntime().newString(sw.toString());
        }
    }

    @JRubyModule(name="JRubyExtensions")
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.