Update dependencies and let plugin build with java 19

This commit is contained in:
Daniel Holle 2023-05-24 15:16:51 +02:00
parent 3c469b567b
commit 7c6cd3a4cf
6 changed files with 48 additions and 74 deletions

View File

@ -1,8 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/> <classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="lib" path="lib/animal-sniffer-annotations.jar"/> <classpathentry kind="lib" path="lib/animal-sniffer-annotations.jar"/>
<classpathentry kind="lib" path="lib/antlr-runtime.jar"/> <classpathentry kind="lib" path="lib/antlr-runtime.jar"/>
<classpathentry kind="lib" path="lib/antlr4-runtime.jar"/> <classpathentry kind="lib" path="lib/antlr4-runtime.jar"/>
@ -18,12 +17,13 @@
<classpathentry kind="lib" path="lib/icu4j.jar"/> <classpathentry kind="lib" path="lib/icu4j.jar"/>
<classpathentry kind="lib" path="lib/j2objc-annotations.jar"/> <classpathentry kind="lib" path="lib/j2objc-annotations.jar"/>
<classpathentry kind="lib" path="lib/javassist.jar"/> <classpathentry kind="lib" path="lib/javassist.jar"/>
<classpathentry kind="lib" path="lib/JavaTXcompiler.jar" sourcepath="/JavaTXcompiler/src/main/java"/> <classpathentry kind="lib" path="lib/JavaTXcompiler.jar" sourcepath="C:/Users/Daniel/Documents/Programming/JavaCompilerCore/src/main/java"/>
<classpathentry kind="lib" path="lib/javax.json.jar"/> <classpathentry kind="lib" path="lib/javax.json.jar"/>
<classpathentry kind="lib" path="lib/jsr305.jar"/> <classpathentry kind="lib" path="lib/jsr305.jar"/>
<classpathentry kind="lib" path="lib/listenablefuture.jar"/> <classpathentry kind="lib" path="lib/listenablefuture.jar"/>
<classpathentry kind="lib" path="lib/org.abego.treelayout.core.jar"/> <classpathentry kind="lib" path="lib/org.abego.treelayout.core.jar"/>
<classpathentry kind="lib" path="lib/reflections.jar"/> <classpathentry kind="lib" path="lib/reflections.jar"/>
<classpathentry kind="lib" path="lib/ST4.jar"/> <classpathentry kind="lib" path="lib/ST4.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="bin"/> <classpathentry kind="output" path="bin"/>
</classpath> </classpath>

View File

@ -14,7 +14,6 @@ Require-Bundle: org.eclipse.swt,
org.eclipse.core.resources, org.eclipse.core.resources,
org.eclipse.jdt.ui, org.eclipse.jdt.ui,
org.eclipse.osgi, org.eclipse.osgi,
org.eclipse.equinox.ds;visibility:=reexport,
org.eclipse.jface, org.eclipse.jface,
org.eclipse.e4.ui.services, org.eclipse.e4.ui.services,
org.eclipse.e4.core.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.equinox.p2.metadata;bundle-version="2.3.100",
org.eclipse.ui.ide, org.eclipse.ui.ide,
org.eclipse.ui.views org.eclipse.ui.views
Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-RequiredExecutionEnvironment: JavaSE-19
Bundle-ActivationPolicy: lazy Bundle-ActivationPolicy: lazy
Bundle-ClassPath: ., Bundle-ClassPath: .,
lib/animal-sniffer-annotations.jar, lib/animal-sniffer-annotations.jar,

View File

