diff --git a/src/main/java/de/dhbwstuttgart/bytecode/BytecodeGenMethod.java b/src/main/java/de/dhbwstuttgart/bytecode/BytecodeGenMethod.java index d0b6fda6..208c93be 100644 --- a/src/main/java/de/dhbwstuttgart/bytecode/BytecodeGenMethod.java +++ b/src/main/java/de/dhbwstuttgart/bytecode/BytecodeGenMethod.java @@ -598,7 +598,8 @@ public class BytecodeGenMethod implements StatementVisitor { FunN f; //ToDo refactor with code for FunN underneath ASTToIntermediate converter = new ASTToIntermediate(); - IntermediateInnerType returnType = (IntermediateInnerType) converter.convert(lambdaExpression.getReturnType()); + //Fehler in return Typ + IntermediateInnerType returnType = (IntermediateInnerType) converter.convert(resolver.resolve(lambdaExpression.getReturnType())); List arguments = lambdaExpression.params .getFormalparalist() .stream() diff --git a/src/main/java/de/dhbwstuttgart/bytecode/descriptor/TypeToDescriptor.java b/src/main/java/de/dhbwstuttgart/bytecode/descriptor/TypeToDescriptor.java index 0b8d1346..c54f6fc9 100644 --- a/src/main/java/de/dhbwstuttgart/bytecode/descriptor/TypeToDescriptor.java +++ b/src/main/java/de/dhbwstuttgart/bytecode/descriptor/TypeToDescriptor.java @@ -14,7 +14,7 @@ public class TypeToDescriptor implements TypeVisitor{ @Override public String visit(RefType refType) { //ToDo Etienne: check if it works - if (refType.getName().toString().matches("Fun\\d+\\$\\$")){ + if (refType.getName().toString().matches("Fun\\d+\\$\\$")) { String descriptor = new ASTToIntermediate().convert(refType).getDescriptor(); return descriptor.substring(1, descriptor.length() - 1); } diff --git a/src/main/java/de/dhbwstuttgart/intermediate/convert/ASTToIntermediate.java b/src/main/java/de/dhbwstuttgart/intermediate/convert/ASTToIntermediate.java index a386dd50..20ea14cc 100644 --- a/src/main/java/de/dhbwstuttgart/intermediate/convert/ASTToIntermediate.java +++ b/src/main/java/de/dhbwstuttgart/intermediate/convert/ASTToIntermediate.java @@ -3,9 +3,7 @@ package de.dhbwstuttgart.intermediate.convert; import de.dhbwstuttgart.exceptions.NotImplementedException; import de.dhbwstuttgart.intermediate.generation.FunN; import de.dhbwstuttgart.intermediate.types.*; -import de.dhbwstuttgart.parser.scope.JavaClassName; import de.dhbwstuttgart.syntaxtree.type.*; -import org.objectweb.asm.Type; import java.util.List; import java.util.stream.Collectors; @@ -39,8 +37,6 @@ public class ASTToIntermediate { .collect(Collectors.toList())); } - - //ToDo abklären: darf hier kein stehen? da hier kein Typparameter existiert public IntermediateGenericType convert(GenericRefType originalType){ //no typ argument for e.g. is present in the definition of GenericRefType return new IntermediateGenericType(originalType.getParsedName()); @@ -60,17 +56,10 @@ public class ASTToIntermediate { return new IntermediateExtendsWildcard((IntermediateInnerType) innerType); } - /* - public IntermediateWildcard convert(){ - //thows RuntimeException because in the AST is no typ defined which represents a normal wildcard - throw new NotImplementedException("There is no conversion defined for this type."); - } - */ - //ToDo Etienne: check if it works - public IntermediateRefType convert(TypePlaceholder originalType){ - //ToDo zu Generic nachher - return new IntermediateRefType(new JavaClassName(Type.getInternalName(Object.class))); + public IntermediateGenericType convert(TypePlaceholder originalType){ + //ToDo muss zu einem Generic werden + return new IntermediateGenericType(originalType.getName()); } public IntermediateType convert(RefTypeOrTPHOrWildcardOrGeneric originalType){