modified: .classpath STIMMT DAS?

modified:   bundles/JavaCompilerPlugin.Plugin/src/typinferenzplugin/Typinferenz.java
Simplyfied Genererics durchgegeben
This commit is contained in:
pl@gohorb.ba-horb.de 2020-04-11 17:18:48 +02:00
parent b29d86e091
commit 4139aa6a98
2 changed files with 10 additions and 7 deletions

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry kind="src" path="bundles/JavaCompilerPlugin.Plugin/src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
<attributes> <attributes>
<attribute name="module" value="true"/> <attribute name="module" value="true"/>

View File

@ -93,10 +93,11 @@ 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
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); 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));
this.writeClassFile(outputDirectory, bytecode); this.writeClassFile(outputDirectory, bytecode);
} catch (BytecodeGeneratorError | IOException ex) { } catch (BytecodeGeneratorError | IOException ex) {
@ -105,9 +106,10 @@ public class Typinferenz {
} }
} }
} }
int i = 0;
for (ResultSet tiResult : newResults) { for (ResultSet tiResult : newResults) {
tips.addAll(TypeInsertFactory.createTypeInsertPoints(parsedSource, tiResult, newResults)); tips.addAll(TypeInsertFactory.createTypeInsertPoints(parsedSource, tiResult, newResults, genericResults.get(i)));
i++;
for (TypeInsert p : tips) { for (TypeInsert p : tips) {
TypeReplaceMarker toAdd = new TypeReplaceMarker(editor, tiResult, p); TypeReplaceMarker toAdd = new TypeReplaceMarker(editor, tiResult, p);
if (!ret.contains(toAdd)) { if (!ret.contains(toAdd)) {
@ -165,13 +167,13 @@ public class Typinferenz {
return ret; return ret;
} }
public synchronized HashMap<String, byte[]> getBytecode(SourceFile sf, Collection<ResultSet> resultSets, String path) { 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<>();
//genericResultsRet is empty; fuer die Rückgabe
List<GenericGenratorResultForSourceFile> genericResults = compiler.getGeneratedGenericResultsForAllSourceFiles(new ArrayList<>(resultSets)); genericResultsRet.addAll(compiler.getGeneratedGenericResultsForAllSourceFiles(new ArrayList<>(resultSets)));
BytecodeGen bytecodeGen = new BytecodeGen(classFiles,resultSets, genericResults, sf,path); BytecodeGen bytecodeGen = new BytecodeGen(classFiles,resultSets, genericResultsRet, sf,path);
bytecodeGen.visit(sf); bytecodeGen.visit(sf);
return bytecodeGen.getClassFiles(); return bytecodeGen.getClassFiles();
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {