Bytecode falsch generiert.

This commit is contained in:
Michael Uhl 2019-04-26 11:17:20 +02:00
parent 0b34810037
commit 0d32704d32

View File

@ -97,10 +97,10 @@ public class Typinferenz {
return this.tiResults; return this.tiResults;
} }
public Vector<TypeReplaceMarker> updateWithResult(Vector<TypeReplaceMarker> ret, List<ResultSet> tiResults) { public Vector<TypeReplaceMarker> updateWithResult(Vector<TypeReplaceMarker> ret, List<ResultSet> newResults) {
this.tiResults.addAll(tiResults); this.tiResults.addAll(newResults);
Set<TypeInsert> tips = new HashSet<>(); Set<TypeInsert> tips = new HashSet<>();
for (ResultSet tiResult : tiResults) { for (ResultSet tiResult : newResults) {
tips.addAll(TypeInsertFactory.createTypeInsertPoints(parsedSource, tiResult)); tips.addAll(TypeInsertFactory.createTypeInsertPoints(parsedSource, tiResult));
for (TypeInsert p : tips) { for (TypeInsert p : tips) {
TypeReplaceMarker toAdd = new TypeReplaceMarker(editor, tiResult, p); TypeReplaceMarker toAdd = new TypeReplaceMarker(editor, tiResult, p);
@ -115,9 +115,9 @@ public class Typinferenz {
String outputDirectory = editor.getFilePath().toString(); String outputDirectory = editor.getFilePath().toString();
outputDirectory = outputDirectory.substring(0, outputDirectory = outputDirectory.substring(0,
outputDirectory.length() - editor.getFilePath().lastSegment().length());// ".jav" hat Länge 4 outputDirectory.length() - editor.getFilePath().lastSegment().length());// ".jav" hat Länge 4
if (tiResults.size() > 0) { if (newResults.size() > 0) {
for (SourceFile sf : compiler.sourceFiles.values()) { for (SourceFile sf : compiler.sourceFiles.values()) {
HashMap<String, byte[]> bytecode = getBytecode(sf, tiResults, outputDirectory); HashMap<String, byte[]> bytecode = getBytecode(sf, this.tiResults, outputDirectory);
this.writeClassFile(outputDirectory, bytecode); this.writeClassFile(outputDirectory, bytecode);
} }
} }
@ -154,7 +154,7 @@ public class Typinferenz {
public HashMap<String, byte[]> getBytecode(SourceFile sf, Collection<ResultSet> resultSets, String path) { public HashMap<String, byte[]> getBytecode(SourceFile sf, Collection<ResultSet> resultSets, String path) {
HashMap<String, byte[]> classFiles = new HashMap<>(); HashMap<String, byte[]> classFiles = new HashMap<>();
BytecodeGen bytecodeGen = new BytecodeGen(classFiles, new ArrayList<>(resultSets), sf, path); BytecodeGen bytecodeGen = new BytecodeGen(classFiles, new ArrayList<>(this.tiResults), sf, path);
bytecodeGen.visit(sf); bytecodeGen.visit(sf);
return bytecodeGen.getClassFiles(); return bytecodeGen.getClassFiles();
} }