diff --git a/src/main/java/de/dhbwstuttgart/bytecode/Codegen.java b/src/main/java/de/dhbwstuttgart/bytecode/Codegen.java index 8a22fd92..34dcd929 100644 --- a/src/main/java/de/dhbwstuttgart/bytecode/Codegen.java +++ b/src/main/java/de/dhbwstuttgart/bytecode/Codegen.java @@ -1044,11 +1044,14 @@ public class Codegen { } private static String generateSignature(TargetClass clazz, Set generics) { - String ret = "<"; - for (var generic : generics) { - ret += generic.name() + ":" + generic.bound().toDescriptor(); + String ret = ""; + if (generics.size() > 0) { + ret += "<"; + for (var generic : generics) { + ret += generic.name() + ":" + generic.bound().toDescriptor(); + } + ret += ">"; } - ret += ">"; ret += clazz.superType().toDescriptor(); return ret; diff --git a/src/main/java/de/dhbwstuttgart/syntaxtree/factory/ASTFactory.java b/src/main/java/de/dhbwstuttgart/syntaxtree/factory/ASTFactory.java index 82d76983..7582865d 100644 --- a/src/main/java/de/dhbwstuttgart/syntaxtree/factory/ASTFactory.java +++ b/src/main/java/de/dhbwstuttgart/syntaxtree/factory/ASTFactory.java @@ -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()); } diff --git a/src/main/java/de/dhbwstuttgart/target/tree/TargetMethod.java b/src/main/java/de/dhbwstuttgart/target/tree/TargetMethod.java index b81547f6..7439675a 100644 --- a/src/main/java/de/dhbwstuttgart/target/tree/TargetMethod.java +++ b/src/main/java/de/dhbwstuttgart/target/tree/TargetMethod.java @@ -22,11 +22,15 @@ public record TargetMethod(int access, String name, TargetBlock block, Signature } public static String getSignature(Set generics, List parameters, TargetType returnType) { - String ret = "<"; - for (var generic : generics) { - ret += generic.name() + ":" + generic.bound().toDescriptor(); + 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(); }