[Git][java-team/annotation-indexer][upstream] 3 commits: New upstream version 1.10

Emmanuel Bourg gitlab at salsa.debian.org
Wed Jun 6 14:10:24 BST 2018


Emmanuel Bourg pushed to branch upstream at Debian Java Maintainers / annotation-indexer


Commits:
791cfe19 by Emmanuel Bourg at 2018-06-06T14:36:14+02:00
New upstream version 1.10
- - - - -
55071460 by Emmanuel Bourg at 2018-06-06T14:36:56+02:00
New upstream version 1.11
- - - - -
33090e53 by Emmanuel Bourg at 2018-06-06T14:38:10+02:00
New upstream version 1.12
- - - - -


6 changed files:

- .gitignore
- pom.xml
- src/main/java/org/jvnet/hudson/annotation_indexer/AnnotationProcessorImpl.java
- src/main/java/org/jvnet/hudson/annotation_indexer/Index.java
- src/test/java/org/jvnet/hudson/annotation_indexer/AnnotationProcessorImplTest.java
- src/test/java/org/jvnet/hudson/annotation_indexer/Utils.java


Changes:

=====================================
.gitignore
=====================================
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,3 @@
 /target/
+.idea/
+*.iml


=====================================
pom.xml
=====================================
--- a/pom.xml
+++ b/pom.xml
@@ -4,12 +4,13 @@
   <parent>
     <groupId>org.jenkins-ci</groupId>
     <artifactId>jenkins</artifactId>
-    <version>1.32</version>
+    <version>1.37</version>
+    <relativePath />
   </parent>
 
   <artifactId>annotation-indexer</artifactId>
   <name>Annotation Indexer</name>
-  <version>1.9</version>
+  <version>1.12</version>
   <description>
     Creates index of annotations.
   </description>
@@ -18,7 +19,7 @@
     <dependency>
       <groupId>org.kohsuke.metainf-services</groupId>
       <artifactId>metainf-services</artifactId>
-      <version>1.5</version>
+      <version>1.7</version>
       <optional>true</optional>
     </dependency>
     <dependency>
@@ -38,6 +39,7 @@
   <scm>
     <connection>scm:git:git://github.com/jenkinsci/lib-${project.artifactId}.git</connection>
     <developerConnection>scm:git:git at github.com:jenkinsci/lib-${project.artifactId}.git</developerConnection>
+    <tag>annotation-indexer-1.12</tag>
   </scm>
 
   <licenses>


=====================================
src/main/java/org/jvnet/hudson/annotation_indexer/AnnotationProcessorImpl.java
=====================================
--- a/src/main/java/org/jvnet/hudson/annotation_indexer/AnnotationProcessorImpl.java
+++ b/src/main/java/org/jvnet/hudson/annotation_indexer/AnnotationProcessorImpl.java
@@ -6,8 +6,7 @@ import javax.annotation.processing.AbstractProcessor;
 import javax.annotation.processing.Processor;
 import javax.annotation.processing.RoundEnvironment;
 import javax.annotation.processing.SupportedAnnotationTypes;
-import javax.annotation.processing.SupportedSourceVersion;
-import static javax.lang.model.SourceVersion.RELEASE_6;
+import javax.lang.model.SourceVersion;
 import javax.lang.model.element.AnnotationMirror;
 import javax.lang.model.element.Element;
 import javax.lang.model.element.TypeElement;
@@ -35,7 +34,6 @@ import java.util.TreeSet;
  *
  * @author Kohsuke Kawaguchi
  */
- at SupportedSourceVersion(RELEASE_6)
 @SupportedAnnotationTypes("*")
 @SuppressWarnings({"Since15"})
 @MetaInfServices(Processor.class)
@@ -111,6 +109,8 @@ public class AnnotationProcessorImpl extends AbstractProcessor {
                 }
             } catch (FileNotFoundException x) {
                 // OK, created for the first time
+            } catch (java.nio.file.NoSuchFileException x) {
+                // OK, created for the first time
             }
             return elements;
         }
@@ -141,12 +141,18 @@ public class AnnotationProcessorImpl extends AbstractProcessor {
     @Override
     public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
         if (roundEnv.processingOver() || roundEnv.errorRaised())
+            // TODO we should not write until processingOver
             return false;
 
         execute(annotations, roundEnv);
         return false;
     }
 
+    @Override
+    public SourceVersion getSupportedSourceVersion() {
+        return SourceVersion.latest();
+    }
+
     protected void execute(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
         // map from indexable annotation names, to actual uses
         Map<String,Use> output = new HashMap<String,Use>();


=====================================
src/main/java/org/jvnet/hudson/annotation_indexer/Index.java
=====================================
--- a/src/main/java/org/jvnet/hudson/annotation_indexer/Index.java
+++ b/src/main/java/org/jvnet/hudson/annotation_indexer/Index.java
@@ -107,6 +107,8 @@ public class Index {
                                 LOGGER.log(Level.FINE, "Failed to load: "+name,e);
                             } catch (LinkageError x) {
                                 LOGGER.log(Level.WARNING, "Failed to load " + name, x);
+                            } catch (RuntimeException x) {
+                                LOGGER.log(Level.WARNING, "Failed to load " + name, x);
                             }
                         }
                     }


=====================================
src/test/java/org/jvnet/hudson/annotation_indexer/AnnotationProcessorImplTest.java
=====================================
--- a/src/test/java/org/jvnet/hudson/annotation_indexer/AnnotationProcessorImplTest.java
+++ b/src/test/java/org/jvnet/hudson/annotation_indexer/AnnotationProcessorImplTest.java
@@ -27,8 +27,8 @@ public class AnnotationProcessorImplTest {
                 addLine("package some.pkg;").
                 addLine("@some.api.A public class Stuff {}");
         compilation.doCompile(null, "-source", "6");
-        assertEquals(Collections.emptyList(), Utils.filterSupportedSourceVersionWarnings(compilation.getDiagnostics()));
-        assertEquals("some.pkg.Stuff\n", Utils.getGeneratedResource(compilation, "META-INF/annotations/some.api.A"));
+        assertEquals(Collections.emptyList(), Utils.filterObsoleteSourceVersionWarnings(compilation.getDiagnostics()));
+        assertEquals("some.pkg.Stuff" + System.getProperty("line.separator"), Utils.getGeneratedResource(compilation, "META-INF/annotations/some.api.A"));
     }
 
     @Indexed @Retention(RetentionPolicy.RUNTIME) public @interface A {}
