forked from JavaTX/JavaCompilerCore
Verbesserung des spezialisierten Namens von FunN$$.
Nun steht zwischen $$ und den Attributen ein $_$, welches zuvor vergessen wurde.
This commit is contained in:
parent
5071406b3f
commit
669c778af8
@ -113,7 +113,7 @@ public final class FunNGenerator implements FunNUtilities{
|
||||
public String getSpecializedClassName(List<RefTypeOrTPHOrWildcardOrGeneric> argumentTypes, RefTypeOrTPHOrWildcardOrGeneric returnType) {
|
||||
Objects.requireNonNull(argumentTypes);
|
||||
Objects.requireNonNull(returnType);
|
||||
return String.format("Fun%d$$%s%s",
|
||||
return String.format("Fun%d$$$_$%s%s",
|
||||
argumentTypes.size(),
|
||||
argumentTypes
|
||||
.stream()
|
||||
|
@ -38,10 +38,10 @@ public class OLFun2Test {
|
||||
compiler.generateBytecode(generatedByteCodeDirectory);
|
||||
loader = new URLClassLoader(new URL[] {new URL("file://"+generatedByteCodeDirectory)});
|
||||
classToTest = loader.loadClass("OLFun2");
|
||||
classFun1IntInt = loader.loadClass("Fun1$$Ljava$lang$Integer$_$Ljava$lang$Integer$_$");
|
||||
classFun1IntDouble = loader.loadClass("Fun1$$Ljava$lang$Integer$_$Ljava$lang$Double$_$");
|
||||
classFun1DoubleDouble = loader.loadClass("Fun1$$Ljava$lang$Double$_$Ljava$lang$Double$_$");
|
||||
classFun1DoubleInt = loader.loadClass("Fun1$$Ljava$lang$Double$_$Ljava$lang$Integer$_$");
|
||||
classFun1IntInt = loader.loadClass("Fun1$$$_$Ljava$lang$Integer$_$Ljava$lang$Integer$_$");
|
||||
classFun1IntDouble = loader.loadClass("Fun1$$$_$Ljava$lang$Integer$_$Ljava$lang$Double$_$");
|
||||
classFun1DoubleDouble = loader.loadClass("Fun1$$$_$Ljava$lang$Double$_$Ljava$lang$Double$_$");
|
||||
classFun1DoubleInt = loader.loadClass("Fun1$$$_$Ljava$lang$Double$_$Ljava$lang$Integer$_$");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -40,12 +40,12 @@ public class OLFunTest {
|
||||
compiler.generateBytecode(generatedByteCodeDirectory);
|
||||
loader = new URLClassLoader(new URL[] {new URL("file://"+generatedByteCodeDirectory)});
|
||||
classToTest = loader.loadClass("OLFun");
|
||||
classFun1IntInt = loader.loadClass("Fun1$$Ljava$lang$Integer$_$Ljava$lang$Integer$_$");
|
||||
classFun1IntDouble = loader.loadClass("Fun1$$Ljava$lang$Integer$_$Ljava$lang$Double$_$");
|
||||
classFun1DoubleDouble = loader.loadClass("Fun1$$Ljava$lang$Double$_$Ljava$lang$Double$_$");
|
||||
classFun1DoubleInt = loader.loadClass("Fun1$$Ljava$lang$Double$_$Ljava$lang$Integer$_$");
|
||||
classFun1StringInt = loader.loadClass("Fun1$$Ljava$lang$String$_$Ljava$lang$Integer$_$");
|
||||
classFun1StringDouble = loader.loadClass("Fun1$$Ljava$lang$String$_$Ljava$lang$Double$_$");
|
||||
classFun1IntInt = loader.loadClass("Fun1$$$_$Ljava$lang$Integer$_$Ljava$lang$Integer$_$");
|
||||
classFun1IntDouble = loader.loadClass("Fun1$$$_$Ljava$lang$Integer$_$Ljava$lang$Double$_$");
|
||||
classFun1DoubleDouble = loader.loadClass("Fun1$$$_$Ljava$lang$Double$_$Ljava$lang$Double$_$");
|
||||
classFun1DoubleInt = loader.loadClass("Fun1$$$_$Ljava$lang$Double$_$Ljava$lang$Integer$_$");
|
||||
classFun1StringInt = loader.loadClass("Fun1$$$_$Ljava$lang$String$_$Ljava$lang$Integer$_$");
|
||||
classFun1StringDouble = loader.loadClass("Fun1$$$_$Ljava$lang$String$_$Ljava$lang$Double$_$");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -49,70 +49,70 @@ public class FunNGeneratorTest {
|
||||
@Test
|
||||
public void specializedClassName_VoidVoid(){
|
||||
var specializedClassName = funNGenerator.getSpecializedClassName(Arrays.asList(), voidType);
|
||||
assertEquals("Fun0$$Ljava$lang$Void$_$", specializedClassName);
|
||||
assertEquals("Fun0$$$_$Ljava$lang$Void$_$", specializedClassName);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void specializedClassName_VoidInt(){
|
||||
var specializedClassName = funNGenerator.getSpecializedClassName(Arrays.asList(), integerType);
|
||||
assertEquals("Fun0$$Ljava$lang$Integer$_$", specializedClassName);
|
||||
assertEquals("Fun0$$$_$Ljava$lang$Integer$_$", specializedClassName);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void specializedClassName_IntInt(){
|
||||
var specializedClassName = funNGenerator.getSpecializedClassName(Arrays.asList(integerType), integerType);
|
||||
assertEquals("Fun1$$Ljava$lang$Integer$_$Ljava$lang$Integer$_$", specializedClassName);
|
||||
assertEquals("Fun1$$$_$Ljava$lang$Integer$_$Ljava$lang$Integer$_$", specializedClassName);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void specializedClassName_IntT(){
|
||||
var specializedClassName = funNGenerator.getSpecializedClassName(Arrays.asList(integerType), genericT);
|
||||
assertEquals("Fun1$$Ljava$lang$Integer$_$LT$_$", specializedClassName);
|
||||
assertEquals("Fun1$$$_$Ljava$lang$Integer$_$LT$_$", specializedClassName);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void specializedClassName_IntTPH(){
|
||||
var specializedClassName = funNGenerator.getSpecializedClassName(Arrays.asList(integerType), TypePlaceholder.fresh(null));
|
||||
assertEquals("Fun1$$Ljava$lang$Integer$_$LTPH$_$", specializedClassName);
|
||||
assertEquals("Fun1$$$_$Ljava$lang$Integer$_$LTPH$_$", specializedClassName);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void signature_IntInt(){
|
||||
var classSignature = funNGenerator.getSpecializedSignature(Arrays.asList(integerType), integerType);
|
||||
assertEquals("LFun1$$Ljava$lang$Integer$_$Ljava$lang$Integer$_$;", classSignature);
|
||||
assertEquals("LFun1$$$_$Ljava$lang$Integer$_$Ljava$lang$Integer$_$;", classSignature);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void signature_IntT(){
|
||||
var classSignature = funNGenerator.getSpecializedSignature(Arrays.asList(integerType), genericT);
|
||||
assertEquals("LFun1$$Ljava$lang$Integer$_$LT$_$<TT;>;", classSignature);
|
||||
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);
|
||||
assertEquals(String.format("LFun1$$$_$LTPH$_$LTPH$_$<T%s$;T%s$;>;",tph.getName(), tph.getName()), classSignature);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void descriptor_IntInt(){
|
||||
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$_$", classDescriptor);
|
||||
assertEquals("Fun1$$$_$Ljava$lang$Integer$_$Ljava$lang$Integer$_$", classDescriptor);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void descriptor_IntT(){
|
||||
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$_$", classDescriptor);
|
||||
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);
|
||||
assertEquals("Fun1$$$_$LTPH$_$LTPH$_$", classDescriptor);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -227,21 +227,21 @@ public class FunNGeneratorTest {
|
||||
//specialized bytecode reference methods
|
||||
private static byte[] specializedBytecodeReference_VoidInt() {
|
||||
ClassWriter classWriter = new ClassWriter(0);
|
||||
classWriter.visit(V1_8, ACC_PUBLIC | ACC_ABSTRACT | ACC_INTERFACE, "Fun0$$Ljava$lang$Integer$_$", "Ljava/lang/Object;LFun0$$<Ljava/lang/Integer;>;", "java/lang/Object", new String[]{"Fun0$$"});
|
||||
classWriter.visit(V1_8, ACC_PUBLIC | ACC_ABSTRACT | ACC_INTERFACE, "Fun0$$$_$Ljava$lang$Integer$_$", "Ljava/lang/Object;LFun0$$<Ljava/lang/Integer;>;", "java/lang/Object", new String[]{"Fun0$$"});
|
||||
classWriter.visitEnd();
|
||||
return classWriter.toByteArray();
|
||||
}
|
||||
|
||||
private static byte[] specializedBytecodeReference_IntInt() {
|
||||
ClassWriter classWriter = new ClassWriter(0);
|
||||
classWriter.visit(V1_8, ACC_PUBLIC | ACC_ABSTRACT | ACC_INTERFACE, "Fun1$$Ljava$lang$Integer$_$Ljava$lang$Integer$_$", "Ljava/lang/Object;LFun1$$<Ljava/lang/Integer;Ljava/lang/Integer;>;", "java/lang/Object", new String[]{"Fun1$$"});
|
||||
classWriter.visit(V1_8, ACC_PUBLIC | ACC_ABSTRACT | ACC_INTERFACE, "Fun1$$$_$Ljava$lang$Integer$_$Ljava$lang$Integer$_$", "Ljava/lang/Object;LFun1$$<Ljava/lang/Integer;Ljava/lang/Integer;>;", "java/lang/Object", new String[]{"Fun1$$"});
|
||||
classWriter.visitEnd();
|
||||
return classWriter.toByteArray();
|
||||
}
|
||||
|
||||
private static byte[] specializedBytecodeReference_TIntInt() {
|
||||
ClassWriter classWriter = new ClassWriter(0);
|
||||
classWriter.visit(V1_8, ACC_PUBLIC | ACC_ABSTRACT | ACC_INTERFACE, "Fun2$$LT$_$Ljava$lang$Integer$_$Ljava$lang$Integer$_$", "<T:Ljava/lang/Object;>Ljava/lang/Object;LFun2$$<TT;Ljava/lang/Integer;Ljava/lang/Integer;>;", "java/lang/Object", new String[]{"Fun2$$"});
|
||||
classWriter.visit(V1_8, ACC_PUBLIC | ACC_ABSTRACT | ACC_INTERFACE, "Fun2$$$_$LT$_$Ljava$lang$Integer$_$Ljava$lang$Integer$_$", "<T:Ljava/lang/Object;>Ljava/lang/Object;LFun2$$<TT;Ljava/lang/Integer;Ljava/lang/Integer;>;", "java/lang/Object", new String[]{"Fun2$$"});
|
||||
classWriter.visitEnd();
|
||||
return classWriter.toByteArray();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user