From 2b7aef5e87b0cd8d6055a0e70feea74552858c91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Pl=C3=BCmicke?= Date: Wed, 5 Jun 2019 10:21:25 +0200 Subject: [PATCH] modified: ../../../../main/java/de/dhbwstuttgart/core/JavaTXCompiler.java modified: ../../../../main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java Pfad fuer logFile nach JavaCompilerCore/logFiles verlegt. modified: ../../bytecode/javFiles/OL.jav modified: ../../bytecode/javFiles/VectorAdd.jav --- .../java/de/dhbwstuttgart/core/JavaTXCompiler.java | 3 ++- .../typeinference/unify/TypeUnifyTask.java | 3 ++- src/test/resources/bytecode/javFiles/OL.jav | 12 +++++++++++- src/test/resources/bytecode/javFiles/VectorAdd.jav | 14 ++++++++++++++ 4 files changed, 29 insertions(+), 3 deletions(-) diff --git a/src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java b/src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java index ddf7d642..e7af8af2 100644 --- a/src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java +++ b/src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java @@ -440,7 +440,8 @@ public class JavaTXCompiler { Set> results = new HashSet<>(); try { Writer logFile = //new OutputStreamWriter(new NullOutputStream()); - new FileWriter(new File(System.getProperty("user.dir")+"/src/test/resources/logFiles/"+"log_"+sourceFiles.keySet().iterator().next().getName())); + //new FileWriter(new File(System.getProperty("user.dir")+"/src/test/resources/logFiles/"+"log_"+sourceFiles.keySet().iterator().next().getName())); + new FileWriter(new File(System.getProperty("user.dir")+"/logFiles/"+"log_"+sourceFiles.keySet().iterator().next().getName())); IFiniteClosure finiteClosure = UnifyTypeFactory.generateFC(allClasses,logFile); System.out.println(finiteClosure); ConstraintSet unifyCons = UnifyTypeFactory.convert(cons); diff --git a/src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java b/src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java index 21b91e5a..2c1d70fe 100644 --- a/src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java +++ b/src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java @@ -173,7 +173,8 @@ public class TypeUnifyTask extends RecursiveTask>> { writeLog("thNo2 " + thNo); try { this.logFile = //new OutputStreamWriter(new NullOutputStream()); - new FileWriter(new File(System.getProperty("user.dir")+"/src/test/resources/logFiles/"+"Thread_"+thNo)); + //new FileWriter(new File(System.getProperty("user.dir")+"/src/test/resources/logFiles/"+"Thread_"+thNo)); + new FileWriter(new File(System.getProperty("user.dir")+"/logFiles/"+"Thread_"+thNo)); logFile.write(""); } catch (IOException e) { diff --git a/src/test/resources/bytecode/javFiles/OL.jav b/src/test/resources/bytecode/javFiles/OL.jav index 83361d3c..0861b4df 100644 --- a/src/test/resources/bytecode/javFiles/OL.jav +++ b/src/test/resources/bytecode/javFiles/OL.jav @@ -1,12 +1,22 @@ import java.lang.String; import java.lang.Integer; import java.lang.Double; - +import java.lang.Boolean; public class OL { m(x) { return x + x; } + /* + m(Boolean x) { return x; } + + + m(x) { + x.add(1); + x.addAll(x); + return x; + } +*/ } diff --git a/src/test/resources/bytecode/javFiles/VectorAdd.jav b/src/test/resources/bytecode/javFiles/VectorAdd.jav index 814f46c2..3598c5f1 100644 --- a/src/test/resources/bytecode/javFiles/VectorAdd.jav +++ b/src/test/resources/bytecode/javFiles/VectorAdd.jav @@ -4,6 +4,7 @@ import java.lang.String; //import java.lang.Byte; //import java.lang.Boolean; +/* public class VectorAdd { add(v1, v2) { @@ -17,3 +18,16 @@ public class VectorAdd { return ret; } } +*/ + +public class VectorAdd { + vectorAdd(v1, v2) { + var i = 0; + var erg = new Vector<>(); + while (i < v1.size()) { + erg.addElement(v1.elementAt(i) + v2.elementAt(i)); + i++; + } + return erg; + } +}