@@ -38,8 +38,8 @@ public class AnnotationProcessorImplTest {
                 addLine("package some.pkg;").
                 addLine("@" + A.class.getCanonicalName() + " public class Stuff {}");
         compilation.doCompile(null, "-source", "6");
-        assertEquals(Collections.emptyList(), Utils.filterSupportedSourceVersionWarnings(compilation.getDiagnostics()));
-        assertEquals("some.pkg.Stuff\n", Utils.getGeneratedResource(compilation, "META-INF/annotations/" + A.class.getName()));
+        assertEquals(Collections.emptyList(), Utils.filterObsoleteSourceVersionWarnings(compilation.getDiagnostics()));
+        assertEquals("some.pkg.Stuff" + System.getProperty("line.separator"), Utils.getGeneratedResource(compilation, "META-INF/annotations/" + A.class.getName()));
     }
 
     @Test public void incremental() {
@@ -48,15 +48,15 @@ public class AnnotationProcessorImplTest {
                 addLine("package some.pkg;").
                 addLine("@" + A.class.getCanonicalName() + " public class Stuff {}");
         compilation.doCompile(null, "-source", "6");
-        assertEquals(Collections.emptyList(), Utils.filterSupportedSourceVersionWarnings(compilation.getDiagnostics()));
-        assertEquals("some.pkg.Stuff\n", Utils.getGeneratedResource(compilation, "META-INF/annotations/" + A.class.getName()));
+        assertEquals(Collections.emptyList(), Utils.filterObsoleteSourceVersionWarnings(compilation.getDiagnostics()));
+        assertEquals("some.pkg.Stuff" + System.getProperty("line.separator"), Utils.getGeneratedResource(compilation, "META-INF/annotations/" + A.class.getName()));
         compilation = new Compilation(compilation);
         compilation.addSource("some.pkg.MoreStuff").
                 addLine("package some.pkg;").
                 addLine("@" + A.class.getCanonicalName() + " public class MoreStuff {}");
         compilation.doCompile(null, "-source", "6");
-        assertEquals(Collections.emptyList(), Utils.filterSupportedSourceVersionWarnings(compilation.getDiagnostics()));
-        assertEquals("some.pkg.MoreStuff\nsome.pkg.Stuff\n", Utils.getGeneratedResource(compilation, "META-INF/annotations/" + A.class.getName()));
+        assertEquals(Collections.emptyList(), Utils.filterObsoleteSourceVersionWarnings(compilation.getDiagnostics()));
+        assertEquals("some.pkg.MoreStuff" + System.getProperty("line.separator") + "some.pkg.Stuff" + System.getProperty("line.separator"), Utils.getGeneratedResource(compilation, "META-INF/annotations/" + A.class.getName()));
     }
 
     @Indexed @Retention(RetentionPolicy.RUNTIME) @Inherited public @interface B {}
@@ -67,7 +67,7 @@ public class AnnotationProcessorImplTest {
                 addLine("package some.pkg;").
                 addLine("public class Stuff extends " + Super.class.getCanonicalName() + " {}");
         compilation.doCompile(null, "-source", "6");
-        assertEquals(Collections.emptyList(), Utils.filterSupportedSourceVersionWarnings(compilation.getDiagnostics()));
+        assertEquals(Collections.emptyList(), Utils.filterObsoleteSourceVersionWarnings(compilation.getDiagnostics()));
         /* XXX #7188605 currently broken on JDK 6; perhaps need to use a ElementScanner6 on roundEnv.rootElements whose visitType checks for annotations
         assertEquals("some.pkg.Stuff\n", Utils.getGeneratedResource(compilation, "META-INF/annotations/" + B.class.getName()));
         */


=====================================
src/test/java/org/jvnet/hudson/annotation_indexer/Utils.java
=====================================
--- a/src/test/java/org/jvnet/hudson/annotation_indexer/Utils.java
+++ b/src/test/java/org/jvnet/hudson/annotation_indexer/Utils.java
@@ -5,6 +5,7 @@ import java.io.IOException;
 import java.io.StringReader;
 import java.lang.reflect.Field;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 import java.util.Locale;
 import java.util.Properties;
@@ -20,21 +21,30 @@ import net.java.dev.hickory.testing.Compilation;
 // XXX partial copy of class from Stapler; should be pushed up into Hickory ASAP
 class Utils {
 
-    /**
-     * Filter out warnings about {@link SupportedSourceVersion}.
-     * {@code metainf-services-1.1.jar} produces {@code warning: No SupportedSourceVersion annotation found on org.kohsuke.metainf_services.AnnotationProcessorImpl, returning RELEASE_6.} which is irrelevant to us.
-     * (Development versions have already fixed this; when released and used here, delete this method.)
-     */
-    public static List<Diagnostic<? extends JavaFileObject>> filterSupportedSourceVersionWarnings(List<Diagnostic<? extends JavaFileObject>> diagnostics) {
+    // Filter out warnings about source 1.6 is obsolete in java 9
+    // This usually appears with other warnings
+    public static final List<String> IGNORE = Arrays.asList(
+            "source value 1.6 is obsolete and will be removed in a future release", // Filter out warnings about source 1.6 is obsolete in java 9
+            "To suppress warnings about obsolete options" // This usually appears with other warnings
+    );
+
+    public static List<Diagnostic<? extends JavaFileObject>> filterObsoleteSourceVersionWarnings(List<Diagnostic<? extends JavaFileObject>> diagnostics) {
         List<Diagnostic<? extends JavaFileObject>> r = new ArrayList<Diagnostic<? extends JavaFileObject>>();
         for (Diagnostic<? extends JavaFileObject> d : diagnostics) {
-            if (!d.getMessage(Locale.ENGLISH).contains("SupportedSourceVersion")) {
+            if (!isIgnored(d.getMessage(Locale.ENGLISH))) {
                 r.add(d);
             }
         }
         return r;
     }
 
+    private static boolean isIgnored(String message) {
+        for (String i : IGNORE) {
+            if (message.contains(i)) return true;
+        }
+        return false;
+    }
+
     private static JavaFileManager fileManager(Compilation compilation) {
         try {
             Field f = Compilation.class.getDeclaredField("jfm");



View it on GitLab: https://salsa.debian.org/java-team/annotation-indexer/compare/1261efe2e290a8bd3a090cf2bcada9cefa190460...33090e53075d25fd2db5912b6a6f140d51d53fcb

-- 
View it on GitLab: https://salsa.debian.org/java-team/annotation-indexer/compare/1261efe2e290a8bd3a090cf2bcada9cefa190460...33090e53075d25fd2db5912b6a6f140d51d53fcb
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20180606/acb5c35a/attachment.html>


More information about the pkg-java-commits mailing list