diff --git a/src/main/java/de/dhbwstuttgart/bytecode/BytecodeGenMethod.java b/src/main/java/de/dhbwstuttgart/bytecode/BytecodeGenMethod.java index dfc63d4cf..0bff4d5fa 100644 --- a/src/main/java/de/dhbwstuttgart/bytecode/BytecodeGenMethod.java +++ b/src/main/java/de/dhbwstuttgart/bytecode/BytecodeGenMethod.java @@ -592,11 +592,12 @@ public class BytecodeGenMethod implements StatementVisitor { public void visit(LambdaExpression lambdaExpression) { this.lamCounter++; + //ToDo Etienne: umbauen String typeErasure = createDescriptorWithTypeErasure(lambdaExpression); ByteCodeForFunNGenerator.generateBCForFunN(lambdaExpression, typeErasure,path); - - + + //ToDo Etienne: umbauen Lambda lam = new Lambda(lambdaExpression); String lamDesc = lam.accept(new DescriptorToString(resultSet)); // Call site, which, when invoked, returns an instance of the functional @@ -822,7 +823,7 @@ public class BytecodeGenMethod implements StatementVisitor { //helper.generateBCForFunN(mDesc); FunN f; ASTToIntermediate converter = new ASTToIntermediate(); - IntermediateInnerType returnType = (IntermediateInnerType) converter.convert(methodCall.receiver.getType()); + IntermediateInnerType returnType = (IntermediateInnerType) converter.convert(resolver.resolve(methodCall.receiver.getType())); if(methodCall .arglist .getArguments().size() > 0){ @@ -831,6 +832,7 @@ public class BytecodeGenMethod implements StatementVisitor { .getArguments() .stream() .map(TypableStatement::getType) + .map(resolver::resolve) .map(converter::convert) .filter(t -> t instanceof IntermediateInnerType) .map(t -> (IntermediateInnerType) t) diff --git a/src/main/java/de/dhbwstuttgart/bytecode/descriptor/DescriptorToString.java b/src/main/java/de/dhbwstuttgart/bytecode/descriptor/DescriptorToString.java index 90064863e..c272c12fa 100644 --- a/src/main/java/de/dhbwstuttgart/bytecode/descriptor/DescriptorToString.java +++ b/src/main/java/de/dhbwstuttgart/bytecode/descriptor/DescriptorToString.java @@ -153,6 +153,7 @@ public class DescriptorToString implements DescriptorVisitor, CONSTANTS { return desc; } + //ToDo Etienne: ändern @Override public String visit(Lambda lambdaExpression) { String desc = "("; diff --git a/src/main/java/de/dhbwstuttgart/bytecode/utilities/Resolver.java b/src/main/java/de/dhbwstuttgart/bytecode/utilities/Resolver.java index f581b3745..684fdd4b2 100644 --- a/src/main/java/de/dhbwstuttgart/bytecode/utilities/Resolver.java +++ b/src/main/java/de/dhbwstuttgart/bytecode/utilities/Resolver.java @@ -25,4 +25,9 @@ public class Resolver { public String getResolvedType(RefTypeOrTPHOrWildcardOrGeneric type) { return resultSet.resolveType(type).resolvedType.acceptTV(new TypeToDescriptor()); } + + //ToDo Etienne: Check ob benötigt + public RefTypeOrTPHOrWildcardOrGeneric resolve(RefTypeOrTPHOrWildcardOrGeneric type) { + return resultSet.resolveType(type).resolvedType; + } } diff --git a/src/main/java/de/dhbwstuttgart/intermediate/convert/ASTToIntermediate.java b/src/main/java/de/dhbwstuttgart/intermediate/convert/ASTToIntermediate.java index b9cb47b59..9e5a6932e 100644 --- a/src/main/java/de/dhbwstuttgart/intermediate/convert/ASTToIntermediate.java +++ b/src/main/java/de/dhbwstuttgart/intermediate/convert/ASTToIntermediate.java @@ -1,5 +1,6 @@ package de.dhbwstuttgart.intermediate.convert; +import de.dhbwstuttgart.bytecode.utilities.Resolver; import de.dhbwstuttgart.exceptions.NotImplementedException; import de.dhbwstuttgart.intermediate.generation.FunN; import de.dhbwstuttgart.intermediate.types.*; @@ -18,6 +19,7 @@ public class ASTToIntermediate { System.out.println(originalType.getParaList().size()); if (originalType.getName().toString().matches("Fun\\d+\\$\\$")){ + if(originalType.getParaList().size() == 0) throw new RuntimeException("Incorrect FunN Type: No params are defined!"); ASTToIntermediate converter = new ASTToIntermediate(); List parameters = originalType.getParaList(); IntermediateInnerType returnType = (IntermediateInnerType) convert(parameters.get(parameters.size() - 1));