diff --git a/src/main/java/de/dhbwstuttgart/target/generate/ASTToTargetAST.java b/src/main/java/de/dhbwstuttgart/target/generate/ASTToTargetAST.java index b33f4ea4..541eb761 100644 --- a/src/main/java/de/dhbwstuttgart/target/generate/ASTToTargetAST.java +++ b/src/main/java/de/dhbwstuttgart/target/generate/ASTToTargetAST.java @@ -499,15 +499,17 @@ public class ASTToTargetAST { // For eliminating inner type variables we need to figure out which ones are actually used // TODO Maybe don't do this twice? - var referenced = new HashSet(); + var usedTphs = new HashSet(); for (var param : method.getParameterList().getFormalparalist()) { - referenced.addAll(findTypeVariables(param.getType())); + usedTphs.addAll(findTypeVariables(param.getType())); } - referenced.addAll(findTypeVariables(method.getReturnType())); + usedTphs.addAll(findTypeVariables(method.getReturnType())); + var referenced = new HashSet<>(usedTphs); referenced.addAll(typeVariablesOfClass); eliminateInnerTypeVariables(referenced, result); - usedTPHsOfMethods.put(method, referenced); + + usedTPHsOfMethods.put(method, usedTphs); System.out.println(method.name + ": " + result);