From 4a18a81b3378f290be3e00979028bbeb85a264e8 Mon Sep 17 00:00:00 2001 From: Daniel Holle Date: Thu, 15 Jun 2023 16:31:50 +0200 Subject: [PATCH] Alter tests a bit --- .../insertGenericsJav/TestContraVariant.jav | 25 +++++++++++++++++-- .../target/generate/GenerateGenerics.java | 2 -- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/resources/insertGenericsJav/TestContraVariant.jav b/resources/insertGenericsJav/TestContraVariant.jav index 2b0e245f..9c060f0d 100644 --- a/resources/insertGenericsJav/TestContraVariant.jav +++ b/resources/insertGenericsJav/TestContraVariant.jav @@ -4,7 +4,7 @@ public class TestContraVariant { var y3 = y2.snd(); var z; y3 = z; - return new Pair(x,z); + return new Pair<>(x, z); } m(x, y) { @@ -12,6 +12,27 @@ public class TestContraVariant { var x3 = x2.fst(); var z; x3 = z; - return new Pair(z, y); + return new Pair<>(z, y); + } +} + +class Pair { + public T x; + public U y; + + public Pair() { + } + + public Pair(T var1, U var2) { + x = var1; + y = var2; + } + + public T fst() { + return x; + } + + public U snd() { + return y; } } \ No newline at end of file diff --git a/src/main/java/de/dhbwstuttgart/target/generate/GenerateGenerics.java b/src/main/java/de/dhbwstuttgart/target/generate/GenerateGenerics.java index 8aad3813..a21ed10a 100644 --- a/src/main/java/de/dhbwstuttgart/target/generate/GenerateGenerics.java +++ b/src/main/java/de/dhbwstuttgart/target/generate/GenerateGenerics.java @@ -295,7 +295,6 @@ public abstract class GenerateGenerics { if (optMethod.isEmpty()) return; var method2 = optMethod.get(); System.out.println("In: " + method.getName() + " Method: " + method2.getName()); - System.out.println(simplifiedConstraints); var generics = family(owner, method2); // transitive and @@ -750,7 +749,6 @@ public abstract class GenerateGenerics { for (var method : classOrInterface.getMethods()) { family(classOrInterface, method); } - System.out.println(familyOfMethods); } while(!oldFamily.equals(familyOfMethods)); for (var method : classOrInterface.getMethods()) {