diff --git a/src/main/java/de/dhbwstuttgart/bytecode/BytecodeGenMethod.java b/src/main/java/de/dhbwstuttgart/bytecode/BytecodeGenMethod.java index 0565d933..9dc64b73 100644 --- a/src/main/java/de/dhbwstuttgart/bytecode/BytecodeGenMethod.java +++ b/src/main/java/de/dhbwstuttgart/bytecode/BytecodeGenMethod.java @@ -584,6 +584,7 @@ public class BytecodeGenMethod implements StatementVisitor { } } + //ToDo Etienne: Für Type Erasure relevant?! @Override public void visit(LambdaExpression lambdaExpression) { this.lamCounter++; @@ -653,6 +654,7 @@ public class BytecodeGenMethod implements StatementVisitor { // generateBCForFunN(lambdaExpression, typeErasure); } + //ToDo Etienne: Relevant?! private String addUsedVarsToDesugaredMethodDescriptor(String lamDesc) { String newDesc = "("; int pos = 0; @@ -674,6 +676,7 @@ public class BytecodeGenMethod implements StatementVisitor { } } + //ToDo Etienne: Relevant?! private String createDescriptorWithTypeErasure(LambdaExpression lambdaExpression) { String typeErasure = "("; Iterator itr = lambdaExpression.params.iterator(); @@ -811,6 +814,7 @@ public class BytecodeGenMethod implements StatementVisitor { } catch (NotInCurrentPackageException | NotFoundException e) { e.printStackTrace(); } + //ToDo Etienne: Für Type Erasure wichtig?! } else if(!helper.isInCurrPkg(clazz)){ if(clazz.contains(CONSTANTS.$$)) { mDesc = helper.getDescriptorOfApplyMethod(methCallType); @@ -899,6 +903,7 @@ public class BytecodeGenMethod implements StatementVisitor { } } + //ToDo Etienne: Für Type Erasure wichtig?! private void visitInvokeInsn(MethodCall methodCall, String receiverName, java.lang.reflect.Method methodRefl, String clazz, String mDesc, String receiverRefl) { // is methodCall.receiver functional Interface)? if (varsFunInterface.contains(methodCall.receiver.getType()) || (methodRefl!= null && receiverRefl.contains("interface")) || diff --git a/src/main/java/de/dhbwstuttgart/bytecode/descriptor/DescriptorToString.java b/src/main/java/de/dhbwstuttgart/bytecode/descriptor/DescriptorToString.java index 90064863..94e4eb4e 100644 --- a/src/main/java/de/dhbwstuttgart/bytecode/descriptor/DescriptorToString.java +++ b/src/main/java/de/dhbwstuttgart/bytecode/descriptor/DescriptorToString.java @@ -207,7 +207,7 @@ public class DescriptorToString implements DescriptorVisitor, CONSTANTS { String desc = "("; for(Expression e : methodFromMethodCall.getArgList().getArguments()) { String d = resultSet.resolveType(e.getType()).resolvedType.acceptTV(new TypeToDescriptor()); - + //ToDo Etienne: Ändern von $$ nötig für TypeErasure? if(d.contains(CONSTANTS.TPH) ||d.contains(CONSTANTS.ANGLEBRACKET) || methodFromMethodCall.getReceiverName().contains("$$")) { desc += "L"+Type.getInternalName(Object.class)+ ";"; }else { @@ -225,6 +225,7 @@ public class DescriptorToString implements DescriptorVisitor, CONSTANTS { System.out.println("DescriptorToString retType = " + retType); if(retType.equals(CONSTANTS.VOID)) { desc += ")V"; + //ToDo Etienne: Ändern von $$ nötig für TypeErasure? }else if(retType.contains(CONSTANTS.TPH)|| retType.contains(CONSTANTS.ANGLEBRACKET) || methodFromMethodCall.getReceiverName().contains("$$")){ desc += ")L"+Type.getInternalName(Object.class)+ ";"; }else { @@ -240,6 +241,7 @@ public class DescriptorToString implements DescriptorVisitor, CONSTANTS { return desc; } + //ToDo Etienne: Ändern für TypeErasure @Override public String createDescForFunN(ArgumentList argumentList, String returnType) { Iterator itr1 = argumentList.getArguments().iterator(); diff --git a/src/main/java/de/dhbwstuttgart/bytecode/descriptor/DescriptorVisitor.java b/src/main/java/de/dhbwstuttgart/bytecode/descriptor/DescriptorVisitor.java index d1576c76..e6a8565b 100644 --- a/src/main/java/de/dhbwstuttgart/bytecode/descriptor/DescriptorVisitor.java +++ b/src/main/java/de/dhbwstuttgart/bytecode/descriptor/DescriptorVisitor.java @@ -11,7 +11,9 @@ public interface DescriptorVisitor { String visit(NormalMethod method); String visit(NormalConstructor constructor); String visit(Lambda lambdaExpression); + //ToDo Etienne: Was ist SamMethod? String visit(SamMethod samMethod); + //ToDo Etienne: Was ist MethodFromMethodCall? String visit(MethodFromMethodCall methodFromMethodCall); String createDescForFunN(ArgumentList argumentList, String returnType); } diff --git a/src/main/java/de/dhbwstuttgart/bytecode/signature/Signature.java b/src/main/java/de/dhbwstuttgart/bytecode/signature/Signature.java index 47254170..3855b7d4 100644 --- a/src/main/java/de/dhbwstuttgart/bytecode/signature/Signature.java +++ b/src/main/java/de/dhbwstuttgart/bytecode/signature/Signature.java @@ -136,6 +136,7 @@ public class Signature { defineGenericsFromConstraints(constraints,genericsAndBoundsMethod); } + //ToDo Etienne: für TypeErasure anschauen private void createSignatureForFunN(int numberOfParams, String to, String[] paramTypes) { defineTypeVariablesForParametersOfFunN(numberOfParams); @@ -147,6 +148,7 @@ public class Signature { } + //ToDo Etienne: für TypeErasure anschauen private void createSignatureForFunN(int numberOfParams) { defineTypeVariablesForParametersOfFunN(numberOfParams); diff --git a/src/main/java/de/dhbwstuttgart/bytecode/utilities/ByteCodeForFunNGenerator.java b/src/main/java/de/dhbwstuttgart/bytecode/utilities/ByteCodeForFunNGenerator.java index 24b5f627..2ab3633d 100644 --- a/src/main/java/de/dhbwstuttgart/bytecode/utilities/ByteCodeForFunNGenerator.java +++ b/src/main/java/de/dhbwstuttgart/bytecode/utilities/ByteCodeForFunNGenerator.java @@ -18,6 +18,7 @@ import java.io.FileOutputStream; import java.io.IOException; import java.util.Iterator; +//ToDo Etienne: Anpassung für TypeErasure public class ByteCodeForFunNGenerator { public static void generateBCForFunN(LambdaExpression lambdaExpression, String methDesc, File path) { diff --git a/src/main/java/de/dhbwstuttgart/bytecode/utilities/MethodCallHelper.java b/src/main/java/de/dhbwstuttgart/bytecode/utilities/MethodCallHelper.java index ad3e28fa..35c56693 100644 --- a/src/main/java/de/dhbwstuttgart/bytecode/utilities/MethodCallHelper.java +++ b/src/main/java/de/dhbwstuttgart/bytecode/utilities/MethodCallHelper.java @@ -220,6 +220,7 @@ public class MethodCallHelper { } } + //ToDo Etienne: Für Type Erasure wichtig?! public void generateBCForFunN(String methodDescriptor) { ByteCodeForFunNGenerator.generateBCForFunN(methCall.arglist,methodDescriptor,path); } diff --git a/src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java b/src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java index eb220f4f..c178ae45 100644 --- a/src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java +++ b/src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java @@ -884,6 +884,7 @@ public class JavaTXCompiler { return result; } + //ToDo Etienne: Für Type Erasure wichtig?! (alle generatedBytecode-Methoden?) public void generateBytecode() throws ClassNotFoundException, IOException, BytecodeGeneratorError { generateBytecode((File) null); } diff --git a/src/main/java/de/dhbwstuttgart/syntaxtree/type/WildcardType.java b/src/main/java/de/dhbwstuttgart/syntaxtree/type/WildcardType.java index 208138b6..5637cbe8 100644 --- a/src/main/java/de/dhbwstuttgart/syntaxtree/type/WildcardType.java +++ b/src/main/java/de/dhbwstuttgart/syntaxtree/type/WildcardType.java @@ -9,6 +9,7 @@ import org.antlr.v4.runtime.Token; * */ +//ToDo Etienne: Wieso abstrakte Klasse? -> Dadurch keine Inferenz mit ? möglich! public abstract class WildcardType extends RefTypeOrTPHOrWildcardOrGeneric { protected RefTypeOrTPHOrWildcardOrGeneric innerType = null;