diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/asm/NodeUtils.java b/LaunchServer/src/main/java/pro/gravit/launchserver/asm/NodeUtils.java index e47c970e..90ed2754 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/asm/NodeUtils.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/asm/NodeUtils.java @@ -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 annots(String clazz, String method, ClassMetadataReader r) { - List 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 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) {