modified: bundles/JavaCompilerPlugin.Plugin/src/typinferenzplugin/Typinferenz.java

Bug 180 - Andere Einsetzung als im Bytecode geloest
This commit is contained in:
pl@gohorb.ba-horb.de 2020-04-13 16:10:24 +02:00
parent 4139aa6a98
commit e4066b5125

View File

@ -93,13 +93,13 @@ public class Typinferenz {
Set<TypeInsert> tips = new HashSet<>(); Set<TypeInsert> tips = new HashSet<>();
String outputDirectory = getOutputDirectory(); String outputDirectory = getOutputDirectory();
List<GenericGenratorResultForSourceFile> genericResults = new ArrayList<>();//wird in getBytecode bestimmt List<GenericGenratorResultForSourceFile> simplifyResultsForAllSourceFiles = new ArrayList<>();//wird in getBytecode bestimmt
if (this.forByteCode.size() > 0) { if (this.forByteCode.size() > 0) {
for (SourceFile sf : compiler.sourceFiles.values()) { for (SourceFile sf : compiler.sourceFiles.values()) {
try { try {
HashMap<String, byte[]> bytecode = getBytecode(sf, this.forByteCode, outputDirectory, genericResults); //HashMap<String, byte[]> bytecode = getBytecode(sf, this.forByteCode, outputDirectory, genericResults);
compiler.generateBytecodForFile(outputDirectory, bytecode, sf, new ArrayList<>(forByteCode)); compiler.generateBytecodForFile(outputDirectory, /*bytecode,*/ sf, new ArrayList<>(forByteCode), simplifyResultsForAllSourceFiles);
this.writeClassFile(outputDirectory, bytecode); //this.writeClassFile(outputDirectory, bytecode);
} catch (BytecodeGeneratorError | IOException ex) { } catch (BytecodeGeneratorError | IOException ex) {
ErrorMarker toAdd = new ErrorMarker(ex.getMessage(), new CodePoint(sf.getOffset())); ErrorMarker toAdd = new ErrorMarker(ex.getMessage(), new CodePoint(sf.getOffset()));
ret.add(toAdd); ret.add(toAdd);
@ -108,7 +108,7 @@ public class Typinferenz {
} }
int i = 0; int i = 0;
for (ResultSet tiResult : newResults) { for (ResultSet tiResult : newResults) {
tips.addAll(TypeInsertFactory.createTypeInsertPoints(parsedSource, tiResult, newResults, genericResults.get(i))); tips.addAll(TypeInsertFactory.createTypeInsertPoints(parsedSource, tiResult, newResults, simplifyResultsForAllSourceFiles));
i++; i++;
for (TypeInsert p : tips) { for (TypeInsert p : tips) {
TypeReplaceMarker toAdd = new TypeReplaceMarker(editor, tiResult, p); TypeReplaceMarker toAdd = new TypeReplaceMarker(editor, tiResult, p);
@ -167,6 +167,7 @@ public class Typinferenz {
return ret; return ret;
} }
//wird nicht mehr benoetigt
public synchronized HashMap<String, byte[]> getBytecode(SourceFile sf, Collection<ResultSet> resultSets, String path, List<GenericGenratorResultForSourceFile> genericResultsRet) { public synchronized HashMap<String, byte[]> getBytecode(SourceFile sf, Collection<ResultSet> resultSets, String path, List<GenericGenratorResultForSourceFile> genericResultsRet) {
try { try {
HashMap<String, byte[]> classFiles = new HashMap<>(); HashMap<String, byte[]> classFiles = new HashMap<>();