@ -25,9 +25,6 @@ import org.eclipse.core.runtime.Status;
import com.google.common.base.Strings; 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.core.JavaTXCompiler;
import de.dhbwstuttgart.exceptions.TypeinferenceException; import de.dhbwstuttgart.exceptions.TypeinferenceException;
import de.dhbwstuttgart.syntaxtree.ClassOrInterface; import de.dhbwstuttgart.syntaxtree.ClassOrInterface;
@ -93,15 +90,14 @@ public class Typinferenz {
Set<TypeInsert> tips = new HashSet<>(); Set<TypeInsert> tips = new HashSet<>();
String outputDirectory = getOutputDirectory(); String outputDirectory = getOutputDirectory();
File currentFile = editor.getFilePath().toFile();
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); var generatedClasses = compiler.generateBytecode(sf, newResults);
compiler.generateBytecodForFile(outputDirectory, /*bytecode,*/ sf, new ArrayList<>(forByteCode), simplifyResultsForAllSourceFiles); compiler.writeClassFile(generatedClasses, new File(outputDirectory));
//this.writeClassFile(outputDirectory, bytecode); } catch (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);
deleteClassFileIfExists(outputDirectory, sf.getClasses()); deleteClassFileIfExists(outputDirectory, sf.getClasses());
@ -110,7 +106,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, simplifyResultsForAllSourceFiles)); tips.addAll(TypeInsertFactory.createTypeInsertPoints(parsedSource, tiResult, compiler.getGeneratedGenerics().get(compiler.sourceFiles.get(currentFile)).get(i)));
i++; i++;
for (TypeInsert p : tips) { for (TypeInsert p : tips) {
TypeReplaceMarker toAdd = new TypeReplaceMarker(editor, tiResult, p); TypeReplaceMarker toAdd = new TypeReplaceMarker(editor, tiResult, p);
@ -170,7 +166,7 @@ public class Typinferenz {
} }
//wird nicht mehr benoetigt //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<>();
@ -184,7 +180,7 @@ public class Typinferenz {
return new HashMap<>(); return new HashMap<>();
} }
} }*/
public void deleteClassFileIfExists(String outputDirectory, List<ClassOrInterface> clazzes) { public void deleteClassFileIfExists(String outputDirectory, List<ClassOrInterface> clazzes) {
for (ClassOrInterface clazz : clazzes) { for (ClassOrInterface clazz : clazzes) {

View File

@ -65,7 +65,7 @@ import typinferenzplugin.error.ErrorOutput;
//Example from: http://help.eclipse.org/indigo/index.jsp //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<EFBFBD>r .jav-Dateien Anmerkung: F<EFBFBD>r jede ge<EFBFBD>ffntete Datei wird eine
* Instanz des Editors erstellt * Instanz des Editors erstellt
* *
* @author janulrich * @author janulrich
@ -82,12 +82,12 @@ public class JavEditor extends TextEditor implements UnifyResultListener {
private JavOutline outlinePage; private JavOutline outlinePage;
/** /**
* Der SyntaxBaum für das aktuell geöffnete Dokument. * Der SyntaxBaum f<EFBFBD>r das aktuell ge<EFBFBD>ffnete Dokument.
*/ */
private SourceFile sourceFile; private SourceFile sourceFile;
/** /**
* Die TypeReplaceMarker für das aktuell geöffnete Dokument * Die TypeReplaceMarker f<EFBFBD>r das aktuell ge<EFBFBD>ffnete Dokument
*/ */
private Vector<JavMarker> errorMarkers = new Vector<JavMarker>(); private Vector<JavMarker> errorMarkers = new Vector<JavMarker>();
private Vector<TypeReplaceMarker> typeReplaceMarkers = new Vector<TypeReplaceMarker>(); private Vector<TypeReplaceMarker> typeReplaceMarkers = new Vector<TypeReplaceMarker>();
@ -150,7 +150,7 @@ public class JavEditor extends TextEditor implements UnifyResultListener {
* Startet den Typinferenzalgorithmus, zuvor sollten alle Marker entfernt werden * Startet den Typinferenzalgorithmus, zuvor sollten alle Marker entfernt werden
*/ */
private void typeReconstruction() { 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() { Runnable cancelledChecker = new Runnable() {
@Override @Override
@ -177,7 +177,7 @@ public class JavEditor extends TextEditor implements UnifyResultListener {
// do something long running // do something long running
if (!this.typeReplaceMarkers.isEmpty() || !this.errorMarkers.isEmpty()) { if (!this.typeReplaceMarkers.isEmpty() || !this.errorMarkers.isEmpty()) {
LOG.log(new Status(ERROR, PLUGIN_ID, LOG.log(new Status(ERROR, PLUGIN_ID,
"Fehler: Zuerst Marker löschen, bevor Typinferenz durchgeführt werden kann")); "Fehler: Zuerst Marker l<EFBFBD>schen, bevor Typinferenz durchgef<65>hrt werden kann"));
return; return;
} }
@ -458,9 +458,9 @@ public class JavEditor extends TextEditor implements UnifyResultListener {
public void onNewTypeResultFound(UnifyResultEvent evt) { public void onNewTypeResultFound(UnifyResultEvent evt) {
Vector<JavMarker> markers = updateMarkers(evt); Vector<JavMarker> markers = updateMarkers(evt);
// Anschließend die TypeReplaceMarker im Quellcode anzeigen: // Anschlie<EFBFBD>end die TypeReplaceMarker im Quellcode anzeigen:
// https://stackoverflow.com/questions/8945371/how-to-implement-quick-fix-quick-assist-for-custom-eclipse-editor // 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<EFBFBD>hrt. Berechnete
// Marker:\n" + markers)); // Marker:\n" + markers));
Display.getDefault().asyncExec(() -> { Display.getDefault().asyncExec(() -> {
updateGuiWithNewMarkers(markers); updateGuiWithNewMarkers(markers);

View File

@ -6,8 +6,8 @@
<packaging>pom</packaging> <packaging>pom</packaging>
<properties> <properties>
<tycho.version>1.5.1</tycho.version> <tycho.version>3.0.4</tycho.version>
<eclipse-repo.url>http://download.eclipse.org/eclipse/updates/4.7</eclipse-repo.url> <eclipse-repo.url>https://download.eclipse.org/eclipse/updates/4.27</eclipse-repo.url>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<downloadSources>true</downloadSources> <downloadSources>true</downloadSources>
<downloadJavadocs>true</downloadJavadocs> <downloadJavadocs>true</downloadJavadocs>
@ -31,7 +31,7 @@
<dependency> <dependency>
<groupId>org.antlr</groupId> <groupId>org.antlr</groupId>
<artifactId>antlr4</artifactId> <artifactId>antlr4</artifactId>
<version>4.7</version> <version>4.11.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>commons-io</groupId> <groupId>commons-io</groupId>
@ -82,7 +82,7 @@
<dependency> <dependency>
<groupId>org.antlr</groupId> <groupId>org.antlr</groupId>
<artifactId>antlr4</artifactId> <artifactId>antlr4</artifactId>
<version>4.7</version> <version>4.11.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>commons-io</groupId> <groupId>commons-io</groupId>
@ -237,21 +237,7 @@
<artifactId>tycho-p2-publisher-plugin</artifactId> <artifactId>tycho-p2-publisher-plugin</artifactId>
<version>${tycho.version}</version> <version>${tycho.version}</version>
<configuration> <configuration>
<profiles>JavaSE-1.8,JavaSE-9,JavaSE-10,JavaSE-11,JavaSE-12,JavaSE-13</profiles> <profiles>JavaSE-19</profiles>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<verbose>true</verbose>
<fork>true</fork>
<executable>/home/michael/programs/jdk/jdk8u232-b09/bin/javac</executable>
<compilerVersion>1.8</compilerVersion>
<source>1.8</source>
<target>1.8</target>
</configuration> </configuration>
</plugin> </plugin>
</plugins> </plugins>

View File

@ -2,42 +2,35 @@
<?pde version="3.8"?> <?pde version="3.8"?>
<target name="JavaCompilerPlugin.Target" sequenceNumber="2"> <target name="JavaCompilerPlugin.Target" sequenceNumber="2">
<locations> <locations>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="ch.qos.logback.slf4j" version="1.0.7.v201505121915"/>
<unit id="ch.qos.logback.slf4j.source" version="1.0.7.v201505121915"/>
<unit id="org.hamcrest" version="1.1.0.v20090501071000"/>
<unit id="org.hamcrest.text" version="1.1.0.v20090501071000"/>
<unit id="org.mockito" version="1.9.5.v201605172210"/>
<unit id="org.mockito.source" version="1.9.5.v201605172210"/>
<unit id="org.slf4j.api" version="1.7.2.v20121108-1250"/>
<unit id="org.slf4j.api.source" version="1.7.2.v20121108-1250"/>
<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/R20160520211859/repository/"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit"> <location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
<repository location="http://download.eclipse.org/technology/swtbot/releases/2.8.0/"/> <repository location="https://download.eclipse.org/eclipse/updates/4.27/"/>
<unit id="org.apache.log4j" version="1.2.15.v201012070815"/> <unit id="org.eclipse.equinox.p2.sdk.feature.group" version="3.11.1900.v20230120-0604"/>
<unit id="org.apache.log4j.source" version="1.2.15.v201012070815"/> <unit id="org.eclipse.equinox.sdk.feature.group" version="3.23.700.v20230220-1352"/>
<unit id="org.eclipse.swtbot.eclipse.feature.group" version="2.8.0.201906121535"/> <unit id="org.eclipse.platform.sdk" version="4.27.0.I20230302-0300"/>
<unit id="org.eclipse.swtbot.eclipse.test.junit.feature.group" version="2.8.0.201906121535"/> </location>
<unit id="org.eclipse.swtbot.feature.group" version="2.8.0.201906121535"/> <location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.eclipse.swtbot.forms.feature.group" version="2.8.0.201906121535"/> <repository location="https://download.eclipse.org/tools/orbit/downloads/drops/R20230302014618/repository/"/>
<unit id="org.eclipse.swtbot.ide.feature.group" version="2.8.0.201906121535"/> <unit id="ch.qos.logback.slf4j" version="1.2.3.v20221112-0806"/>
<unit id="ch.qos.logback.slf4j.source" version="1.2.3.v20221112-0806"/>
<unit id="org.hamcrest" version="2.2.0.v20210711-0821"/>
<unit id="org.hamcrest.source" version="2.2.0.v20210711-0821"/>
<unit id="org.mockito.mockito-core" version="4.8.1.v20221103-2317"/>
<unit id="org.mockito.mockito-core.source" version="4.8.1.v20221103-2317"/>
<unit id="org.slf4j.api" version="1.7.30.v20221112-0806"/>
<unit id="org.slf4j.api.source" version="1.7.30.v20221112-0806"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
<repository location="https://download.eclipse.org/technology/swtbot/releases/latest/"/>
<unit id="org.eclipse.swtbot.feature.group" version="4.0.0.202206011610"/>
<unit id="org.hamcrest.core" version="1.3.0.v20180420-1519"/> <unit id="org.hamcrest.core" version="1.3.0.v20180420-1519"/>
<unit id="org.hamcrest.core.source" version="1.3.0.v20180420-1519"/> <unit id="org.hamcrest.core.source" version="1.3.0.v20180420-1519"/>
<unit id="org.hamcrest.library" version="1.3.0.v20180524-2246"/> <unit id="org.hamcrest.library" version="1.3.0.v20180524-2246"/>
<unit id="org.hamcrest.library.source" version="1.3.0.v20180524-2246"/> <unit id="org.hamcrest.library.source" version="1.3.0.v20180524-2246"/>
</location> <unit id="org.eclipse.swtbot.eclipse.feature.group" version="4.0.0.202206011610"/>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit"> <unit id="org.eclipse.swtbot.forms.feature.group" version="4.0.0.202206011610"/>
<repository location="http://download.eclipse.org/eclipse/updates/4.7"/> <unit id="org.eclipse.swtbot.ide.feature.group" version="4.0.0.202206011610"/>
<unit id="org.eclipse.platform.sdk" version="0.0.0"/> <unit id="org.eclipse.swtbot.junit5.feature.group" version="4.0.0.202206011610"/>
<unit id="org.eclipse.equinox.sdk.feature.group" version="0.0.0"/>
<unit id="org.eclipse.equinox.p2.sdk.feature.group" version="0.0.0"/>
</location> </location>
</locations> </locations>
<targetJRE path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/java-11-openjdk-amd64"/> <targetJRE path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-19"/>
<environment> </target>
<os>linux</os>
<ws>gtk</ws>
<arch>x86_64</arch>
</environment>
</target>