From cdd4cd99682217fb76f9edc9a4e175a872c80e34 Mon Sep 17 00:00:00 2001 From: "pl@gohorb.ba-horb.de" Date: Wed, 8 Mar 2023 14:26:08 +0100 Subject: [PATCH] modified: ../src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java Tenaeren Operator fuer log-File eingefuegt --- resources/AllgemeinTest/Pair.jav | 4 ++-- .../java/de/dhbwstuttgart/core/JavaTXCompiler.java | 10 +++++----- src/test/java/AllgemeinTest.java | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/resources/AllgemeinTest/Pair.jav b/resources/AllgemeinTest/Pair.jav index b7c5e7a9b..2340c3116 100644 --- a/resources/AllgemeinTest/Pair.jav +++ b/resources/AllgemeinTest/Pair.jav @@ -12,7 +12,7 @@ class Pair { ret.b = x.elementAt(1); return ret; } - + /* eq(a, b) { b = a; return a == b; @@ -22,7 +22,7 @@ class Pair { return eq(p.a, p.b); //return p.a == p.b; } -/* + void m(Pair p, List b) { //this.compare(p); //1, type incorrect diff --git a/src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java b/src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java index 0fc6e18ab..5e69546dd 100644 --- a/src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java +++ b/src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java @@ -56,11 +56,14 @@ import java.io.File; import java.io.FileOutputStream; import java.io.FileWriter; import java.io.IOException; +import java.io.OutputStreamWriter; import java.io.Writer; import java.util.*; import java.util.function.Function; import java.util.stream.Collectors; +import org.apache.commons.io.output.NullOutputStream; + public class JavaTXCompiler { @@ -552,11 +555,8 @@ public class JavaTXCompiler { final ConstraintSet cons = getConstraints(); Set> results = new HashSet<>(); try { - Writer logFile = //new OutputStreamWriter(new NullOutputStream()); - // new FileWriter(new - // File(System.getProperty("user.dir")+"/resources/logFiles/"+"log_"+sourceFiles.keySet().iterator().next().getName())); - new FileWriter(new File(System.getProperty("user.dir") + "/logFiles/" + "log_" - + sourceFiles.keySet().iterator().next().getName())); + Writer logFile = log ? new FileWriter(new File(System.getProperty("user.dir") + "/logFiles/" + "log_" + sourceFiles.keySet().iterator().next().getName())) + : new OutputStreamWriter(new NullOutputStream()); IFiniteClosure finiteClosure = UnifyTypeFactory.generateFC(allClasses, logFile, classLoader); System.out.println(finiteClosure); ConstraintSet unifyCons = UnifyTypeFactory.convert(cons); diff --git a/src/test/java/AllgemeinTest.java b/src/test/java/AllgemeinTest.java index db7ae1854..727c6de67 100644 --- a/src/test/java/AllgemeinTest.java +++ b/src/test/java/AllgemeinTest.java @@ -52,9 +52,9 @@ public class AllgemeinTest { //String className = "VectorNotObject"; //String className = "WildcardCaptureConversionTest"; //String className = "CaptureConversion"; - //String className = "Pair"; + String className = "Pair"; //String className = "UseWildcardPair"; - String className = "Assign"; + //String className = "Assign"; //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";