ToDos an wichtigen Stellen zu Betrachtung angebracht.
This commit is contained in:
parent
0aab2d9f53
commit
7eaddd67a3
@ -584,6 +584,7 @@ public class BytecodeGenMethod implements StatementVisitor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//ToDo Etienne: Für Type Erasure relevant?!
|
||||||
@Override
|
@Override
|
||||||
public void visit(LambdaExpression lambdaExpression) {
|
public void visit(LambdaExpression lambdaExpression) {
|
||||||
this.lamCounter++;
|
this.lamCounter++;
|
||||||
@ -653,6 +654,7 @@ public class BytecodeGenMethod implements StatementVisitor {
|
|||||||
// generateBCForFunN(lambdaExpression, typeErasure);
|
// generateBCForFunN(lambdaExpression, typeErasure);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//ToDo Etienne: Relevant?!
|
||||||
private String addUsedVarsToDesugaredMethodDescriptor(String lamDesc) {
|
private String addUsedVarsToDesugaredMethodDescriptor(String lamDesc) {
|
||||||
String newDesc = "(";
|
String newDesc = "(";
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
@ -674,6 +676,7 @@ public class BytecodeGenMethod implements StatementVisitor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//ToDo Etienne: Relevant?!
|
||||||
private String createDescriptorWithTypeErasure(LambdaExpression lambdaExpression) {
|
private String createDescriptorWithTypeErasure(LambdaExpression lambdaExpression) {
|
||||||
String typeErasure = "(";
|
String typeErasure = "(";
|
||||||
Iterator<FormalParameter> itr = lambdaExpression.params.iterator();
|
Iterator<FormalParameter> itr = lambdaExpression.params.iterator();
|
||||||
@ -811,6 +814,7 @@ public class BytecodeGenMethod implements StatementVisitor {
|
|||||||
} catch (NotInCurrentPackageException | NotFoundException e) {
|
} catch (NotInCurrentPackageException | NotFoundException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
//ToDo Etienne: Für Type Erasure wichtig?!
|
||||||
} else if(!helper.isInCurrPkg(clazz)){
|
} else if(!helper.isInCurrPkg(clazz)){
|
||||||
if(clazz.contains(CONSTANTS.$$)) {
|
if(clazz.contains(CONSTANTS.$$)) {
|
||||||
mDesc = helper.getDescriptorOfApplyMethod(methCallType);
|
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) {
|
private void visitInvokeInsn(MethodCall methodCall, String receiverName, java.lang.reflect.Method methodRefl, String clazz, String mDesc, String receiverRefl) {
|
||||||
// is methodCall.receiver functional Interface)?
|
// is methodCall.receiver functional Interface)?
|
||||||
if (varsFunInterface.contains(methodCall.receiver.getType()) || (methodRefl!= null && receiverRefl.contains("interface")) ||
|
if (varsFunInterface.contains(methodCall.receiver.getType()) || (methodRefl!= null && receiverRefl.contains("interface")) ||
|
||||||
|
@ -207,7 +207,7 @@ public class DescriptorToString implements DescriptorVisitor, CONSTANTS {
|
|||||||
String desc = "(";
|
String desc = "(";
|
||||||
for(Expression e : methodFromMethodCall.getArgList().getArguments()) {
|
for(Expression e : methodFromMethodCall.getArgList().getArguments()) {
|
||||||
String d = resultSet.resolveType(e.getType()).resolvedType.acceptTV(new TypeToDescriptor());
|
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("$$")) {
|
if(d.contains(CONSTANTS.TPH) ||d.contains(CONSTANTS.ANGLEBRACKET) || methodFromMethodCall.getReceiverName().contains("$$")) {
|
||||||
desc += "L"+Type.getInternalName(Object.class)+ ";";
|
desc += "L"+Type.getInternalName(Object.class)+ ";";
|
||||||
}else {
|
}else {
|
||||||
@ -225,6 +225,7 @@ public class DescriptorToString implements DescriptorVisitor, CONSTANTS {
|
|||||||
System.out.println("DescriptorToString retType = " + retType);
|
System.out.println("DescriptorToString retType = " + retType);
|
||||||
if(retType.equals(CONSTANTS.VOID)) {
|
if(retType.equals(CONSTANTS.VOID)) {
|
||||||
desc += ")V";
|
desc += ")V";
|
||||||
|
//ToDo Etienne: Ändern von $$ nötig für TypeErasure?
|
||||||
}else if(retType.contains(CONSTANTS.TPH)|| retType.contains(CONSTANTS.ANGLEBRACKET) || methodFromMethodCall.getReceiverName().contains("$$")){
|
}else if(retType.contains(CONSTANTS.TPH)|| retType.contains(CONSTANTS.ANGLEBRACKET) || methodFromMethodCall.getReceiverName().contains("$$")){
|
||||||
desc += ")L"+Type.getInternalName(Object.class)+ ";";
|
desc += ")L"+Type.getInternalName(Object.class)+ ";";
|
||||||
}else {
|
}else {
|
||||||
@ -240,6 +241,7 @@ public class DescriptorToString implements DescriptorVisitor, CONSTANTS {
|
|||||||
return desc;
|
return desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//ToDo Etienne: Ändern für TypeErasure
|
||||||
@Override
|
@Override
|
||||||
public String createDescForFunN(ArgumentList argumentList, String returnType) {
|
public String createDescForFunN(ArgumentList argumentList, String returnType) {
|
||||||
Iterator<Expression> itr1 = argumentList.getArguments().iterator();
|
Iterator<Expression> itr1 = argumentList.getArguments().iterator();
|
||||||
|
@ -11,7 +11,9 @@ public interface DescriptorVisitor {
|
|||||||
String visit(NormalMethod method);
|
String visit(NormalMethod method);
|
||||||
String visit(NormalConstructor constructor);
|
String visit(NormalConstructor constructor);
|
||||||
String visit(Lambda lambdaExpression);
|
String visit(Lambda lambdaExpression);
|
||||||
|
//ToDo Etienne: Was ist SamMethod?
|
||||||
String visit(SamMethod samMethod);
|
String visit(SamMethod samMethod);
|
||||||
|
//ToDo Etienne: Was ist MethodFromMethodCall?
|
||||||
String visit(MethodFromMethodCall methodFromMethodCall);
|
String visit(MethodFromMethodCall methodFromMethodCall);
|
||||||
String createDescForFunN(ArgumentList argumentList, String returnType);
|
String createDescForFunN(ArgumentList argumentList, String returnType);
|
||||||
}
|
}
|
||||||
|
@ -136,6 +136,7 @@ public class Signature {
|
|||||||
defineGenericsFromConstraints(constraints,genericsAndBoundsMethod);
|
defineGenericsFromConstraints(constraints,genericsAndBoundsMethod);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//ToDo Etienne: für TypeErasure anschauen
|
||||||
private void createSignatureForFunN(int numberOfParams, String to, String[] paramTypes) {
|
private void createSignatureForFunN(int numberOfParams, String to, String[] paramTypes) {
|
||||||
defineTypeVariablesForParametersOfFunN(numberOfParams);
|
defineTypeVariablesForParametersOfFunN(numberOfParams);
|
||||||
|
|
||||||
@ -147,6 +148,7 @@ public class Signature {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//ToDo Etienne: für TypeErasure anschauen
|
||||||
private void createSignatureForFunN(int numberOfParams) {
|
private void createSignatureForFunN(int numberOfParams) {
|
||||||
|
|
||||||
defineTypeVariablesForParametersOfFunN(numberOfParams);
|
defineTypeVariablesForParametersOfFunN(numberOfParams);
|
||||||
|
@ -18,6 +18,7 @@ import java.io.FileOutputStream;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
//ToDo Etienne: Anpassung für TypeErasure
|
||||||
public class ByteCodeForFunNGenerator {
|
public class ByteCodeForFunNGenerator {
|
||||||
|
|
||||||
public static void generateBCForFunN(LambdaExpression lambdaExpression, String methDesc, File path) {
|
public static void generateBCForFunN(LambdaExpression lambdaExpression, String methDesc, File path) {
|
||||||
|
@ -220,6 +220,7 @@ public class MethodCallHelper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//ToDo Etienne: Für Type Erasure wichtig?!
|
||||||
public void generateBCForFunN(String methodDescriptor) {
|
public void generateBCForFunN(String methodDescriptor) {
|
||||||
ByteCodeForFunNGenerator.generateBCForFunN(methCall.arglist,methodDescriptor,path);
|
ByteCodeForFunNGenerator.generateBCForFunN(methCall.arglist,methodDescriptor,path);
|
||||||
}
|
}
|
||||||
|
@ -884,6 +884,7 @@ public class JavaTXCompiler {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//ToDo Etienne: Für Type Erasure wichtig?! (alle generatedBytecode-Methoden?)
|
||||||
public void generateBytecode() throws ClassNotFoundException, IOException, BytecodeGeneratorError {
|
public void generateBytecode() throws ClassNotFoundException, IOException, BytecodeGeneratorError {
|
||||||
generateBytecode((File) null);
|
generateBytecode((File) null);
|
||||||
}
|
}
|
||||||
|
@ -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 {
|
public abstract class WildcardType extends RefTypeOrTPHOrWildcardOrGeneric {
|
||||||
|
|
||||||
protected RefTypeOrTPHOrWildcardOrGeneric innerType = null;
|
protected RefTypeOrTPHOrWildcardOrGeneric innerType = null;
|
||||||
|
Loading…
Reference in New Issue
Block a user