public void visit( final int version, final int access, final String name, final String signature, final String superName, final String[] interfaces) { cv.visit(version, access, name, signature, superName, interfaces); }
public AnnotationVisitor visitAnnotation( final String desc, final boolean visible) { return cv.visitAnnotation(desc, visible); }
public FieldVisitor visitField( final int access, final String name, final String desc, final String signature, final Object value) { return cv.visitField(access, name, desc, signature, value); }
cv.visit(version, access, name, signature, superName, interfaces); cv.visitSource(sourceFile, sourceDebug); cv.visitOuterClass(outerClass, outerMethod, outerMethodDesc); for (i = 0; i < n; ++i) { AnnotationNode an = visibleAnnotations.get(i); an.accept(cv.visitAnnotation(an.desc, true)); an.accept(cv.visitAnnotation(an.desc, false)); an.accept(cv.visitTypeAnnotation(an.typeRef, an.typePath, an.desc, true)); for (i = 0; i < n; ++i) { TypeAnnotationNode an = invisibleTypeAnnotations.get(i); an.accept(cv.visitTypeAnnotation(an.typeRef, an.typePath, an.desc, false)); cv.visitAttribute(attrs.get(i)); cv.visitEnd();
classVisitor.visit(readInt(4), access, name, classVisitor.visitSource(sourceFile, sourceDebug); classVisitor.visitOuterClass(enclosingOwner, enclosingName, enclosingDesc); c, true, classVisitor.visitAnnotation(readUTF8(v, c), i != 0)); attr = cattrs.next; cattrs.next = null; classVisitor.visitAttribute(cattrs); cattrs = attr; w += 2; for (; i > 0; --i) { classVisitor.visitInnerClass(readUnsignedShort(w) == 0 ? null : readClass(w, c), readUnsignedShort(w + 2) == 0 FieldVisitor fv = classVisitor.visitField(access, name, desc,
public MethodVisitor visitMethod( final int access, final String name, final String desc, final String signature, final String[] exceptions) { return cv.visitMethod(access, name, desc, signature, exceptions); }
/** * Defines the class header for the given class definition * * @param cw * @param classDef */ protected void buildClassHeader(ClassVisitor cw, ClassDefinition classDef) { String[] original = classDef.getInterfaces(); String[] interfaces = new String[original.length]; for ( int i = 0; i < original.length; i++ ) { interfaces[i] = BuildUtils.getInternalType( original[i] ); } int classModifiers = Opcodes.ACC_PUBLIC + Opcodes.ACC_SUPER; if ( classDef.isAbstrakt() ) { classModifiers += Opcodes.ACC_ABSTRACT; } // Building class header cw.visit( Opcodes.V1_5, classModifiers, BuildUtils.getInternalType( classDef.getClassName() ), null, BuildUtils.getInternalType( classDef.getSuperClass() ), interfaces ); buildClassAnnotations(classDef, cw); cw.visitSource( classDef.getClassName() + ".java", null ); }
/** * Visits the source of the class. * * @param source the name of the source file from which the class was compiled. May be {@literal * null}. * @param debug additional debug information to compute the correspondence between source and * compiled elements of the class. May be {@literal null}. */ public void visitSource(final String source, final String debug) { if (cv != null) { cv.visitSource(source, debug); } }
public void visitInnerClass( final String name, final String outerName, final String innerName, final int access) { cv.visitInnerClass(name, outerName, innerName, access); }
public void visitOuterClass( final String owner, final String name, final String desc) { cv.visitOuterClass(owner, name, desc); }
/** * Visits the end of the class. This method, which is the last one to be called, is used to inform * the visitor that all the fields and methods of the class have been visited. */ public void visitEnd() { if (cv != null) { cv.visitEnd(); } } }
/** * Visits a non standard attribute of the class. * * @param attribute an attribute. */ public void visitAttribute(final Attribute attribute) { if (cv != null) { cv.visitAttribute(attribute); } }
/** * Visit the module corresponding to the class. * * @param name the fully qualified name (using dots) of the module. * @param access the module access flags, among {@code ACC_OPEN}, {@code ACC_SYNTHETIC} and {@code * ACC_MANDATED}. * @param version the module version, or {@literal null}. * @return a visitor to visit the module values, or {@literal null} if this visitor is not * interested in visiting this module. */ public ModuleVisitor visitModule(final String name, final int access, final String version) { if (api < Opcodes.ASM6) { throw new UnsupportedOperationException("This feature requires ASM6"); } if (cv != null) { return cv.visitModule(name, access, version); } return null; }
classVisitor.visit( readInt(cpInfoOffsets[1] - 7), accessFlags, thisClass, signature, superClass, interfaces); classVisitor.visitSource(sourceFile, sourceDebugExtension); classVisitor.visitNestHost(nestHostClass); String name = methodIndex == 0 ? null : readUTF8(cpInfoOffsets[methodIndex], charBuffer); String type = methodIndex == 0 ? null : readUTF8(cpInfoOffsets[methodIndex] + 2, charBuffer); classVisitor.visitOuterClass(className, name, type); classVisitor.visitAnnotation(annotationDescriptor, /* visible = */ true), currentAnnotationOffset, /* named = */ true, classVisitor.visitAnnotation(annotationDescriptor, /* visible = */ false), currentAnnotationOffset, /* named = */ true, classVisitor.visitTypeAnnotation( context.currentTypeAnnotationTarget, context.currentTypeAnnotationTargetPath, classVisitor.visitTypeAnnotation( context.currentTypeAnnotationTarget, context.currentTypeAnnotationTargetPath, classVisitor.visitAttribute(attributes); attributes = nextAttribute;
@Override public MethodVisitor visitMethod(final int access, final String name, final String desc, final String signature, final String[] exceptions) { MethodVisitor mv; if ("<clinit>".equals(name)) { int a = Opcodes.ACC_PRIVATE + Opcodes.ACC_STATIC; String n = prefix + counter++; mv = cv.visitMethod(a, n, desc, signature, exceptions); if (clinit == null) { clinit = cv.visitMethod(a, name, desc, null, null); } clinit.visitMethodInsn(Opcodes.INVOKESTATIC, this.name, n, desc, false); } else { mv = cv.visitMethod(access, name, desc, signature, exceptions); } return mv; }
public void visitSource(final String source, final String debug) { cv.visitSource(source, debug); }
/** * Makes the given class visitor visit this inner class. * * @param cv * a class visitor. */ public void accept(final ClassVisitor cv) { cv.visitInnerClass(name, outerName, innerName, access); } }
/** * Visits the enclosing class of the class. This method must be called only if the class has an * enclosing class. * * @param owner internal name of the enclosing class of the class. * @param name the name of the method that contains the class, or {@literal null} if the class is * not enclosed in a method of its enclosing class. * @param descriptor the descriptor of the method that contains the class, or {@literal null} if * the class is not enclosed in a method of its enclosing class. */ public void visitOuterClass(final String owner, final String name, final String descriptor) { if (cv != null) { cv.visitOuterClass(owner, name, descriptor); } }
/** * Visits the end of the class. This method, which is the last one to be * called, is used to inform the visitor that all the fields and methods of * the class have been visited. */ public void visitEnd() { if (cv != null) { cv.visitEnd(); } } }
/** * Visits a non standard attribute of the class. * * @param attr * an attribute. */ public void visitAttribute(Attribute attr) { if (cv != null) { cv.visitAttribute(attr); } }