From e231cf722bce8add5740e8335433f6b22ada753f Mon Sep 17 00:00:00 2001 From: Victorious3 Date: Tue, 4 Apr 2023 13:09:28 +0200 Subject: [PATCH] Fix type variable being declared twice --- .../de/dhbwstuttgart/target/generate/ASTToTargetAST.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/de/dhbwstuttgart/target/generate/ASTToTargetAST.java b/src/main/java/de/dhbwstuttgart/target/generate/ASTToTargetAST.java index b28bfb41..3ebd5430 100644 --- a/src/main/java/de/dhbwstuttgart/target/generate/ASTToTargetAST.java +++ b/src/main/java/de/dhbwstuttgart/target/generate/ASTToTargetAST.java @@ -116,6 +116,8 @@ public class ASTToTargetAST { } return false; }); + } else if (input.stream().anyMatch(p -> p.getLeft().equals(pair.getLeft()))) { + return; } input.add(pair); @@ -605,14 +607,14 @@ public class ASTToTargetAST { if (left.equals(tph)) { var pair = new PairTPHsmallerTPH(tph, right); if (!generics.contains(pair)) { - generics.add(pair); + addToPairs(generics, pair); findAllBounds(right, generics, equality); found = true; } } } if (!found) - generics.add(new PairTPHequalRefTypeOrWildcardType(tph, OBJECT)); + addToPairs(generics, new PairTPHequalRefTypeOrWildcardType(tph, OBJECT)); } else if (type instanceof RefType refType) { refType.getParaList().forEach(t -> findAllBounds(t, generics, equality)); } @@ -663,7 +665,6 @@ public class ASTToTargetAST { } } } - System.out.println(input); } void findTphs(RefTypeOrTPHOrWildcardOrGeneric type, Set tphs, Map equality) {