diff --git a/src/main/java/de/dhbwstuttgart/intermediate/types/IntermediateRefType.java b/src/main/java/de/dhbwstuttgart/intermediate/types/IntermediateRefType.java index 81ef371a..d82bbb71 100644 --- a/src/main/java/de/dhbwstuttgart/intermediate/types/IntermediateRefType.java +++ b/src/main/java/de/dhbwstuttgart/intermediate/types/IntermediateRefType.java @@ -13,7 +13,7 @@ import java.util.List; */ public final class IntermediateRefType extends IntermediateInnerType{ - private final List typParameters; + private final List typParameters; private final JavaClassName className; /** @@ -35,7 +35,7 @@ public final class IntermediateRefType extends IntermediateInnerType{ this(className, new ArrayList<>()); } - public IntermediateRefType(JavaClassName className, List typParameters){ + public IntermediateRefType(JavaClassName className, List typParameters){ this.className = className; this.typParameters = Collections.unmodifiableList(typParameters); } diff --git a/src/test/java/intermediate/types/IntermediateGenericTypeTest.java b/src/test/java/intermediate/types/IntermediateGenericTypeTest.java index 3c711c4e..5ab67f3e 100644 --- a/src/test/java/intermediate/types/IntermediateGenericTypeTest.java +++ b/src/test/java/intermediate/types/IntermediateGenericTypeTest.java @@ -7,6 +7,10 @@ import org.junit.BeforeClass; import org.junit.Test; import org.objectweb.asm.Type; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; @@ -33,9 +37,10 @@ public class IntermediateGenericTypeTest { t = new IntermediateGenericType("T"); sExtendsStringSignature = "TS;"; - sExtendsStringDescriptor = "Ljava/lang/String;"; + sExtendsStringDescriptor = "Ljava/util/List;"; sExtendsString = new IntermediateGenericType("S", - new IntermediateRefType(new JavaClassName(Type.getInternalName(String.class)))); + new IntermediateRefType(new JavaClassName(Type.getInternalName(List.class)), + Arrays.asList(new IntermediateRefType(new JavaClassName(Type.getInternalName(Integer.class)))))); rExtendsSSignature = "TR;"; rExtendsSDescriptor = sExtendsStringDescriptor; diff --git a/src/test/java/intermediate/types/IntermediateRefTypeTest.java b/src/test/java/intermediate/types/IntermediateRefTypeTest.java index bc287a78..fdcca7e2 100644 --- a/src/test/java/intermediate/types/IntermediateRefTypeTest.java +++ b/src/test/java/intermediate/types/IntermediateRefTypeTest.java @@ -1,5 +1,6 @@ package intermediate.types; +import de.dhbwstuttgart.intermediate.types.IntermediateGenericType; import de.dhbwstuttgart.intermediate.types.IntermediateRefType; import de.dhbwstuttgart.parser.scope.JavaClassName; @@ -23,6 +24,10 @@ public class IntermediateRefTypeTest { private static String listOfIntegerDescriptor; private static IntermediateRefType typeToTest_ListOfInteger; + private static String listOfTSignature; + private static String listOfTDescriptor; + private static IntermediateRefType typeToTest_ListOfT; + private static String voidSignature; private static String voidDescriptor; private static IntermediateRefType typeToTest_void; @@ -41,6 +46,12 @@ public class IntermediateRefTypeTest { new JavaClassName(Type.getInternalName(List.class)), Arrays.asList(typeToTest_Integer)); + listOfTSignature = "Ljava/util/List;"; + listOfTDescriptor = "Ljava/util/List;"; + typeToTest_ListOfT = new IntermediateRefType( + new JavaClassName(Type.getInternalName(List.class)), + Arrays.asList(new IntermediateGenericType("T"))); + voidSignature = "V"; voidDescriptor = "V"; typeToTest_void = new IntermediateRefType(new JavaClassName("void")); @@ -66,6 +77,12 @@ public class IntermediateRefTypeTest { @Test public void DescriptorTest_List(){ assertEquals(listOfIntegerDescriptor, typeToTest_ListOfInteger.getDescriptor()); } + @Test + public void SignatureTest_ListT(){ assertEquals(listOfTSignature, typeToTest_ListOfT.getSignature()); } + + @Test + public void DescriptorTest_ListT(){ assertEquals(listOfTDescriptor, typeToTest_ListOfT.getDescriptor()); } + @Test public void SignatureTest_Void(){ assertEquals(voidSignature, typeToTest_void.getSignature());