From 4d4be5420b61f186944336ccb89e2a45b11c8679 Mon Sep 17 00:00:00 2001 From: Michael Uhl Date: Fri, 15 Mar 2019 10:52:31 +0100 Subject: [PATCH 1/2] Anpassung asynchroner Aufruf des Plugins ======================================== MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit UnifyResultListener muss übergeben werden, da sonst Ergebnisse gemeldet werden (notify), ohne dass das Plugin als UnifyResultListener registriert wurde. --- src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java b/src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java index fd570a0c..b84c9441 100644 --- a/src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java +++ b/src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java @@ -34,6 +34,7 @@ import de.dhbwstuttgart.typeinference.unify.model.PlaceholderType; import de.dhbwstuttgart.typeinference.unify.model.UnifyPair; import de.dhbwstuttgart.typeinference.unify.model.UnifyType; import de.dhbwstuttgart.typeinference.unify.TypeUnifyTask; +import de.dhbwstuttgart.typeinference.unify.UnifyResultListener; import de.dhbwstuttgart.typeinference.unify.UnifyResultListenerImpl; import de.dhbwstuttgart.typeinference.unify.UnifyResultModel; @@ -277,7 +278,7 @@ public class JavaTXCompiler { } */ - public UnifyResultModel typeInferenceAsync() throws ClassNotFoundException { + public UnifyResultModel typeInferenceAsync(UnifyResultListener resultListener) throws ClassNotFoundException { List allClasses = new ArrayList<>();//environment.getAllAvailableClasses(); //Alle Importierten Klassen in allen geparsten Sourcefiles kommen ins FC for(SourceFile sf : this.sourceFiles.values()) { @@ -288,6 +289,7 @@ public class JavaTXCompiler { final ConstraintSet cons = getConstraints(); Set> results = new HashSet<>(); UnifyResultModel urm = new UnifyResultModel(); + urm.addUnifyResultListener(resultListener); try { Writer logFile = new OutputStreamWriter(new NullOutputStream()); //new FileWriter(new File("log_"+sourceFiles.keySet().iterator().next().getName())); From 7cb2eed36edfe2d9f3ec4ce5c0ca40702dcff7f2 Mon Sep 17 00:00:00 2001 From: Michael Uhl Date: Mon, 18 Mar 2019 09:33:22 +0100 Subject: [PATCH 2/2] Logger comes from plugin now. --- src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java b/src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java index b84c9441..6bf4b50b 100644 --- a/src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java +++ b/src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java @@ -278,7 +278,7 @@ public class JavaTXCompiler { } */ - public UnifyResultModel typeInferenceAsync(UnifyResultListener resultListener) throws ClassNotFoundException { + public UnifyResultModel typeInferenceAsync(UnifyResultListener resultListener, Writer logFile) throws ClassNotFoundException { List allClasses = new ArrayList<>();//environment.getAllAvailableClasses(); //Alle Importierten Klassen in allen geparsten Sourcefiles kommen ins FC for(SourceFile sf : this.sourceFiles.values()) { @@ -291,9 +291,8 @@ public class JavaTXCompiler { UnifyResultModel urm = new UnifyResultModel(); urm.addUnifyResultListener(resultListener); try { - Writer logFile = new OutputStreamWriter(new NullOutputStream()); - //new FileWriter(new File("log_"+sourceFiles.keySet().iterator().next().getName())); - + logFile = logFile == null ? new FileWriter(new File("log_"+sourceFiles.keySet().iterator().next().getName())) : logFile; + IFiniteClosure finiteClosure = UnifyTypeFactory.generateFC(allClasses,logFile); System.out.println(finiteClosure); ConstraintSet unifyCons = UnifyTypeFactory.convert(cons);