Class JdkClassWriter
java.lang.Object
org.objectweb.asm.ClassVisitor
codes.rafael.asmjdkbridge.JdkClassWriter
public class JdkClassWriter
extends org.objectweb.asm.ClassVisitor
A class visitor that creates a class file which is based upon the JDK Class File API.
-
Field Summary
Fields inherited from class org.objectweb.asm.ClassVisitor
api, cv -
Constructor Summary
ConstructorsConstructorDescriptionJdkClassWriter(int flags) Creates a class writer.JdkClassWriter(int flags, Method getSuperClass, Object target) Creates a class writer.JdkClassWriter(int flags, Function<String, String> getSuperClass) Creates a class writer.JdkClassWriter(JdkClassReader classReader, int flags) Creates a class writer.JdkClassWriter(JdkClassReader classReader, int flags, Method getSuperClass, Object target) Creates a class writer.JdkClassWriter(JdkClassReader classReader, int flags, Function<String, String> getSuperClass) Creates a class writer. -
Method Summary
Modifier and TypeMethodDescriptionprotected ClassLoaderReturns the class loader to use for resolving the super class of a discovered class.protected StringgetSuperClass(String name) Returns the super class of the class that is provided by name.byte[]Returns the generated class file.voidvisit(int version, int access, String name, String signature, String superName, String[] interfaces) org.objectweb.asm.AnnotationVisitorvisitAnnotation(String descriptor, boolean visible) voidvisitAttribute(org.objectweb.asm.Attribute attribute) voidvisitEnd()org.objectweb.asm.FieldVisitorvisitField(int access, String name, String descriptor, String signature, Object value) voidvisitInnerClass(String name, String outerName, String innerName, int access) org.objectweb.asm.MethodVisitorvisitMethod(int access, String name, String descriptor, String signature, String[] exceptions) org.objectweb.asm.ModuleVisitorvisitModule(String name, int access, String version) voidvisitNestHost(String nestHost) voidvisitNestMember(String nestMember) voidvisitOuterClass(String owner, String name, String descriptor) voidvisitPermittedSubclass(String permittedSubclass) org.objectweb.asm.RecordComponentVisitorvisitRecordComponent(String name, String descriptor, String signature) voidvisitSource(String source, String debug) org.objectweb.asm.AnnotationVisitorvisitTypeAnnotation(int typeRef, org.objectweb.asm.TypePath typePath, String descriptor, boolean visible) Methods inherited from class org.objectweb.asm.ClassVisitor
getDelegate
-
Constructor Details
-
JdkClassWriter
public JdkClassWriter(int flags) Creates a class writer.- Parameters:
flags- The ASM flags to consider.
-
JdkClassWriter
Creates a class writer.- Parameters:
classReader- A class reader of which to retain the constant pool, if possible.flags- The ASM flags to consider.
-
JdkClassWriter
Creates a class writer.- Parameters:
flags- The ASM flags to consider.getSuperClass- A resolver for the supplied internal class name's internal super class name. If a class is an interface,nullshould be returned. As a method to allow pre-Java 8 code to call this constructor via reflection.target- The target to invoke the reflective method on.
-
JdkClassWriter
Creates a class writer.- Parameters:
classReader- A class reader of which to retain the constant pool, if possible.flags- The ASM flags to consider.getSuperClass- A resolver for the supplied internal class name's internal super class name. If a class is an interface,nullshould be returned. As a method to allow pre-Java 8 code to call this constructor via reflection.target- The target to invoke the reflective method on.
-
JdkClassWriter
-
JdkClassWriter
Creates a class writer.- Parameters:
classReader- A class reader of which to retain the constant pool, if possible.flags- The ASM flags to consider.getSuperClass- A resolver for the supplied internal class name's internal super class name. If a class is an interface,nullshould be returned.
-
-
Method Details
-
toByteArray
public byte[] toByteArray()Returns the generated class file.- Returns:
- The class file as a byte array.
-
getSuperClass
Returns the super class of the class that is provided by name. The default implementation resolves the super class from this instance's class'ClassLoader, unlessgetClassLoader()is overridden.This is used for generating stack map frames.
- Parameters:
name- The name of the class for which to resolve the super class.- Returns:
- The name of the resolved super class.
-
getClassLoader
Returns the class loader to use for resolving the super class of a discovered class.- Returns:
- The class loader to use for resolving a super class's name.
-
visit
-
visitSource
-
visitModule
-
visitNestHost
- Overrides:
visitNestHostin classorg.objectweb.asm.ClassVisitor
-
visitOuterClass
-
visitAnnotation
- Overrides:
visitAnnotationin classorg.objectweb.asm.ClassVisitor
-
visitAttribute
public void visitAttribute(org.objectweb.asm.Attribute attribute) - Overrides:
visitAttributein classorg.objectweb.asm.ClassVisitor
-
visitTypeAnnotation
public org.objectweb.asm.AnnotationVisitor visitTypeAnnotation(int typeRef, org.objectweb.asm.TypePath typePath, String descriptor, boolean visible) - Overrides:
visitTypeAnnotationin classorg.objectweb.asm.ClassVisitor
-
visitNestMember
- Overrides:
visitNestMemberin classorg.objectweb.asm.ClassVisitor
-
visitPermittedSubclass
- Overrides:
visitPermittedSubclassin classorg.objectweb.asm.ClassVisitor
-
visitInnerClass
-
visitRecordComponent
-
visitField
-
visitMethod
-
visitEnd
public void visitEnd()- Overrides:
visitEndin classorg.objectweb.asm.ClassVisitor
-