diff --git a/src/main/java/de/dhbwstuttgart/bytecode/utilities/ByteCodeForFunNGenerator.java b/src/main/java/de/dhbwstuttgart/bytecode/utilities/ByteCodeForFunNGenerator.java index db0e0876..127cba5b 100644 --- a/src/main/java/de/dhbwstuttgart/bytecode/utilities/ByteCodeForFunNGenerator.java +++ b/src/main/java/de/dhbwstuttgart/bytecode/utilities/ByteCodeForFunNGenerator.java @@ -99,22 +99,22 @@ public class ByteCodeForFunNGenerator { */ public static boolean generateSuperFunNInterface(int numberOfParameters, File path){ if(alreadyGeneratedFunN.contains(numberOfParameters)) return true; - //ToDo Etienne: Generierung der Signaturen/Deskriptoren vielleicht auslagern? + //ToDo Etienne: Generierung der Signaturen/Deskriptoren vielleicht auslagern? Bzw. schauen ob nicht schon vorhanden und anpassen! String className = String.format("Fun%d$$", numberOfParameters); String classSignature = "<"; String methodSignature = "("; String methodDescriptor = "("; for (int parameter = 1; parameter <= numberOfParameters; parameter++) { - classSignature += String.format("T%d:Ljava/lang/Object;", parameter); + classSignature += String.format("T%d:L%s;", parameter, Type.getInternalName(Object.class)); methodSignature += String.format("TT%d;", parameter); - methodDescriptor += "Ljava/lang/Object;"; + methodDescriptor += String.format("L%s;", Type.getInternalName(Object.class)); } - classSignature += "R:Ljava/lang/Object;>Ljava/lang/Object;"; + classSignature += String.format("R:L%s;>L%s;",Type.getInternalName(Object.class),Type.getInternalName(Object.class)); methodSignature += ")TR;"; - methodDescriptor += ")Ljava/lang/Object;"; + methodDescriptor += String.format(")L%s;",Type.getInternalName(Object.class)); ClassWriter classWriter = new ClassWriter(0); - classWriter.visit(V1_8, ACC_PUBLIC | ACC_ABSTRACT | ACC_INTERFACE, className, classSignature, "java/lang/Object", null); + classWriter.visit(V1_8, ACC_PUBLIC | ACC_ABSTRACT | ACC_INTERFACE, className, classSignature, Type.getInternalName(Object.class), null); MethodVisitor methodVisitor = classWriter.visitMethod(ACC_PUBLIC | ACC_ABSTRACT, "apply", methodDescriptor, methodSignature, null); methodVisitor.visitEnd(); diff --git a/src/main/java/de/dhbwstuttgart/bytecode/utilities/MethodCallHelper.java b/src/main/java/de/dhbwstuttgart/bytecode/utilities/MethodCallHelper.java index 35c56693..6df534d2 100644 --- a/src/main/java/de/dhbwstuttgart/bytecode/utilities/MethodCallHelper.java +++ b/src/main/java/de/dhbwstuttgart/bytecode/utilities/MethodCallHelper.java @@ -225,6 +225,7 @@ public class MethodCallHelper { ByteCodeForFunNGenerator.generateBCForFunN(methCall.arglist,methodDescriptor,path); } + //ToDo Etienne: Für Type Erasure wichtig public String getDescriptorOfApplyMethod(String methodCallType) { return new DescriptorToString().createDescForFunN(methCall.arglist, methodCallType); }