Hinzufpgen von Signatur- und Descriptor-Tests für TPHs als Typargumente in Funktionstypen.
This commit is contained in:
parent
722d897d4b
commit
a0367d5464
@ -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;
|
||||
}
|
||||
|
@ -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$_$<TT;>;", classSignature);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void signature_TPHTPH(){
|
||||
var classSignature = funNGenerator.getSpecializedSignature(Arrays.asList(tph), tph);
|
||||
assertEquals(String.format("LFun1$$LTPH$_$LTPH$_$<T%s$;T%s$;>;",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
|
||||
|
Loading…
Reference in New Issue
Block a user