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;
|
return value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ElementType type;
|
private final ElementType type;
|
||||||
Type asmType;
|
private final Type asmType;
|
||||||
String member;
|
private final String member;
|
||||||
Map<String,Object> values = Maps.newHashMap();
|
private final Map<String,Object> values = Maps.newHashMap();
|
||||||
|
|
||||||
private ArrayList<Object> arrayList;
|
private ArrayList<Object> arrayList;
|
||||||
private String arrayName;
|
private String arrayName;
|
||||||
|
@ -71,10 +71,17 @@ public class ModAnnotation
|
||||||
this.member = member;
|
this.member = member;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated // TODO 1.16 remove this
|
||||||
public ModAnnotation(ElementType type, Type asmType, ModAnnotation parent)
|
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.asmType = asmType;
|
||||||
|
this.member = parent.member;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public String toString()
|
public String toString()
|
||||||
|
@ -132,7 +139,7 @@ public class ModAnnotation
|
||||||
}
|
}
|
||||||
public ModAnnotation addChildAnnotation(String name, String desc)
|
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());
|
addProperty(name, child.getValues());
|
||||||
return child;
|
return child;
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,7 @@ public class ModClassVisitor extends ClassVisitor
|
||||||
public void buildData(final Set<ModFileScanData.ClassData> classes, final Set<ModFileScanData.AnnotationData> annotations) {
|
public void buildData(final Set<ModFileScanData.ClassData> classes, final Set<ModFileScanData.AnnotationData> annotations) {
|
||||||
classes.add(new ModFileScanData.ClassData(this.asmType, this.asmSuperType, this.interfaces));
|
classes.add(new ModFileScanData.ClassData(this.asmType, this.asmSuperType, this.interfaces));
|
||||||
final List<ModFileScanData.AnnotationData> collect = this.annotations.stream().
|
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());
|
map(a -> ModAnnotation.fromModAnnotation(this.asmType, a)).collect(Collectors.toList());
|
||||||
annotations.addAll(collect);
|
annotations.addAll(collect);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue