From 46aac7e3663584d4fe712af6ca6e1f7c0eaadcf2 Mon Sep 17 00:00:00 2001 From: Daniel Holle Date: Thu, 1 Jun 2023 16:12:25 +0200 Subject: [PATCH] Fix wrong result being passed and remove log spam --- .../src/typinferenzplugin/Typinferenz.java | 5 ++--- .../src/typinferenzplugin/editor/JavEditor.java | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/src/typinferenzplugin/Typinferenz.java b/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/src/typinferenzplugin/Typinferenz.java index c94ec94..d9e7b3c 100644 --- a/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/src/typinferenzplugin/Typinferenz.java +++ b/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/src/typinferenzplugin/Typinferenz.java @@ -69,7 +69,6 @@ public class Typinferenz { if (Strings.isNullOrEmpty(editor.getSourceCode())) { return new UnifyResultModel(new ConstraintSet<>(), new FiniteClosure(new HashSet<>(), new OutputStreamWriter(new NullOutputStream()))); } - return compiler.typeInferenceAsync(resultListener, new OutputStreamWriter(new NullOutputStream())); } catch (ClassNotFoundException e) { LOG.log(new Status(ERROR, PLUGIN_ID, e.getMessage(), e)); @@ -84,7 +83,7 @@ public class Typinferenz { return this.forByteCode; } - public Vector updateWithResult(Vector ret, List newResults) { + public synchronized Vector updateWithResult(Vector ret, List newResults) { this.tiResults.addAll(newResults); this.forByteCode.addAll(newResults); @@ -95,7 +94,7 @@ public class Typinferenz { if (this.forByteCode.size() > 0) { for (SourceFile sf : compiler.sourceFiles.values()) { try { - var generatedClasses = compiler.generateBytecode(sf, newResults); + var generatedClasses = compiler.generateBytecode(sf, tiResults); compiler.writeClassFile(generatedClasses, new File(outputDirectory)); } catch (IOException ex) { ErrorMarker toAdd = new ErrorMarker(ex.getMessage(), new CodePoint(sf.getOffset())); diff --git a/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/src/typinferenzplugin/editor/JavEditor.java b/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/src/typinferenzplugin/editor/JavEditor.java index 8de5a5b..89ec94c 100644 --- a/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/src/typinferenzplugin/editor/JavEditor.java +++ b/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/src/typinferenzplugin/editor/JavEditor.java @@ -105,7 +105,7 @@ public class JavEditor extends TextEditor implements UnifyResultListener { IResourceChangeListener listener = new IResourceChangeListener() { @Override public void resourceChanged(IResourceChangeEvent arg0) { - System.out.println("Text changed"); + //System.out.println("Text changed"); } }; ResourcesPlugin.getWorkspace().addResourceChangeListener(listener);