Verbesserung von getSpecializedFunNRefType -> jetzt werden nur noch Generics und TPHs als Parameter übergeben.

Zuvor wurden zu viele Parameter übergeben.
This commit is contained in:
Etienne Zink 2022-04-06 07:41:56 +02:00
parent e2d76d314a
commit 722d897d4b
2 changed files with 4 additions and 2 deletions

View File

@ -174,6 +174,8 @@ public final class FunNGenerator implements FunNUtilities{
return new RefType(new JavaClassName(getSpecializedClassName(argumentTypes, returnType)), return new RefType(new JavaClassName(getSpecializedClassName(argumentTypes, returnType)),
Stream Stream
.concat(argumentTypes.stream(), Stream.of(returnType)) .concat(argumentTypes.stream(), Stream.of(returnType))
.filter(t -> t instanceof GenericRefType ||
t instanceof TypePlaceholder)
.collect(Collectors.toList()),null); .collect(Collectors.toList()),null);
} }
} }

View File

@ -73,13 +73,13 @@ public class FunNGeneratorTest {
@Test @Test
public void signature_IntInt(){ public void signature_IntInt(){
var classSignature = funNGenerator.getSpecializedSignature(Arrays.asList(integerType), integerType); var classSignature = funNGenerator.getSpecializedSignature(Arrays.asList(integerType), integerType);
assertEquals("LFun1$$Ljava$lang$Integer$_$Ljava$lang$Integer$_$<Ljava/lang/Integer;Ljava/lang/Integer;>;", classSignature); assertEquals("LFun1$$Ljava$lang$Integer$_$Ljava$lang$Integer$_$;", classSignature);
} }
@Test @Test
public void signature_IntT(){ public void signature_IntT(){
var classSignature = funNGenerator.getSpecializedSignature(Arrays.asList(integerType), genericT); var classSignature = funNGenerator.getSpecializedSignature(Arrays.asList(integerType), genericT);
assertEquals("LFun1$$Ljava$lang$Integer$_$LT$_$<Ljava/lang/Integer;TT;>;", classSignature); assertEquals("LFun1$$Ljava$lang$Integer$_$LT$_$<TT;>;", classSignature);
} }
@Test @Test