Bug 171: Marker verschwinden jetzt, wenn man "Speichern" drückt.

This commit is contained in:
michael 2020-03-21 17:04:15 +01:00
parent 32f3baf995
commit 96ffe4fa79
4 changed files with 131 additions and 124 deletions
JavaCompilerPlugin
bundles/JavaCompilerPlugin.Plugin
.classpath
META-INF
src/typinferenzplugin/editor
releng/JavaCompilerPlugin.Configuration

@ -1,32 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="lib" path="lib/animal-sniffer-annotations.jar"/>
<classpathentry kind="lib" path="lib/antlr-runtime.jar"/>
<classpathentry kind="lib" path="lib/antlr4-runtime.jar"/>
<classpathentry kind="lib" path="lib/antlr4.jar"/>
<classpathentry kind="lib" path="lib/asm.jar"/>
<classpathentry kind="lib" path="lib/bcel.jar"/>
<classpathentry kind="lib" path="lib/checker-qual.jar"/>
<classpathentry kind="lib" path="lib/commons-io.jar"/>
<classpathentry kind="lib" path="lib/error_prone_annotations.jar"/>
<classpathentry kind="lib" path="lib/failureaccess.jar"/>
<classpathentry kind="lib" path="lib/guava.jar"/>
<classpathentry kind="lib" path="lib/icu4j.jar"/>
<classpathentry kind="lib" path="lib/j2objc-annotations.jar"/>
<classpathentry kind="lib" path="lib/javassist.jar"/>
<classpathentry kind="lib" path="lib/JavaTXcompiler.jar" sourcepath="/JavaTXcompiler"/>
<classpathentry kind="lib" path="lib/javax.json.jar"/>
<classpathentry kind="lib" path="lib/jsr305.jar"/>
<classpathentry kind="lib" path="lib/listenablefuture.jar"/>
<classpathentry kind="lib" path="lib/org.abego.treelayout.core.jar"/>
<classpathentry kind="lib" path="lib/reflections.jar"/>
<classpathentry kind="lib" path="lib/ST4.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="lib" path="lib/animal-sniffer-annotations.jar"/>
<classpathentry kind="lib" path="lib/antlr-runtime.jar"/>
<classpathentry kind="lib" path="lib/antlr4-runtime.jar" sourcepath="C:/Users/michael/.m2/repository/org/antlr/antlr4-runtime/4.7/antlr4-runtime-4.7-sources.jar"/>
<classpathentry kind="lib" path="lib/antlr4.jar"/>
<classpathentry kind="lib" path="lib/asm.jar"/>
<classpathentry kind="lib" path="lib/commons-collections4.jar"/>
<classpathentry kind="lib" path="lib/bcel.jar"/>
<classpathentry kind="lib" path="lib/checker-qual.jar"/>
<classpathentry kind="lib" path="lib/commons-io.jar"/>
<classpathentry kind="lib" path="lib/error_prone_annotations.jar"/>
<classpathentry kind="lib" path="lib/failureaccess.jar"/>
<classpathentry kind="lib" path="lib/guava.jar"/>
<classpathentry kind="lib" path="lib/icu4j.jar"/>
<classpathentry kind="lib" path="lib/j2objc-annotations.jar"/>
<classpathentry kind="lib" path="lib/javassist.jar"/>
<classpathentry kind="lib" path="lib/JavaTXcompiler.jar" sourcepath="/JavaTXcompiler"/>
<classpathentry kind="lib" path="lib/javax.json.jar"/>
<classpathentry kind="lib" path="lib/jsr305.jar"/>
<classpathentry kind="lib" path="lib/listenablefuture.jar"/>
<classpathentry kind="lib" path="lib/org.abego.treelayout.core.jar"/>
<classpathentry kind="lib" path="lib/reflections.jar"/>
<classpathentry kind="lib" path="lib/ST4.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>

