Package com.google.gwt.dev.asm

Examples of com.google.gwt.dev.asm.ClassWriter


      byte[] classBytes, Map<String, String> anonymousClassMap) {
    String desc = toDescriptor(className);
    assert (!jsoIntfDescs.contains(desc));

    // The ASM model is to chain a bunch of visitors together.
    ClassWriter writer = new ClassWriter(0);
    ClassVisitor v = writer;

    // v = new CheckClassAdapter(v);
    // v = new TraceClassVisitor(v, new PrintWriter(System.out));

    v = new RewriteSingleJsoImplDispatches(v, typeOracle, jsoData);

    v = new RewriteRefsToJsoClasses(v, jsoIntfDescs, mapper);

    if (jsoImplDescs.contains(desc)) {
      v = WriteJsoImpl.create(v, desc, jsoIntfDescs, mapper, jsoData);
    }

    v = new RewriteJsniMethods(v, anonymousClassMap);

    if (Double.parseDouble(System.getProperty("java.class.version")) < Opcodes.V1_6) {
      v = new ForceClassVersion15(v);
    }

    new ClassReader(classBytes).accept(v, 0);
    return writer.toByteArray();
  }
View Full Code Here


    List<String> superDescs = jsoSuperDescs.get(desc);
    assert (superDescs != null);
    assert (superDescs.size() > 0);

    // The ASM model is to chain a bunch of visitors together.
    ClassWriter writer = new ClassWriter(0);
    ClassVisitor v = writer;

    // v = new CheckClassAdapter(v);
    // v = new TraceClassVisitor(v, new PrintWriter(System.out));

    String[] interfaces;
    // TODO(bov): something better than linear?
    if (superDescs.contains("java/lang/Object")) {
      interfaces = null;
    } else {
      interfaces = superDescs.toArray(new String[superDescs.size()]);
    }
    v.visit(Opcodes.V1_5, Opcodes.ACC_PUBLIC | Opcodes.ACC_INTERFACE, desc,
        null, "java/lang/Object", interfaces);
    v.visitEnd();
    return writer.toByteArray();
  }
View Full Code Here

  public byte[] rewrite(String className, byte[] classBytes) {
    String desc = toDescriptor(className);
    assert (!jsoIntfDescs.contains(desc));

    // The ASM model is to chain a bunch of visitors together.
    ClassWriter writer = new ClassWriter(0);
    ClassVisitor v = writer;

    // v = new CheckClassAdapter(v);
    // v = new TraceClassVisitor(v, new PrintWriter(System.out));

    v = new RewriteRefsToJsoClasses(v, jsoIntfDescs, mapper);

    if (jsoImplDescs.contains(desc)) {
      v = new WriteJsoImpl(v, jsoIntfDescs, mapper);
    }

    v = new RewriteJsniMethods(v);

    new ClassReader(classBytes).accept(v, 0);
    return writer.toByteArray();
  }
View Full Code Here

    assert (jsoSuperDescs.containsKey(desc));
    String superDesc = jsoSuperDescs.get(desc);
    assert (superDesc != null);

    // The ASM model is to chain a bunch of visitors together.
    ClassWriter writer = new ClassWriter(0);
    ClassVisitor v = writer;

    // v = new CheckClassAdapter(v);
    // v = new TraceClassVisitor(v, new PrintWriter(System.out));

    String[] interfaces;
    if ("java/lang/Object".equals(superDesc)) {
      interfaces = null;
    } else {
      interfaces = new String[] {superDesc};
    }
    v.visit(Opcodes.V1_5, Opcodes.ACC_PUBLIC | Opcodes.ACC_INTERFACE, desc,
        null, "java/lang/Object", interfaces);
    v.visitEnd();
    return writer.toByteArray();
  }
View Full Code Here

      Map<String, String> anonymousClassMap) {
    String desc = toDescriptor(className);
    assert (!jsoIntfDescs.contains(desc));

    // The ASM model is to chain a bunch of visitors together.
    ClassWriter writer = new ClassWriter(0);
    ClassVisitor v = writer;

    // v = new CheckClassAdapter(v);
    // v = new TraceClassVisitor(v, new PrintWriter(System.out));

    v = new RewriteRefsToJsoClasses(v, jsoIntfDescs, mapper);

    if (jsoImplDescs.contains(desc)) {
      v = new WriteJsoImpl(v, jsoIntfDescs, mapper);
    }

    v = new RewriteJsniMethods(v, anonymousClassMap);

    if (Double.parseDouble(System.getProperty("java.class.version")) < Opcodes.V1_6) {
      v = new ForceClassVersion15(v);
    }

    new ClassReader(classBytes).accept(v, 0);
    return writer.toByteArray();
  }
