[FIX] Ещё баги в asm.

This commit is contained in:
Zaxar163 2019-09-17 18:14:32 +02:00
parent 3441fc21a7
commit 5de7eedc35
No known key found for this signature in database
GPG key ID: 1FE4F2E1F053831B

View file

@ -3,6 +3,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.objectweb.asm.ClassReader;
@ -42,6 +43,8 @@ public static ClassNode forClass(String clazz, int flags, ClassMetadataReader r)
}
public static List<AnnotationNode> annots(String clazz, String method, ClassMetadataReader r) {
if (clazz.startsWith("L")) clazz = Type.getType(clazz).getInternalName();
try {
List<AnnotationNode> ret = new ArrayList<>();
ClassNode n = forClass(clazz, ClassReader.SKIP_CODE | ClassReader.SKIP_DEBUG, r);
if (n.visibleAnnotations != null) ret.addAll(n.visibleAnnotations);
@ -52,6 +55,9 @@ public static List<AnnotationNode> annots(String clazz, String method, ClassMeta
if (m.invisibleAnnotations != null) ret.addAll(m.invisibleAnnotations);
}
return ret;
} catch (Throwable e) {
return Collections.emptyList();
}
}
private static int doMethodEmulation(String desc) {