Package org.objectweb.asm

Examples of org.objectweb.asm.ClassVisitor


        cBuilder.setCodeBaseEntry(codeBaseEntry);

        final TreeSet<ClassDescriptor> calledClassSet = new TreeSet<ClassDescriptor>();

        classReader.accept(new ClassVisitor(FindBugsASM.ASM_VERSION) {

            //            boolean isInnerClass = false;

            @Override
            public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {
View Full Code Here


    try {
      ClassReader cReader = new ClassReader(loader.getResourceAsStream(aClass.getName().replaceAll(
          "\\.", "/")
          + ".class"));
      ClassWriter cWriter = new ClassWriter(ClassWriter.COMPUTE_MAXS);
      ClassVisitor dynamicSubclassAdapter = new ProxySubclassAdapter(cWriter, fullNewClassName,
          loader);
      byte[] byteClassData = processClass(cReader, cWriter, dynamicSubclassAdapter);
      clazz = loadClassFromBytes(loader, getBinaryName(fullNewClassName), byteClassData, aClass
          .getName());
    } catch (IOException ioe) {
View Full Code Here

        // ProxySubclassHierarchyAdapter
        // to process only methods on that class that are in the list
        ClassReader cr = new ClassReader(loader.getResourceAsStream(currentlyAnalysedClass
            .getName().replaceAll("\\.", "/")
            + ".class"));
        ClassVisitor hierarchyAdapter = new ProxySubclassHierarchyAdapter(this, setOfFoundMethods);
        cr.accept(hierarchyAdapter, ClassReader.SKIP_DEBUG);
      } catch (IOException e) {
        throw new TypeNotPresentException(currentlyAnalysedClassName, e);
      }
      // now add the foundMethods to the overall list of observed methods
View Full Code Here

        //since we are mostly just copying
        //we just need to override the visit method so we can add
        //the synthetic modifier, otherwise we use the methods in
        //a standard writer
        writer =   new ClassWriter(reader, 0) ;
        ClassVisitor cv = new CustomClassVisitor((ClassVisitor)writer);
        //call accept on the reader to start the visits
        //using the writer we created as the visitor
        reader.accept(cv, 0);
      } finally {
        //close the InputStream if it is hanging around
View Full Code Here

   */
  InterfaceCombiningClassAdapter(String className,
      ClassLoader loader, Class<?> superclass, Collection<Class<?>> interfaces) {
    super(Opcodes.ASM4);
    writer = new OSGiFriendlyClassWriter(ClassWriter.COMPUTE_FRAMES, loader);
    ClassVisitor cv = new OSGiFriendlyClassVisitor(writer, ClassWriter.COMPUTE_FRAMES);
    adapter = new InterfaceUsingWovenProxyAdapter(cv, className, loader);

    this.interfaces = interfaces;
    this.superclass = superclass;
    String[] interfaceNames = new String[interfaces.size()];
View Full Code Here

    //If we are Java 1.6 + compiled then we need to compute stack frames, otherwise
    //maxs are fine (and faster)
    int computeVal = AbstractWovenProxyAdapter.IS_AT_LEAST_JAVA_6 ?
        ClassWriter.COMPUTE_FRAMES : ClassWriter.COMPUTE_MAXS;
    ClassWriter cWriter = new OSGiFriendlyClassWriter(cReader, computeVal, loader);
    ClassVisitor cv = new OSGiFriendlyClassVisitor(cWriter, computeVal );
    //Wrap our outer layer to add the original SerialVersionUID if it was previously being defaulted
    ClassVisitor weavingAdapter = new SyntheticSerialVerUIDAdder(
                               new WovenProxyAdapter(cv, cReader.getClassName(), loader));
   
    // If we are Java 1.6 + then we need to skip frames as they will be recomputed
    cReader.accept(weavingAdapter, AbstractWovenProxyAdapter.IS_AT_LEAST_JAVA_6 ? ClassReader.SKIP_FRAMES : 0);
   
View Full Code Here

    public byte[] instrumentClass(byte[] bytes) throws IOException {
        if (forInstrumenting) {
            ClassReader cr = new ClassReader(bytes);
            ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS/* | ClassWriter.COMPUTE_FRAMES*/);
            try {
                ClassVisitor ci = (ClassVisitor) INSTRUMENTER_CONSTRUCTOR.newInstance(projectData, cw, Collections.EMPTY_LIST, Collections.EMPTY_LIST);
                cr.accept(ci, 0);
                if (((Boolean) IS_INSTRUMENTED_METHOD.invoke(ci)).booleanValue()) {
                    return cw.toByteArray();
                }
            } catch (Throwable t) {
View Full Code Here

  }
 
  @Override
  protected Void process(String file) throws FileNotFoundException, IOException {
    cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES);
    ClassVisitor cv = cw;
   
    switch (meta.annotation) {
      case PACKED:
        validateOnlyPrimitives(meta.fields);
        cr = new AccessorGenerator(cr, meta).transform();
View Full Code Here

  }
 
  @Override
  protected Void process(String file) throws FileNotFoundException, IOException {
    cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES);
    ClassVisitor cv = cw;
   
    cr = new ProcessEntitiesInjector(cr, meta).transform();
    cv = new OptimizingEntitySystemWeaver(cv, meta);
   
    try {
View Full Code Here

 
  @Override
  protected Void process(String file) throws FileNotFoundException, IOException {
    injectProfilerStubs(meta);
   
    ClassVisitor cv = new ProfileVisitor(cw, meta);
    cv = new ProfileAnnotationRemoverWeaver(cv);
    cr.accept(cv, ClassReader.EXPAND_FRAMES);
   
    ClassUtil.writeClass(cw, file);
    return null;
View Full Code Here

TOP

Related Classes of org.objectweb.asm.ClassVisitor

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.