@ -9,10 +9,10 @@ Require-Bundle: org.eclipse.swt,
javax.inject,
org.eclipse.core.runtime,
org.eclipse.jface.text,
org.eclipse.jdt.ui,
org.eclipse.ui.editors,
org.eclipse.ui.workbench,
org.eclipse.core.resources,
org.eclipse.jdt.ui,
org.eclipse.osgi,
org.eclipse.equinox.ds;visibility:=reexport,
org.eclipse.jface,
@ -40,6 +40,7 @@ Bundle-ClassPath: .,
lib/bcel.jar,
lib/checker-qual.jar,
lib/commons-io.jar,
lib/commons-collections4.jar,
lib/error_prone_annotations.jar,
lib/failureaccess.jar,
lib/guava.jar,

@ -11,10 +11,10 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.TreeSet;
import java.util.Vector;
import java.util.stream.Collectors;
import javax.inject.Inject;
import org.apache.commons.collections4.map.MultiKeyMap;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
@ -33,13 +33,9 @@ import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.Position;
import org.eclipse.jface.text.source.Annotation;
import org.eclipse.jface.text.source.IAnnotationModel;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.IPartListener;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.editors.text.TextEditor;
import org.eclipse.ui.part.FileEditorInput;
import org.eclipse.ui.texteditor.IDocumentProvider;
@ -50,7 +46,6 @@ import de.dhbwstuttgart.exceptions.TypeinferenceException;
import de.dhbwstuttgart.syntaxtree.SourceFile;
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric;
import de.dhbwstuttgart.typedeployment.TypeInsertPoint;
import de.dhbwstuttgart.typeinference.result.ResultSet;
import de.dhbwstuttgart.typeinference.unify.UnifyResultEvent;
import de.dhbwstuttgart.typeinference.unify.UnifyResultListener;
import typinferenzplugin.Activator;
@ -63,7 +58,7 @@ import typinferenzplugin.error.ErrorOutput;
//Example from: http://help.eclipse.org/indigo/index.jsp
/**
* Editor für .jav-Dateien Anmerkung: Für jede ge<EFBFBD>ffntete Datei wird eine
* Editor für .jav-Dateien Anmerkung: Für jede geöffntete Datei wird eine
* Instanz des Editors erstellt
*
* @author janulrich
@ -80,12 +75,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<JavMarker> errorMarkers = new Vector<JavMarker>();
private Vector<TypeReplaceMarker> typeReplaceMarkers = new Vector<TypeReplaceMarker>();
@ -134,8 +129,7 @@ public class JavEditor extends TextEditor implements UnifyResultListener {
try {
super.doSetInput(getEditorInput());
super.initializeEditor();
setSourceViewerConfiguration(new JavViewerConfiguration(this));
initializeEditor();
} catch (CoreException e) {
e.printStackTrace();
}
@ -349,13 +343,24 @@ public class JavEditor extends TextEditor implements UnifyResultListener {
trm.adjustResultSet(typeReplaceMarker);
}
updateGuiWithNewMarkers(typeReplaceMarkers);
MultiKeyMap<Integer, TypeInsertPoint> alreadyInserted = new MultiKeyMap<>();
for (TypeInsertPoint additionalPoint : typeReplaceMarker.getInsertPoint().getAdditionalPoints() ) {
if (!additionalPoint.isGenericClassInsertPoint()) {
org.antlr.v4.runtime.Token additionalPt = additionalPoint.point;
alreadyInserted.put(additionalPt.getLine(), additionalPt.getCharPositionInLine(), additionalPoint);
}
}
boolean actualHasGenericClassInserts = typeReplaceMarker.getInsertPoint().getAdditionalPoints().stream().anyMatch(tip -> tip.isGenericClassInsertPoint());
if (actualHasGenericClassInserts) {
for (TypeReplaceMarker marker : typeReplaceMarkers) {
Iterator<TypeInsertPoint> addiPoints = marker.getInsertPoint().getAdditionalPointsUnsorted().iterator();
while (addiPoints.hasNext()) {
if (addiPoints.next().isGenericClassInsertPoint()) {
TypeInsertPoint addiPoint = addiPoints.next();
if (addiPoint.isGenericClassInsertPoint()) {
addiPoints.remove();
} else if (alreadyInserted.get(addiPoint.point.getLine(), addiPoint.point.getCharPositionInLine()) != null) {
addiPoints.remove();
}
}
@ -367,16 +372,6 @@ public class JavEditor extends TextEditor implements UnifyResultListener {
other.getInsertPoint().getAdditionalPointsUnsorted().remove(additionalPoint);
}
}
Collection<ResultSet> newResultSets = typeReplaceMarkers.stream().map(trm -> trm.getResultSets()).flatMap(rs -> rs.stream()).collect(Collectors.toSet());
/**
Vector<JavMarker> markers = new Vector<JavMarker>();
Vector<JavMarker> newMarkers = typeinference.updateWithResult(markers, new Vector<>(newResultSets));
updateGuiWithNewMarkersSynchron(newMarkers);
this.errorMarkers.addAll(newMarkers);
**/
}
private void removeMarkers() {

@ -38,6 +38,11 @@
<artifactId>commons-io</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
<version>4.0</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
@ -89,6 +94,11 @@
<artifactId>guava</artifactId>
<version>27.0.1-jre</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
<version>4.0</version>
</dependency>
<dependency>
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>
@ -114,32 +124,32 @@
<version>${tycho.version}</version>
<extensions>true</extensions>
<configuration>
<environment>
<os>linux</os>
<ws>gtk</ws>
<arch>x86</arch>
</environment>
<environment>
<os>linux</os>
<ws>gtk</ws>
<arch>x86_64</arch>
</environment>
<environment>
<os>win32</os>
<ws>win32</ws>
<arch>x86_64</arch>
</environment>
<environment>
<os>win32</os>
<ws>win32</ws>
<arch>x86</arch>
</environment>
<environment>
<os>macosx</os>
<ws>cocoa</ws>
<arch>x86_64</arch>
</environment>
</configuration>
<environment>
<os>linux</os>
<ws>gtk</ws>
<arch>x86</arch>
</environment>
<environment>
<os>linux</os>
<ws>gtk</ws>
<arch>x86_64</arch>
</environment>
<environment>
<os>win32</os>
<ws>win32</ws>
<arch>x86_64</arch>
</environment>
<environment>
<os>win32</os>
<ws>win32</ws>
<arch>x86</arch>
</environment>
<environment>
<os>macosx</os>
<ws>cocoa</ws>
<arch>x86_64</arch>
</environment>
</configuration>
</plugin>
<plugin>
@ -200,50 +210,50 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jarsigner-plugin</artifactId>
<version>1.2</version>
<configuration>
<keystore>${keystore.location}</keystore>
<!-- keystore>C:\Users\michael\git\Plugin_JCC\JavaCompilerPlugin\releng\JavaCompilerPlugin.Sign\eclipse-signing.keystore</keystore -->
<storepass>PASSWORD</storepass>
<alias>dhbw.de</alias>
<keypass>PASSWORD</keypass>
</configuration>
<executions>
<execution>
<id>sign</id>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-p2-publisher-plugin</artifactId>
<version>${tycho.version}</version>
<configuration>
<profiles>JavaSE-1.8,JavaSE-9,JavaSE-10,JavaSE-11,JavaSE-12,JavaSE-13</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>
</plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jarsigner-plugin</artifactId>
<version>1.2</version>
<configuration>
<keystore>${keystore.location}</keystore>
<!-- keystore>C:\Users\michael\git\Plugin_JCC\JavaCompilerPlugin\releng\JavaCompilerPlugin.Sign\eclipse-signing.keystore</keystore -->
<storepass>PASSWORD</storepass>
<alias>dhbw.de</alias>
<keypass>PASSWORD</keypass>
</configuration>
<executions>
<execution>
<id>sign</id>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-p2-publisher-plugin</artifactId>
<version>${tycho.version}</version>
<configuration>
<profiles>JavaSE-1.8,JavaSE-9,JavaSE-10,JavaSE-11,JavaSE-12,JavaSE-13</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>
</plugin>
</plugins>
</build>
</project>