diff --git a/src/main/java/de/dhbwstuttgart/bytecode/utilities/Resolver.java b/src/main/java/de/dhbwstuttgart/bytecode/utilities/Resolver.java index 684fdd4b..035b9710 100644 --- a/src/main/java/de/dhbwstuttgart/bytecode/utilities/Resolver.java +++ b/src/main/java/de/dhbwstuttgart/bytecode/utilities/Resolver.java @@ -26,7 +26,6 @@ public class Resolver { return resultSet.resolveType(type).resolvedType.acceptTV(new TypeToDescriptor()); } - //ToDo Etienne: Check ob benötigt public RefTypeOrTPHOrWildcardOrGeneric resolve(RefTypeOrTPHOrWildcardOrGeneric type) { return resultSet.resolveType(type).resolvedType; } diff --git a/src/test/java/bytecode/funN/FunNGeneratorTest.java b/src/test/java/bytecode/funN/FunNGeneratorTest.java index b1e14cf0..f465a0ff 100644 --- a/src/test/java/bytecode/funN/FunNGeneratorTest.java +++ b/src/test/java/bytecode/funN/FunNGeneratorTest.java @@ -19,13 +19,19 @@ import static org.objectweb.asm.Opcodes.*; public class FunNGeneratorTest { static FunNUtilities funNGenerator; - static RefType voidType = new RefType(new JavaClassName(Type.getInternalName(Void.class)), null); - static RefType integerType = new RefType(new JavaClassName(Type.getInternalName(Integer.class)), null); - static GenericRefType genericT = new GenericRefType("T", null); + static RefType voidType; + static RefType integerType; + static GenericRefType genericT; + static TypePlaceholder tph; @BeforeClass public static void setUp(){ + funNGenerator = FunNGenerator.getInstance(); + voidType = new RefType(new JavaClassName(Type.getInternalName(Void.class)), null); + integerType = new RefType(new JavaClassName(Type.getInternalName(Integer.class)), null); + genericT = new GenericRefType("T", null); + tph = TypePlaceholder.fresh(null); } @Test @@ -82,18 +88,31 @@ public class FunNGeneratorTest { assertEquals("LFun1$$Ljava$lang$Integer$_$LT$_$;", classSignature); } + @Test + public void signature_TPHTPH(){ + var classSignature = funNGenerator.getSpecializedSignature(Arrays.asList(tph), tph); + assertEquals(String.format("LFun1$$LTPH$_$LTPH$_$;",tph.getName(), tph.getName()), classSignature); + } + @Test public void descriptor_IntInt(){ - var classSignature = funNGenerator.getSpecializedDescriptor(Arrays.asList(integerType), integerType); + var classDescriptor = funNGenerator.getSpecializedDescriptor(Arrays.asList(integerType), integerType); //does not have to contain L and ; because TypeToDescriptor returns the descriptor without these characters as well - assertEquals("Fun1$$Ljava$lang$Integer$_$Ljava$lang$Integer$_$", classSignature); + assertEquals("Fun1$$Ljava$lang$Integer$_$Ljava$lang$Integer$_$", classDescriptor); } @Test public void descriptor_IntT(){ - var classSignature = funNGenerator.getSpecializedDescriptor(Arrays.asList(integerType), genericT); + var classDescriptor = funNGenerator.getSpecializedDescriptor(Arrays.asList(integerType), genericT); //does not have to contain L and ; because TypeToDescriptor returns the descriptor without these characters as well - assertEquals("Fun1$$Ljava$lang$Integer$_$LT$_$", classSignature); + assertEquals("Fun1$$Ljava$lang$Integer$_$LT$_$", classDescriptor); + } + + @Test + public void descriptor_TPHTPH(){ + var classDescriptor = funNGenerator.getSpecializedDescriptor(Arrays.asList(tph), tph); + //does not have to contain L and ; because TypeToDescriptor returns the descriptor without these characters as well + assertEquals("Fun1$$LTPH$_$LTPH$_$", classDescriptor); } @Test