diff --git a/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/.classpath b/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/.classpath index d0cf1b5..450beb6 100644 --- a/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/.classpath +++ b/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/.classpath @@ -1,8 +1,7 @@ - - + @@ -18,12 +17,13 @@ - + + diff --git a/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/META-INF/MANIFEST.MF b/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/META-INF/MANIFEST.MF index 9b2c476..2319fd5 100644 --- a/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/META-INF/MANIFEST.MF +++ b/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/META-INF/MANIFEST.MF @@ -14,7 +14,6 @@ Require-Bundle: org.eclipse.swt, org.eclipse.core.resources, org.eclipse.jdt.ui, org.eclipse.osgi, - org.eclipse.equinox.ds;visibility:=reexport, org.eclipse.jface, org.eclipse.e4.ui.services, org.eclipse.e4.core.services, @@ -29,7 +28,7 @@ Require-Bundle: org.eclipse.swt, org.eclipse.equinox.p2.metadata;bundle-version="2.3.100", org.eclipse.ui.ide, org.eclipse.ui.views -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-19 Bundle-ActivationPolicy: lazy Bundle-ClassPath: ., lib/animal-sniffer-annotations.jar, diff --git a/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/src/typinferenzplugin/Typinferenz.java b/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/src/typinferenzplugin/Typinferenz.java index a469f41..c94ec94 100644 --- a/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/src/typinferenzplugin/Typinferenz.java +++ b/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/src/typinferenzplugin/Typinferenz.java @@ -25,9 +25,6 @@ import org.eclipse.core.runtime.Status; import com.google.common.base.Strings; -import de.dhbwstuttgart.bytecode.BytecodeGen; -import de.dhbwstuttgart.bytecode.Exception.BytecodeGeneratorError; -import de.dhbwstuttgart.bytecode.genericsGeneratorTypes.GenericGenratorResultForSourceFile; import de.dhbwstuttgart.core.JavaTXCompiler; import de.dhbwstuttgart.exceptions.TypeinferenceException; import de.dhbwstuttgart.syntaxtree.ClassOrInterface; @@ -93,15 +90,14 @@ public class Typinferenz { Set tips = new HashSet<>(); String outputDirectory = getOutputDirectory(); + File currentFile = editor.getFilePath().toFile(); - List simplifyResultsForAllSourceFiles = new ArrayList<>();//wird in getBytecode bestimmt if (this.forByteCode.size() > 0) { for (SourceFile sf : compiler.sourceFiles.values()) { try { - //HashMap bytecode = getBytecode(sf, this.forByteCode, outputDirectory, genericResults); - compiler.generateBytecodForFile(outputDirectory, /*bytecode,*/ sf, new ArrayList<>(forByteCode), simplifyResultsForAllSourceFiles); - //this.writeClassFile(outputDirectory, bytecode); - } catch (BytecodeGeneratorError | IOException ex) { + var generatedClasses = compiler.generateBytecode(sf, newResults); + compiler.writeClassFile(generatedClasses, new File(outputDirectory)); + } catch (IOException ex) { ErrorMarker toAdd = new ErrorMarker(ex.getMessage(), new CodePoint(sf.getOffset())); ret.add(toAdd); deleteClassFileIfExists(outputDirectory, sf.getClasses()); @@ -110,7 +106,7 @@ public class Typinferenz { } int i = 0; for (ResultSet tiResult : newResults) { - tips.addAll(TypeInsertFactory.createTypeInsertPoints(parsedSource, tiResult, newResults, simplifyResultsForAllSourceFiles)); + tips.addAll(TypeInsertFactory.createTypeInsertPoints(parsedSource, tiResult, compiler.getGeneratedGenerics().get(compiler.sourceFiles.get(currentFile)).get(i))); i++; for (TypeInsert p : tips) { TypeReplaceMarker toAdd = new TypeReplaceMarker(editor, tiResult, p); @@ -170,7 +166,7 @@ public class Typinferenz { } //wird nicht mehr benoetigt - public synchronized HashMap getBytecode(SourceFile sf, Collection resultSets, String path, List genericResultsRet) { + /*public synchronized HashMap getBytecode(SourceFile sf, Collection resultSets, String path, List genericResultsRet) { try { HashMap classFiles = new HashMap<>(); @@ -184,7 +180,7 @@ public class Typinferenz { return new HashMap<>(); } - } + }*/ public void deleteClassFileIfExists(String outputDirectory, List clazzes) { for (ClassOrInterface clazz : clazzes) { diff --git a/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/src/typinferenzplugin/editor/JavEditor.java b/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/src/typinferenzplugin/editor/JavEditor.java index 2fc2862..8de5a5b 100644 --- a/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/src/typinferenzplugin/editor/JavEditor.java +++ b/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/src/typinferenzplugin/editor/JavEditor.java @@ -65,7 +65,7 @@ import typinferenzplugin.error.ErrorOutput; //Example from: http://help.eclipse.org/indigo/index.jsp /** - * Editor für .jav-Dateien Anmerkung: Für jede geöffntete Datei wird eine + * Editor f�r .jav-Dateien Anmerkung: F�r jede ge�ffntete Datei wird eine * Instanz des Editors erstellt * * @author janulrich @@ -82,12 +82,12 @@ public class JavEditor extends TextEditor implements UnifyResultListener { private JavOutline outlinePage; /** - * Der SyntaxBaum für das aktuell geöffnete Dokument. + * Der SyntaxBaum f�r das aktuell ge�ffnete Dokument. */ private SourceFile sourceFile; /** - * Die TypeReplaceMarker für das aktuell geöffnete Dokument + * Die TypeReplaceMarker f�r das aktuell ge�ffnete Dokument */ private Vector errorMarkers = new Vector(); private Vector typeReplaceMarkers = new Vector(); @@ -150,7 +150,7 @@ public class JavEditor extends TextEditor implements UnifyResultListener { * Startet den Typinferenzalgorithmus, zuvor sollten alle Marker entfernt werden */ private void typeReconstruction() { - Job job = Job.create("Doing type recoustruction...", (ICoreRunnable) monitor -> { + Job job = Job.create("Doing type reconstruction...", (ICoreRunnable) monitor -> { Runnable cancelledChecker = new Runnable() { @Override @@ -177,7 +177,7 @@ public class JavEditor extends TextEditor implements UnifyResultListener { // do something long running if (!this.typeReplaceMarkers.isEmpty() || !this.errorMarkers.isEmpty()) { LOG.log(new Status(ERROR, PLUGIN_ID, - "Fehler: Zuerst Marker löschen, bevor Typinferenz durchgeführt werden kann")); + "Fehler: Zuerst Marker l�schen, bevor Typinferenz durchgef�hrt werden kann")); return; } @@ -458,9 +458,9 @@ public class JavEditor extends TextEditor implements UnifyResultListener { public void onNewTypeResultFound(UnifyResultEvent evt) { Vector markers = updateMarkers(evt); - // Anschließend die TypeReplaceMarker im Quellcode anzeigen: + // Anschlie�end die TypeReplaceMarker im Quellcode anzeigen: // https://stackoverflow.com/questions/8945371/how-to-implement-quick-fix-quick-assist-for-custom-eclipse-editor - // LOG.log(new Status(INFO, PLUGIN_ID, "Typinferez durchgeführt. Berechnete + // LOG.log(new Status(INFO, PLUGIN_ID, "Typinferez durchgef�hrt. Berechnete // Marker:\n" + markers)); Display.getDefault().asyncExec(() -> { updateGuiWithNewMarkers(markers); diff --git a/JavaCompilerPlugin/releng/JavaCompilerPlugin.Configuration/pom.xml b/JavaCompilerPlugin/releng/JavaCompilerPlugin.Configuration/pom.xml index 28cacef..980c0b7 100644 --- a/JavaCompilerPlugin/releng/JavaCompilerPlugin.Configuration/pom.xml +++ b/JavaCompilerPlugin/releng/JavaCompilerPlugin.Configuration/pom.xml @@ -6,8 +6,8 @@ pom - 1.5.1 - http://download.eclipse.org/eclipse/updates/4.7 + 3.0.4 + https://download.eclipse.org/eclipse/updates/4.27 UTF-8 true true @@ -31,7 +31,7 @@ org.antlr antlr4 - 4.7 + 4.11.0 commons-io @@ -82,7 +82,7 @@ org.antlr antlr4 - 4.7 + 4.11.0 commons-io @@ -237,21 +237,7 @@ tycho-p2-publisher-plugin ${tycho.version} - JavaSE-1.8,JavaSE-9,JavaSE-10,JavaSE-11,JavaSE-12,JavaSE-13 - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.8.1 - - true - true - /home/michael/programs/jdk/jdk8u232-b09/bin/javac - 1.8 - 1.8 - 1.8 + JavaSE-19 diff --git a/JavaCompilerPlugin/releng/JavaCompilerPlugin.Target/JavaCompilerPlugin.Target.target b/JavaCompilerPlugin/releng/JavaCompilerPlugin.Target/JavaCompilerPlugin.Target.target index f60045c..573f64d 100644 --- a/JavaCompilerPlugin/releng/JavaCompilerPlugin.Target/JavaCompilerPlugin.Target.target +++ b/JavaCompilerPlugin/releng/JavaCompilerPlugin.Target/JavaCompilerPlugin.Target.target @@ -2,42 +2,35 @@ - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - - - - - - + + + + - - - linux - gtk - x86_64 - - \ No newline at end of file + + \ No newline at end of file