[Git][java-team/annotation-indexer][master] 6 commits: New upstream version 1.17

Emmanuel Bourg (@ebourg) gitlab at salsa.debian.org
Mon Dec 5 13:06:58 GMT 2022



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


Commits:
3cbd7164 by Emmanuel Bourg at 2022-12-05T13:52:44+01:00
New upstream version 1.17
- - - - -
7e75a1fb by Emmanuel Bourg at 2022-12-05T13:52:44+01:00
Update upstream source from tag 'upstream/1.17'

Update to upstream version '1.17'
with Debian dir 9aed2f276fcde5124f89251e9a7eefd86143bf38
- - - - -
4db7b4d9 by Emmanuel Bourg at 2022-12-05T14:04:56+01:00
Updated the Maven rules

- - - - -
a27edcbb by Emmanuel Bourg at 2022-12-05T14:05:24+01:00
Require Java 11+

- - - - -
7057a9c6 by Emmanuel Bourg at 2022-12-05T14:05:29+01:00
Standards-Version updated to 4.6.1

- - - - -
9b37e809 by Emmanuel Bourg at 2022-12-05T14:05:36+01:00
Upload to unstable

- - - - -


11 changed files:

- .github/workflows/release-drafter.yml
- .mvn/extensions.xml
- Jenkinsfile
- debian/changelog
- debian/control
- debian/maven.ignoreRules
- debian/maven.properties
- pom.xml
- 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:

=====================================
.github/workflows/release-drafter.yml
=====================================
@@ -11,6 +11,6 @@ jobs:
     runs-on: ubuntu-latest
     steps:
       # Drafts your next Release notes as Pull Requests are merged into "master"
-      - uses: release-drafter/release-drafter at v5.15.0
+      - uses: release-drafter/release-drafter at v5
         env:
           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}


=====================================
.mvn/extensions.xml
=====================================
@@ -2,6 +2,6 @@
   <extension>
     <groupId>io.jenkins.tools.incrementals</groupId>
     <artifactId>git-changelist-maven-extension</artifactId>
-    <version>1.2</version>
+    <version>1.4</version>
   </extension>
 </extensions>


=====================================
Jenkinsfile
=====================================
@@ -4,7 +4,7 @@
  * allowing one to test against multiple Jenkins versions.
  */
 buildPlugin(useContainerAgent: true, configurations: [
-  [ platform: 'linux', jdk: '8' ],
   [ platform: 'linux', jdk: '11' ],
-  [ platform: 'windows', jdk: '11' ]
+  [ platform: 'windows', jdk: '11' ],
+  [ platform: 'linux', jdk: '17' ],
 ])


=====================================
debian/changelog
=====================================
@@ -1,3 +1,13 @@
+annotation-indexer (1.17-1) unstable; urgency=medium
+
+  * Team upload.
+  * New upstream release
+    - Updated the Maven rules
+    - Require Java 11+
+  * Standards-Version updated to 4.6.1
+
+ -- Emmanuel Bourg <ebourg at apache.org>  Mon, 05 Dec 2022 14:05:33 +0100
+
 annotation-indexer (1.16-2) unstable; urgency=medium
 
   * Team upload.


=====================================
debian/control
=====================================
@@ -5,12 +5,12 @@ Maintainer: Debian Java Maintainers <pkg-java-maintainers at lists.alioth.debian.or
 Uploaders: James Page <james.page at ubuntu.com>
 Build-Depends:
  debhelper-compat (= 13),
- default-jdk,
+ default-jdk (>= 2:1.11),
  junit4,
  libmaven-compiler-plugin-java,
  libmetainf-services-java,
  maven-debian-helper
-Standards-Version: 4.6.0.1
+Standards-Version: 4.6.1
 Vcs-Git: https://salsa.debian.org/java-team/annotation-indexer.git
 Vcs-Browser: https://salsa.debian.org/java-team/annotation-indexer
 Homepage: https://github.com/jenkinsci/lib-annotation-indexer


=====================================
debian/maven.ignoreRules
=====================================
@@ -15,3 +15,4 @@
 #   junit junit jar s/3\\..*/3.x/
 
 com.jolira hickory * * * *
