Verbesserung, nun werden bei specialized Signaturen und Deskriptoren auch korrekt Generics berücksichtigt.
This commit is contained in:
parent
67df9aa262
commit
cd5fbac987
@ -84,7 +84,7 @@ public final class FunNGenerator implements FunNUtilities{
|
|||||||
//generates a list of all params and substitutes the TPH
|
//generates a list of all params and substitutes the TPH
|
||||||
List<RefTypeOrTPHOrWildcardOrGeneric> parameters = Stream
|
List<RefTypeOrTPHOrWildcardOrGeneric> parameters = Stream
|
||||||
.concat(argumentTypes.stream(), Stream.of(returnType))
|
.concat(argumentTypes.stream(), Stream.of(returnType))
|
||||||
.map(FunNGenerator::substituteTPH)
|
.map(this::substituteTPH)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
RefType superFunN = new RefType(new JavaClassName(getSuperClassName(argumentTypes.size())), parameters , null);
|
RefType superFunN = new RefType(new JavaClassName(getSuperClassName(argumentTypes.size())), parameters , null);
|
||||||
StringBuilder funNClassSignature = new StringBuilder(objectSignature + (superFunN.acceptTV(new TypeToSignature(false))));
|
StringBuilder funNClassSignature = new StringBuilder(objectSignature + (superFunN.acceptTV(new TypeToSignature(false))));
|
||||||
@ -128,14 +128,14 @@ public final class FunNGenerator implements FunNUtilities{
|
|||||||
public String getSpecializedDescriptor(List<RefTypeOrTPHOrWildcardOrGeneric> argumentTypes, RefTypeOrTPHOrWildcardOrGeneric returnType) {
|
public String getSpecializedDescriptor(List<RefTypeOrTPHOrWildcardOrGeneric> argumentTypes, RefTypeOrTPHOrWildcardOrGeneric returnType) {
|
||||||
Objects.requireNonNull(argumentTypes);
|
Objects.requireNonNull(argumentTypes);
|
||||||
Objects.requireNonNull(returnType);
|
Objects.requireNonNull(returnType);
|
||||||
return applyDescriptor(new RefType(new JavaClassName(getSpecializedClassName(argumentTypes, returnType)), null));
|
return applyDescriptor(getSpecializedFunNRefType(argumentTypes, returnType));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getSpecializedSignature(List<RefTypeOrTPHOrWildcardOrGeneric> argumentTypes, RefTypeOrTPHOrWildcardOrGeneric returnType) {
|
public String getSpecializedSignature(List<RefTypeOrTPHOrWildcardOrGeneric> argumentTypes, RefTypeOrTPHOrWildcardOrGeneric returnType) {
|
||||||
Objects.requireNonNull(argumentTypes);
|
Objects.requireNonNull(argumentTypes);
|
||||||
Objects.requireNonNull(returnType);
|
Objects.requireNonNull(returnType);
|
||||||
return applySignature(new RefType(new JavaClassName(getSpecializedClassName(argumentTypes, returnType)), null));
|
return applySignature(getSpecializedFunNRefType(argumentTypes, returnType));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -163,11 +163,17 @@ public final class FunNGenerator implements FunNUtilities{
|
|||||||
*/
|
*/
|
||||||
private String applyNameDescriptor(RefTypeOrTPHOrWildcardOrGeneric a){ return a instanceof TypePlaceholder ? "LTPH;" : String.format("L%s;", applyDescriptor(a)); }
|
private String applyNameDescriptor(RefTypeOrTPHOrWildcardOrGeneric a){ return a instanceof TypePlaceholder ? "LTPH;" : String.format("L%s;", applyDescriptor(a)); }
|
||||||
|
|
||||||
private static RefTypeOrTPHOrWildcardOrGeneric substituteTPH(RefTypeOrTPHOrWildcardOrGeneric t) {
|
private RefTypeOrTPHOrWildcardOrGeneric substituteTPH(RefTypeOrTPHOrWildcardOrGeneric t) {
|
||||||
if (t instanceof TypePlaceholder) {
|
if (t instanceof TypePlaceholder) {
|
||||||
TypePlaceholder tph = (TypePlaceholder) t;
|
TypePlaceholder tph = (TypePlaceholder) t;
|
||||||
return new GenericRefType(tph.getName()+"$", t.getOffset());
|
return new GenericRefType(tph.getName()+"$", t.getOffset());
|
||||||
}
|
}
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
private RefType getSpecializedFunNRefType(List<RefTypeOrTPHOrWildcardOrGeneric> argumentTypes, RefTypeOrTPHOrWildcardOrGeneric returnType){
|
||||||
|
return new RefType(new JavaClassName(getSpecializedClassName(argumentTypes, returnType)),
|
||||||
|
Stream
|
||||||
|
.concat(argumentTypes.stream(), Stream.of(returnType))
|
||||||
|
.collect(Collectors.toList()),null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user