[FIX] Annots может быть null

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

View file

@ -44,12 +44,12 @@ 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);
ret.addAll(n.visibleAnnotations);
ret.addAll(n.invisibleAnnotations);
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)) {
ret.addAll(n.visibleAnnotations);
ret.addAll(n.invisibleAnnotations);
if (m.visibleAnnotations != null) ret.addAll(m.visibleAnnotations);
if (m.invisibleAnnotations != null) ret.addAll(m.invisibleAnnotations);
}
return ret;
}