ASM doesn't like empty generics for some reason, don't know if valid?

This commit is contained in:
Victorious3 2023-04-19 16:12:24 +02:00
parent a0c25a517d
commit d945947362
3 changed files with 15 additions and 10 deletions

View File

@ -1044,11 +1044,14 @@ public class Codegen {
}
private static String generateSignature(TargetClass clazz, Set<TargetGeneric> generics) {
String ret = "<";
String ret = "";
if (generics.size() > 0) {
ret += "<";
for (var generic : generics) {
ret += generic.name() + ":" + generic.bound().toDescriptor();
}
ret += ">";
}
ret += clazz.superType().toDescriptor();
return ret;

View File

@ -48,7 +48,6 @@ public class ASTFactory {
if (classLoader != null) {
var bytes = IOUtils.toByteArray(Objects.requireNonNull(classLoader.getResourceAsStream(path)));
var classReader = new ClassReader(bytes);
var classVisitor = new ClassVisitor(Opcodes.ASM7) {
String classSignature;
@Override
@ -300,7 +299,6 @@ public class ASTFactory {
var sr = new SignatureReader(signature);
sr.accept(signatureVisitor);
System.out.println(signature);
return new GenericDeclarationList(gtvs, new NullToken());
}

View File

@ -22,11 +22,15 @@ public record TargetMethod(int access, String name, TargetBlock block, Signature
}
public static String getSignature(Set<TargetGeneric> generics, List<MethodParameter> parameters, TargetType returnType) {
String ret = "<";
String ret = "";
if (generics.size() > 0) {
ret += "<";
for (var generic : generics) {
ret += generic.name() + ":" + generic.bound().toDescriptor();
}
ret += ">(";
ret += ">";
}
ret += "(";
for (var param : parameters) {
ret += param.type().toDescriptor();
}