下面列出了org.objectweb.asm.Opcodes# ASM8 ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
private static ClassNode findClassNode(String jarEntryPathName, ImmutableList<Path> jars)
throws IOException, ClassNotFoundException {
for (Path jar : jars) {
JarFile jarFile = new JarFile(jar.toFile());
JarEntry jarEntry = jarFile.getJarEntry(jarEntryPathName);
if (jarEntry != null) {
try (InputStream inputStream = jarFile.getInputStream(jarEntry)) {
ClassReader cr = new ClassReader(inputStream);
ClassNode classNode = new ClassNode(Opcodes.ASM8);
cr.accept(classNode, 0);
return classNode;
}
}
}
throw new ClassNotFoundException(jarEntryPathName);
}
public TryWithResourcesRewriter(
ClassVisitor classVisitor,
ClassLoader classLoader,
Set<String> visitedExceptionTypes,
AtomicInteger numOfTryWithResourcesInvoked,
boolean hasCloseResourceMethod) {
super(Opcodes.ASM8, classVisitor);
this.classLoader = classLoader;
this.visitedExceptionTypes = visitedExceptionTypes;
this.numOfTryWithResourcesInvoked = numOfTryWithResourcesInvoked;
this.hasCloseResourceMethod = hasCloseResourceMethod;
}
NestBridgeRefConverter(
@Nullable MethodVisitor methodVisitor, MethodKey methodKey, NestDigest nestDigest) {
super(Opcodes.ASM8, methodVisitor);
this.enclosingMethodKey = methodKey;
this.nestDigest = nestDigest;
directFieldAccessReplacer = new FieldAccessToBridgeRedirector();
methodToBridgeRedirector = new MethodToBridgeRedirector(nestDigest);
}
public AvoidJacocoInit(MethodVisitor dest) {
super(Opcodes.ASM8, dest);
}
public InterfaceFieldWriteCollector(MethodVisitor mv) {
super(Opcodes.ASM8, mv);
}
public CodeStubber(ClassVisitor cv, ImmutableList<FieldInfo> interfaceFields) {
super(Opcodes.ASM8, cv);
this.interfaceFields = interfaceFields;
}
public LongCompareMethodRewriter(ClassVisitor cv, CoreLibraryRewriter rewriter) {
super(Opcodes.ASM8, cv);
this.rewriter = rewriter;
}
public FieldStringConstantVisitor(String fieldName) {
super(Opcodes.ASM8);
this.fieldName = fieldName;
}
public InterfaceInitializationNecessityDetector(String internalName) {
super(Opcodes.ASM8);
this.internalName = internalName;
}
public InlineMethodBody(MethodVisitor dest) {
// We'll set the destination visitor in visitCode() to reduce the risk of copying anything
// we didn't mean to copy
super(Opcodes.ASM8, (MethodVisitor) null);
this.dest = dest;
}
public ObjectsRequireNonNullMethodRewriter(ClassVisitor cv, CoreLibraryRewriter rewriter) {
super(Opcodes.ASM8, cv);
this.rewriter = rewriter;
}
public InlineOneMethod(String methodName, MethodVisitor dest) {
super(Opcodes.ASM8);
this.methodName = methodName;
this.dest = dest;
}
public MultiplexAnnotations(@Nullable MethodVisitor dest, MethodVisitor annotationOnlyDest) {
super(Opcodes.ASM8, dest);
this.annotationOnlyDest = annotationOnlyDest;
}
public InstanceMethodRecorder(boolean ignoreEmulatedMethods) {
super(Opcodes.ASM8);
this.ignoreEmulatedMethods = ignoreEmulatedMethods;
}
public PrefixReferenceMethodVisitor() {
super(Opcodes.ASM8);
}
BytecodeTypeInference(int access, String owner, String name, String methodDescriptor) {
super(Opcodes.ASM8);
localVariableSlots = createInitialLocalVariableTypes(access, owner, name, methodDescriptor);
previousFrame = FrameInfo.create(ImmutableList.copyOf(localVariableSlots), ImmutableList.of());
this.methodSignature = owner + "." + name + methodDescriptor;
}
public NestDesugaring(ClassVisitor classVisitor, NestDigest nestDigest) {
super(Opcodes.ASM8, classVisitor);
this.nestDigest = nestDigest;
}
public MultiplexAnnotationVisitor(
@Nullable AnnotationVisitor dest, AnnotationVisitor... moreDestinations) {
super(Opcodes.ASM8, dest);
this.moreDestinations = moreDestinations;
}
ClassMemberRetargetMethodVisitor(MethodVisitor visitor) {
super(Opcodes.ASM8, visitor);
}
public PrefixReferenceScanner(String prefix) {
super(Opcodes.ASM8);
this.prefix = prefix;
}