View Full Code Here

    assert (jsoSuperDescs.containsKey(desc));
    String superDesc = jsoSuperDescs.get(desc);
    assert (superDesc != null);

    // The ASM model is to chain a bunch of visitors together.
    ClassWriter writer = new ClassWriter(0);
    ClassVisitor v = writer;

    // v = new CheckClassAdapter(v);
    // v = new TraceClassVisitor(v, new PrintWriter(System.out));

    String[] interfaces;
    if ("java/lang/Object".equals(superDesc)) {
      interfaces = null;
    } else {
      interfaces = new String[] {superDesc};
    }
    v.visit(Opcodes.V1_5, Opcodes.ACC_PUBLIC | Opcodes.ACC_INTERFACE, desc,
        null, "java/lang/Object", interfaces);
    v.visitEnd();
    return writer.toByteArray();
  }
View Full Code Here

               "Class Name", className);
      String desc = toDescriptor(className);
      assert !jsoIntfDescs.contains(desc);

      // The ASM model is to chain a bunch of visitors together.
      ClassWriter writer = new ClassWriter(0);
      ClassVisitor v = writer;

      // v = new CheckClassAdapter(v);
      // v = new TraceClassVisitor(v, new PrintWriter(System.out));

      v = new UseMirroredClasses(v, className);

      v = new RewriteSingleJsoImplDispatches(v, typeOracle, jsoData);

      v = new RewriteRefsToJsoClasses(v, jsoIntfDescs, mapper);

      if (jsoImplDescs.contains(desc)) {
         v = WriteJsoImpl.create(v, desc, jsoIntfDescs, mapper, jsoData);
      }

      if (Double.parseDouble(System.getProperty("java.class.version")) < Opcodes.V1_6) {
         v = new ForceClassVersion15(v);
      }

      new ClassReader(classBytes).accept(v, 0);
      classBytesRewriteEvent.end();
      return writer.toByteArray();
   }
View Full Code Here

      List<String> superDescs = jsoSuperDescs.get(desc);
      assert superDescs != null;
      assert superDescs.size() > 0;

      // The ASM model is to chain a bunch of visitors together.
      ClassWriter writer = new ClassWriter(0);
      ClassVisitor v = writer;

      // v = new CheckClassAdapter(v);
      // v = new TraceClassVisitor(v, new PrintWriter(System.out));

      String[] interfaces;
      // TODO(bov): something better than linear?
      if (superDescs.contains("java/lang/Object")) {
         interfaces = null;
      } else {
         interfaces = superDescs.toArray(new String[superDescs.size()]);
      }
      v.visit(Opcodes.V1_5, Opcodes.ACC_PUBLIC | Opcodes.ACC_INTERFACE, desc, null,
               "java/lang/Object", interfaces);
      v.visitEnd();
      return writer.toByteArray();
   }
View Full Code Here

      state = new State(type);
      typeName = type.getClassName();
    }

    public State call() {
      ClassWriter writer = new ClassWriter(0);
      ClassVisitor cv = writer;
      cv = new ClassProcessor(typeName, cv, state);
      cv = new NativeMethodDefanger(cv);
      visit(logger.setType(state.type), loader, state.type.getInternalName(),
          cv);
      state.contents = new ByteArrayInputStream(writer.toByteArray());
      assert seen.containsKey(state.originalType) : "No type for "
          + state.type.getClassName();
      state.type = seen.get(state.originalType);

      emit(state);
View Full Code Here

        SpeedTracerLogger.start(DevModeEventType.CLASS_BYTES_REWRITE, "Class Name", className);
    String desc = toDescriptor(className);
    assert (!jsoIntfDescs.contains(desc));

    // The ASM model is to chain a bunch of visitors together.
    ClassWriter writer = new ClassWriter(0);
    ClassVisitor v = writer;

    // v = new CheckClassAdapter(v);
    // v = new TraceClassVisitor(v, new PrintWriter(System.out));
    v = new UseMirroredClasses(v, className);

    v = new RewriteSingleJsoImplDispatches(v, typeOracle, jsoData);

    v = new RewriteRefsToJsoClasses(v, jsoIntfDescs, mapper);

    if (jsoImplDescs.contains(desc)) {
      v = WriteJsoImpl.create(v, desc, jsoIntfDescs, mapper, jsoData);
    }

    v = new RewriteJsniMethods(v, anonymousClassMap);

    if (Double.parseDouble(System.getProperty("java.class.version")) < Opcodes.V1_6) {
      v = new ForceClassVersion15(v);
    }

    new ClassReader(classBytes).accept(v, 0);
    classBytesRewriteEvent.end();
    return writer.toByteArray();
  }
View Full Code Here

TOP

Related Classes of com.google.gwt.dev.asm.ClassWriter

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.