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"?>
<classpath>
<classpathentry kind="src" path="bundles/JavaCompilerPlugin.Plugin/src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
<attributes>
<attribute name="module" value="true"/>

View File

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