mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-31 20:59:54 +03:00
[FIX] Ещё баги в asm.
This commit is contained in:
parent
3441fc21a7
commit
5de7eedc35
1 changed files with 16 additions and 10 deletions
|
@ -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,16 +43,21 @@ public static ClassNode forClass(String clazz, int flags, ClassMetadataReader r)
|
|||
}
|
||||
|
||||
public static List<AnnotationNode> annots(String clazz, String method, ClassMetadataReader r) {
|
||||
List<AnnotationNode> ret = new ArrayList<>();
|
||||
ClassNode n = forClass(clazz, ClassReader.SKIP_CODE | ClassReader.SKIP_DEBUG, r);
|
||||
if (n.visibleAnnotations != null) ret.addAll(n.visibleAnnotations);
|
||||
if (n.invisibleAnnotations != null) ret.addAll(n.invisibleAnnotations);
|
||||
for (MethodNode m : n.methods)
|
||||
if (method.equals(m.name)) {
|
||||
if (m.visibleAnnotations != null) ret.addAll(m.visibleAnnotations);
|
||||
if (m.invisibleAnnotations != null) ret.addAll(m.invisibleAnnotations);
|
||||
}
|
||||
return ret;
|
||||
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);
|
||||
if (n.invisibleAnnotations != null) ret.addAll(n.invisibleAnnotations);
|
||||
for (MethodNode m : n.methods)
|
||||
if (method.equals(m.name)) {
|
||||
if (m.visibleAnnotations != null) ret.addAll(m.visibleAnnotations);
|
||||
if (m.invisibleAnnotations != null) ret.addAll(m.invisibleAnnotations);
|
||||
}
|
||||
return ret;
|
||||
} catch (Throwable e) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
private static int doMethodEmulation(String desc) {
|
||||
|
|
Loading…
Reference in a new issue