+com.karuslabs elementary * * * *


=====================================
debian/maven.properties
=====================================
@@ -4,4 +4,4 @@
 
 maven.test.skip=true
 
-maven.compiler.release=8
+maven.compiler.release=11


=====================================
pom.xml
=====================================
@@ -4,22 +4,33 @@
   <parent>
     <groupId>org.jenkins-ci</groupId>
     <artifactId>jenkins</artifactId>
-    <version>1.69</version>
+    <version>1.92</version>
     <relativePath />
   </parent>
 
   <artifactId>annotation-indexer</artifactId>
+  <version>1.17</version>
   <name>Annotation Indexer</name>
-  <version>1.16</version>
-  <description>
-    Creates index of annotations.
-  </description>
+  <description>Creates index of annotations.</description>
   <url>https://github.com/jenkinsci/lib-${project.artifactId}</url>
 
+  <licenses>
+    <license>
+      <name>MIT License</name>
+      <url>https://opensource.org/licenses/MIT</url>
+    </license>
+  </licenses>
+
+  <scm>
+    <connection>scm:git:https://github.com/${gitHubRepo}.git</connection>
+    <developerConnection>scm:git:git at github.com:${gitHubRepo}.git</developerConnection>
+    <tag>annotation-indexer-1.17</tag>
+    <url>https://github.com/${gitHubRepo}</url>
+  </scm>
+
   <properties>
-    <revision>1.16</revision>
+    <revision>1.17</revision>
     <changelist>-SNAPSHOT</changelist>
-    <java.level>8</java.level>
     <gitHubRepo>jenkinsci/lib-${project.artifactId}</gitHubRepo>
   </properties>
 
@@ -27,41 +38,42 @@
     <dependency>
       <groupId>org.kohsuke.metainf-services</groupId>
       <artifactId>metainf-services</artifactId>
-      <version>1.8</version>
+      <version>1.9</version>
       <optional>true</optional>
     </dependency>
     <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
+      <groupId>com.karuslabs</groupId>
+      <artifactId>elementary</artifactId>
+      <version>1.1.3</version>
+      <scope>test</scope>
+      <exclusions>
+        <exclusion>
+          <groupId>com.karuslabs</groupId>
+          <artifactId>annotations</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>org.junit.jupiter</groupId>
+      <artifactId>junit-jupiter</artifactId>
       <scope>test</scope>
     </dependency>
     <dependency>
-      <groupId>com.jolira</groupId>
-      <artifactId>hickory</artifactId>
-      <version>1.0.0</version>
+      <groupId>org.junit.vintage</groupId>
+      <artifactId>junit-vintage-engine</artifactId>
       <scope>test</scope>
     </dependency>
   </dependencies>
 
-  <scm>
-    <connection>scm:git:git://github.com/${gitHubRepo}.git</connection>
-    <developerConnection>scm:git:git at github.com:${gitHubRepo}.git</developerConnection>
-    <url>https://github.com/${gitHubRepo}</url>
-    <tag>annotation-indexer-1.16</tag>
-  </scm>
-
-  <licenses>
-    <license>
-      <name>MIT License</name>
-      <url>https://opensource.org/licenses/MIT</url>
-    </license>
-  </licenses>
-
   <repositories>
     <repository>
       <id>repo.jenkins-ci.org</id>
       <url>https://repo.jenkins-ci.org/public/</url>
     </repository>
+    <repository>
+      <id>elementary-releases</id>
+      <url>https://repo.karuslabs.com/repository/elementary-releases/</url>
+    </repository>
   </repositories>
 
 </project>


