diff --git a/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/src/typinferenzplugin/Typinferenz.java b/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/src/typinferenzplugin/Typinferenz.java index 5356e08..67bd6d8 100644 --- a/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/src/typinferenzplugin/Typinferenz.java +++ b/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/src/typinferenzplugin/Typinferenz.java @@ -52,6 +52,7 @@ public class Typinferenz { private JavaTXCompiler compiler; private List tiResults; + private Set forByteCode = new HashSet<>(); public Typinferenz(JavEditor forEditor) { this.editor = forEditor; @@ -99,6 +100,8 @@ public class Typinferenz { public Vector updateWithResult(Vector ret, List newResults) { this.tiResults.addAll(newResults); + this.forByteCode.addAll(newResults); + Set tips = new HashSet<>(); for (ResultSet tiResult : newResults) { tips.addAll(TypeInsertFactory.createTypeInsertPoints(parsedSource, tiResult)); @@ -115,9 +118,10 @@ public class Typinferenz { String outputDirectory = editor.getFilePath().toString(); outputDirectory = outputDirectory.substring(0, outputDirectory.length() - editor.getFilePath().lastSegment().length());// ".jav" hat Länge 4 - if (newResults.size() > 0) { + + if (this.forByteCode.size() > 0) { for (SourceFile sf : compiler.sourceFiles.values()) { - HashMap bytecode = getBytecode(sf, this.tiResults, outputDirectory); + HashMap bytecode = getBytecode(sf, this.forByteCode, outputDirectory); this.writeClassFile(outputDirectory, bytecode); } } @@ -152,9 +156,9 @@ public class Typinferenz { return ret; } - public HashMap getBytecode(SourceFile sf, Collection resultSets, String path) { + public synchronized HashMap getBytecode(SourceFile sf, Collection resultSets, String path) { HashMap classFiles = new HashMap<>(); - BytecodeGen bytecodeGen = new BytecodeGen(classFiles, new ArrayList<>(this.tiResults), sf, path); + BytecodeGen bytecodeGen = new BytecodeGen(classFiles, resultSets, sf, path); bytecodeGen.visit(sf); return bytecodeGen.getClassFiles(); }