From 3c86eecf8b376cb884820c01b5645189d804a954 Mon Sep 17 00:00:00 2001 From: "pl@gohorb.ba-horb.de" Date: Mon, 5 Jun 2023 13:14:00 +0200 Subject: [PATCH] modified: ../../pom.xml new file: Iteration.jav modified: Pair.jav modified: ../../src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java modified: ../../src/test/java/AllgemeinTest.java --- pom.xml | 2 +- resources/AllgemeinTest/Iteration.jav | 36 +++++++++++++++++++ resources/AllgemeinTest/Pair.jav | 2 +- .../de/dhbwstuttgart/core/JavaTXCompiler.java | 2 +- src/test/java/AllgemeinTest.java | 3 +- 5 files changed, 41 insertions(+), 4 deletions(-) create mode 100644 resources/AllgemeinTest/Iteration.jav diff --git a/pom.xml b/pom.xml index 8fe3f636..add91d5c 100644 --- a/pom.xml +++ b/pom.xml @@ -42,7 +42,7 @@ http://maven.apache.org/maven-v4_0_0.xsd"> org.ow2.asm asm - 7.0 + 9.5 diff --git a/resources/AllgemeinTest/Iteration.jav b/resources/AllgemeinTest/Iteration.jav new file mode 100644 index 00000000..cdbabe0e --- /dev/null +++ b/resources/AllgemeinTest/Iteration.jav @@ -0,0 +1,36 @@ +/* +class Pair { + T x; + U y; + + public Pair() { } + public Pair(T x, U y) { + this.x = x; + this.y = y; + } + + public T fst () { + return x; + } + + public U snd () { + return y; + } +} +*/ + +public class Iteration { + m1(x, y) { + var help; + help = m2(x, y); + var y2 = help.snd(); + return new Pair<>(y2,x); + } + + m2(x,y) { + var help = m1(x, y); + var x2 = help.fst(); + return new Pair<>(y, x2); + } +} + \ No newline at end of file diff --git a/resources/AllgemeinTest/Pair.jav b/resources/AllgemeinTest/Pair.jav index 7fbec246..89660b13 100644 --- a/resources/AllgemeinTest/Pair.jav +++ b/resources/AllgemeinTest/Pair.jav @@ -13,7 +13,7 @@ class Pair { return ret; } - + eq(a, b) { b = a; return a == b; diff --git a/src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java b/src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java index 19d32cc5..04537c2c 100644 --- a/src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java +++ b/src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java @@ -557,7 +557,7 @@ public class JavaTXCompiler { break; } } - if (!found) newClasses.add(clazz); + if (!found) allClasses.add(clazz); } } diff --git a/src/test/java/AllgemeinTest.java b/src/test/java/AllgemeinTest.java index 7749b938..60ef6659 100644 --- a/src/test/java/AllgemeinTest.java +++ b/src/test/java/AllgemeinTest.java @@ -55,7 +55,8 @@ public class AllgemeinTest { //String className = "Pair"; //String className = "UseWildcardPair"; //String className = "Assign"; - String className = "StreamTest"; + //String className = "StreamTest"; + String className = "Iteration"; //PL 2019-10-24: genutzt fuer unterschiedliche Tests path = System.getProperty("user.dir")+"/resources/AllgemeinTest/" + className + ".jav"; //path = System.getProperty("user.dir")+"/src/test/resources/AllgemeinTest/Overloading_Generics.jav";