=====================================
src/main/java/org/jvnet/hudson/annotation_indexer/Index.java
=====================================
@@ -35,7 +35,7 @@ public class Index {
      */
     public static <T extends AnnotatedElement> Iterable<T> list(Class<? extends Annotation> type, ClassLoader cl, final Class<T> subType) throws IOException {
         final Iterable<AnnotatedElement> base = list(type,cl);
-        return new Iterable<T>() {
+        return new Iterable<>() {
             @Override
             public Iterator<T> iterator() {
                 return new SubtypeIterator<>(base.iterator(), subType);
@@ -78,10 +78,10 @@ public class Index {
      */
     public static Iterable<AnnotatedElement> list(final Class<? extends Annotation> type, final ClassLoader cl) throws IOException {
         Set<String> ids = listClassNames(type, cl);
-        return new Iterable<AnnotatedElement>() {
+        return new Iterable<>() {
             @Override
             public Iterator<AnnotatedElement> iterator() {
-                return new Iterator<AnnotatedElement>() {
+                return new Iterator<>() {
                     /**
                      * Next element to return.
                      */


=====================================
src/test/java/org/jvnet/hudson/annotation_indexer/AnnotationProcessorImplTest.java
=====================================
@@ -1,8 +1,16 @@
 package org.jvnet.hudson.annotation_indexer;
 
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import com.karuslabs.elementary.Results;
+import com.karuslabs.elementary.junit.JavacExtension;
+import com.karuslabs.elementary.junit.annotations.Inline;
+import com.karuslabs.elementary.junit.annotations.Options;
+import com.karuslabs.elementary.junit.annotations.Processors;
 import java.io.IOException;
 import java.lang.annotation.ElementType;
-import java.lang.annotation.Inherited;
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
 import java.lang.annotation.Target;
@@ -13,66 +21,97 @@ import java.net.URL;
 import java.net.URLClassLoader;
 import java.util.Collections;
 import java.util.Iterator;
-import net.java.dev.hickory.testing.Compilation;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
 
-public class AnnotationProcessorImplTest {
+ at ExtendWith(JavacExtension.class)
+ at Options("-Werror")
+ at Processors(AnnotationProcessorImpl.class)
+class AnnotationProcessorImplTest {
 
-    @Test public void allInOne() {
-        Compilation compilation = new Compilation();
-        compilation.addSource("some.api.A").
-                addLine("package some.api;").
-                addLine("@" + Indexed.class.getCanonicalName() + " @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME) public @interface A {}");
-        compilation.addSource("some.pkg.Stuff").
-                addLine("package some.pkg;").
-                addLine("@some.api.A public class Stuff {}");
-        compilation.doCompile(null, "-source", "8");
-        assertEquals(Collections.emptyList(), Utils.filterObsoleteSourceVersionWarnings(compilation.getDiagnostics()));
-        assertEquals("some.pkg.Stuff" + System.getProperty("line.separator"), Utils.getGeneratedResource(compilation, "META-INF/services/annotations/some.api.A"));
+    @Inline(
+            name = "some.api.A",
+            source = {
+                "package some.api;",
+                "@org.jvnet.hudson.annotation_indexer.Indexed @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME) public @interface A {}",
+            })
+    @Inline(
+            name = "some.pkg.Stuff",
+            source = {
+                "package some.pkg;",
+                "@some.api.A public class Stuff {}",
+            })
+    @Test
+    void allInOne(Results results) {
+        assertEquals(Collections.emptyList(), results.diagnostics);
+        assertEquals("some.pkg.Stuff" + System.getProperty("line.separator"), Utils.getGeneratedResource(results.sources, "META-INF/services/annotations/some.api.A"));
     }
 
-    @Indexed @Retention(RetentionPolicy.RUNTIME) public @interface A {}
-    @Test public void separate() {
-        Compilation compilation = new Compilation();
-        compilation.addSource("some.pkg.Stuff").
-                addLine("package some.pkg;").
-                addLine("@" + A.class.getCanonicalName() + " public class Stuff {}");
-        compilation.doCompile(null, "-source", "8");
-        assertEquals(Collections.emptyList(), Utils.filterObsoleteSourceVersionWarnings(compilation.getDiagnostics()));
-        assertEquals("some.pkg.Stuff" + System.getProperty("line.separator"), Utils.getGeneratedResource(compilation, "META-INF/services/annotations/" + A.class.getName()));
+    @Inline(
+            name = "some.pkg.A",
+            source = {
+                "package some.pkg;",
+                "@org.jvnet.hudson.annotation_indexer.Indexed @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME) public @interface A {}",
+            })
+    @Inline(
+            name = "some.pkg.Stuff",
+            source = {
+                "package some.pkg;",
+                "@A public class Stuff {}",
+            })
+    @Test
+    void separate(Results results) {
+        assertEquals(Collections.emptyList(), results.diagnostics);
+        assertEquals("some.pkg.Stuff" + System.getProperty("line.separator"), Utils.getGeneratedResource(results.sources, "META-INF/services/annotations/some.pkg.A"));
     }
 
-    @Test public void incremental() {
-        Compilation compilation = new Compilation();
-        compilation.addSource("some.pkg.Stuff").
-                addLine("package some.pkg;").
-                addLine("@" + A.class.getCanonicalName() + " public class Stuff {}");
-        compilation.doCompile(null, "-source", "8");
-        assertEquals(Collections.emptyList(), Utils.filterObsoleteSourceVersionWarnings(compilation.getDiagnostics()));
-        assertEquals("some.pkg.Stuff" + System.getProperty("line.separator"), Utils.getGeneratedResource(compilation, "META-INF/services/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", "8");
-        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/services/annotations/" + A.class.getName()));
+    @Inline(
+            name = "some.pkg.A",
+            source = {
+                "package some.pkg;",
+                "@org.jvnet.hudson.annotation_indexer.Indexed @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME) public @interface A {}",
+            })
+    @Inline(
+            name = "some.pkg.Stuff",
+            source = {
+                "package some.pkg;",
+                "@A public class Stuff {}",
+            })
+    @Inline(
+            name = "some.pkg.MoreStuff",
+            source = {
+                "package some.pkg;",
+                "@A public class MoreStuff {}",
+            })
+    @Test
+    void multiple(Results results) {
+        assertEquals(Collections.emptyList(), results.diagnostics);
+        assertEquals("some.pkg.MoreStuff" + System.getProperty("line.separator") + "some.pkg.Stuff" + System.getProperty("line.separator"), Utils.getGeneratedResource(results.sources, "META-INF/services/annotations/some.pkg.A"));
     }
 
-    @Indexed @Retention(RetentionPolicy.RUNTIME) @Inherited public @interface B {}
-    @B public static abstract class Super {}
-    @Test public void subclass() {
-        Compilation compilation = new Compilation();
-        compilation.addSource("some.pkg.Stuff").
-                addLine("package some.pkg;").
-                addLine("public class Stuff extends " + Super.class.getCanonicalName() + " {}");
-        compilation.doCompile(null, "-source", "8");
-        assertEquals(Collections.emptyList(), Utils.filterObsoleteSourceVersionWarnings(compilation.getDiagnostics()));
+    @Inline(
+            name = "some.pkg.B",
+            source = {
+                "package some.pkg;",
+                "@org.jvnet.hudson.annotation_indexer.Indexed @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME) @java.lang.annotation.Inherited public @interface B {}",
+            })
+    @Inline(
+            name = "some.pkg.Super",
+            source = {
+                "package some.pkg;",
+                "@B public abstract class Super {}",
+            })
+    @Inline(
+            name = "some.pkg.Stuff",
+            source = {
+                "package some.pkg;",
+                "public class Stuff extends Super {}",
+            })
+    @Test
+    void subclass(Results results) {
+        assertEquals(Collections.emptyList(), results.diagnostics);
         /* 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/services/annotations/" + B.class.getName()));
+        assertEquals("some.pkg.Stuff\n", Utils.getGeneratedResource(results.sources, "META-INF/services/annotations/some.pkg.B"));
         */
     }
 
@@ -81,7 +120,7 @@ public class AnnotationProcessorImplTest {
     public static class Problematic {@C public Inaccessible bad() {return null;}}
     public static class Fine {@C public String good() {return null;}}
     public static class StillOK {@C public void whatever() {}}
-    @Test public void linkageErrorRobustness() throws Exception {
+    @Test void linkageErrorRobustness() throws Exception {
         ClassLoader cl = new URLClassLoader(new URL[] {Index.class.getProtectionDomain().getCodeSource().getLocation(), AnnotationProcessorImplTest.class.getProtectionDomain().getCodeSource().getLocation()}, AnnotationProcessorImplTest.class.getClassLoader().getParent()) {
             @Override protected Class<?> findClass(String name) throws ClassNotFoundException {
                 if (name.endsWith("$Inaccessible")) {
@@ -104,7 +143,7 @@ public class AnnotationProcessorImplTest {
 
     @Indexed @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.CONSTRUCTOR) public @interface OnConst {}
     public static class Stuff {@OnConst public Stuff() {}}
-    @Test public void constructors() throws Exception {
+    @Test void constructors() throws Exception {
         Iterator<AnnotatedElement> it = Index.list(OnConst.class, Stuff.class.getClassLoader()).iterator();
         assertTrue(it.hasNext());
         Constructor<?> c = (Constructor<?>) it.next();
@@ -114,7 +153,7 @@ public class AnnotationProcessorImplTest {
 
 
     @Indexed @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.PACKAGE) public @interface OnPackage {}
-    @Test public void packageinfo() throws IOException {
+    @Test void packageinfo() throws IOException {
         Iterator<AnnotatedElement> it = Index.list(OnPackage.class, Stuff.class.getClassLoader()).iterator();
         assertTrue(it.hasNext());
         final Package p = (Package) it.next();


=====================================
src/test/java/org/jvnet/hudson/annotation_indexer/Utils.java
=====================================
@@ -1,70 +1,24 @@
 package org.jvnet.hudson.annotation_indexer;
 
-import java.io.FileNotFoundException;
 import java.io.IOException;
-import java.lang.reflect.Field;
-import java.util.ArrayList;
-import java.util.Collections;
+import java.io.UncheckedIOException;
 import java.util.List;
-import java.util.Locale;
-import javax.tools.Diagnostic;
-import javax.tools.FileObject;
-import javax.tools.JavaFileManager;
 import javax.tools.JavaFileObject;
 import javax.tools.StandardLocation;
-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 source 1.6 is obsolete in java 9
-    // This usually appears with other warnings
-    public static final List<String> IGNORE = Collections.singletonList(
-            "RELEASE_6" // Filter out warnings about source 1.6 is obsolete in java 9+
-    );
-
-    public static List<Diagnostic<? extends JavaFileObject>> filterObsoleteSourceVersionWarnings(List<Diagnostic<? extends JavaFileObject>> diagnostics) {
-        List<Diagnostic<? extends JavaFileObject>> r = new ArrayList<>();
-        for (Diagnostic<? extends JavaFileObject> d : diagnostics) {
-            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");
-            f.setAccessible(true);
-            return (JavaFileManager) f.get(compilation);
-        } catch (Exception x) {
-            throw new AssertionError(x);
+    public static String getGeneratedResource(List<JavaFileObject> generated, String filename) {
+        JavaFileObject fo = generated.stream()
+                .filter(it -> it.getName().equals("/" + StandardLocation.CLASS_OUTPUT + "/" + filename))
+                .findFirst()
+                .orElse(null);
+        if (fo == null) {
+            return null;
         }
-    }
-
-    /**
-     * Replacement for {@link Compilation#getGeneratedResource} that actually works.
-     * https://code.google.com/p/jolira-tools/issues/detail?id=11
-     */
-    public static String getGeneratedResource(Compilation compilation, String filename) {
         try {
-            FileObject fo = fileManager(compilation).getFileForOutput(StandardLocation.CLASS_OUTPUT, "", filename, null);
-            if (fo == null) {
-                return null;
-            }
             return fo.getCharContent(true).toString();
-        } catch (FileNotFoundException x) {
-            return null;
-        } catch (IOException x) {
-            throw new RuntimeException(x);
+        } catch (IOException e) {
+            throw new UncheckedIOException(e);
         }
     }
 



View it on GitLab: https://salsa.debian.org/java-team/annotation-indexer/-/compare/7ca31ed22cb1f79ddaf7a278d5adc9ea04d3b5d8...9b37e8099406dcacddccb780e424c0a48dd312b9

-- 
View it on GitLab: https://salsa.debian.org/java-team/annotation-indexer/-/compare/7ca31ed22cb1f79ddaf7a278d5adc9ea04d3b5d8...9b37e8099406dcacddccb780e424c0a48dd312b9
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/20221205/b18107d3/attachment.htm>


More information about the pkg-java-commits mailing list