Fix child annotations not inheriting member name, cleanup
This commit is contained in:
parent
bdd0af5280
commit
a3b1007633
2 changed files with 14 additions and 7 deletions
|
@ -57,10 +57,10 @@ public class ModAnnotation
|
|||
return value;
|
||||
}
|
||||
}
|
||||
ElementType type;
|
||||
Type asmType;
|
||||
String member;
|
||||
Map<String,Object> values = Maps.newHashMap();
|
||||
private final ElementType type;
|
||||
private final Type asmType;
|
||||
private final String member;
|
||||
private final Map<String,Object> values = Maps.newHashMap();
|
||||
|
||||
private ArrayList<Object> arrayList;
|
||||
private String arrayName;
|
||||
|
@ -71,10 +71,17 @@ public class ModAnnotation
|
|||
this.member = member;
|
||||
}
|
||||
|
||||
@Deprecated // TODO 1.16 remove this
|
||||
public ModAnnotation(ElementType type, Type asmType, ModAnnotation parent)
|
||||
{
|
||||
this.type = type;
|
||||
this(asmType, parent);
|
||||
}
|
||||
|
||||
public ModAnnotation(Type asmType, ModAnnotation parent)
|
||||
{
|
||||
this.type = parent.type;
|
||||
this.asmType = asmType;
|
||||
this.member = parent.member;
|
||||
}
|
||||
@Override
|
||||
public String toString()
|
||||
|
@ -132,7 +139,7 @@ public class ModAnnotation
|
|||
}
|
||||
public ModAnnotation addChildAnnotation(String name, String desc)
|
||||
{
|
||||
ModAnnotation child = new ModAnnotation(type, Type.getType(desc), this);
|
||||
ModAnnotation child = new ModAnnotation(Type.getType(desc), this);
|
||||
addProperty(name, child.getValues());
|
||||
return child;
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ public class ModClassVisitor extends ClassVisitor
|
|||
public void buildData(final Set<ModFileScanData.ClassData> classes, final Set<ModFileScanData.AnnotationData> annotations) {
|
||||
classes.add(new ModFileScanData.ClassData(this.asmType, this.asmSuperType, this.interfaces));
|
||||
final List<ModFileScanData.AnnotationData> collect = this.annotations.stream().
|
||||
filter(ma->ModFileScanData.interestingAnnotations().test(ma.asmType)).
|
||||
filter(ma->ModFileScanData.interestingAnnotations().test(ma.getASMType())).
|
||||
map(a -> ModAnnotation.fromModAnnotation(this.asmType, a)).collect(Collectors.toList());
|
||||
annotations.addAll(collect);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue