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

Emmanuel Bourg (@ebourg) gitlab at salsa.debian.org
Sat Apr 30 17:07:31 BST 2022



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


Commits:
3d42bd4b by Emmanuel Bourg at 2022-04-30T15:05:18+02:00
New upstream version 1.16
- - - - -
570e50fa by Emmanuel Bourg at 2022-04-30T15:05:19+02:00
Update upstream source from tag 'upstream/1.16'

Update to upstream version '1.16'
with Debian dir 5663c01ebca72232545f91e103b3c66ab9143427
- - - - -
d14101af by Emmanuel Bourg at 2022-04-30T18:07:13+02:00
New upstream release (1.16)

- - - - -


15 changed files:

- + .github/dependabot.yml
- .github/release-drafter.yml
- + .github/workflows/release-drafter.yml
- + .mvn/extensions.xml
- + .mvn/maven.config
- + Jenkinsfile
- README.md
- debian/changelog
- debian/maven.rules
- pom.xml
- src/main/java/org/jvnet/hudson/annotation_indexer/AnnotationProcessorImpl.java
- src/main/java/org/jvnet/hudson/annotation_indexer/Index.java
- src/main/java/org/jvnet/hudson/annotation_indexer/SubtypeIterator.java
- src/test/java/org/jvnet/hudson/annotation_indexer/AnnotationProcessorImplTest.java
- src/test/java/org/jvnet/hudson/annotation_indexer/Utils.java


Changes:

=====================================
.github/dependabot.yml
=====================================
@@ -0,0 +1,12 @@
+# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
+
+version: 2
+updates:
+  - package-ecosystem: "maven"
+    directory: "/"
+    schedule:
+      interval: "weekly"
+  - package-ecosystem: "github-actions"
+    directory: "/"
+    schedule:
+      interval: "weekly"


=====================================
.github/release-drafter.yml
=====================================
@@ -1,2 +1,4 @@
+# https://github.com/jenkinsci/.github/blob/master/.github/release-drafter.adoc
+
 _extends: .github
 tag-template: annotation-indexer-$NEXT_MINOR_VERSION


=====================================
.github/workflows/release-drafter.yml
=====================================
@@ -0,0 +1,16 @@
+# Automates creation of Release Drafts using Release Drafter
+# More Info: https://github.com/jenkinsci/.github/blob/master/.github/release-drafter.adoc
+
+on:
+  push:
+    branches:
+      - master
+
+jobs:
+  update_release_draft:
+    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
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}


=====================================
.mvn/extensions.xml
=====================================
@@ -0,0 +1,7 @@
+<extensions xmlns="http://maven.apache.org/EXTENSIONS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/EXTENSIONS/1.0.0 http://maven.apache.org/xsd/core-extensions-1.0.0.xsd">
+  <extension>
+    <groupId>io.jenkins.tools.incrementals</groupId>
+    <artifactId>git-changelist-maven-extension</artifactId>
+    <version>1.2</version>
+  </extension>
+</extensions>


=====================================
.mvn/maven.config
=====================================
@@ -0,0 +1,2 @@
+-Pconsume-incrementals
+-Pmight-produce-incrementals


=====================================
Jenkinsfile
=====================================
@@ -0,0 +1,10 @@
+/*
+ * While this is not a plugin, it is much simpler to reuse the pipeline code for CI. This allows for
+ * easy Linux/Windows testing and produces incrementals. The only feature that relates to plugins is
+ * allowing one to test against multiple Jenkins versions.
+ */
+buildPlugin(useContainerAgent: true, configurations: [
+  [ platform: 'linux', jdk: '8' ],
+  [ platform: 'linux', jdk: '11' ],
+  [ platform: 'windows', jdk: '11' ]
+])


=====================================
README.md
=====================================
@@ -5,7 +5,7 @@ It is used inside the [Jenkins project](http://jenkins.io), but it can be also u
 
 ## Javadoc
 
-To be published soon, see https://github.com/jenkins-infra/javadoc/pull/22
+Javadoc is published [here](https://javadoc.jenkins.io/component/annotation-indexer/)
 
 ## Changelog
 


=====================================
debian/changelog
=====================================
@@ -1,3 +1,10 @@
+annotation-indexer (1.16-1) unstable; urgency=medium
+
+  * Team upload.
+  * New upstream release
+
+ -- Emmanuel Bourg <ebourg at apache.org>  Sat, 30 Apr 2022 18:06:47 +0200
+
 annotation-indexer (1.15-1) unstable; urgency=medium
 
   * Team upload.


=====================================
debian/maven.rules
=====================================
@@ -16,4 +16,4 @@
 # and version starting with 3., replacing the version with 3.x
 #   junit junit jar s/3\\..*/3.x/
 
-junit junit jar s/4\..*/4.x/ * *
+junit junit jar s/.*/4.x/ * *


=====================================
pom.xml
=====================================
@@ -4,20 +4,23 @@
   <parent>
     <groupId>org.jenkins-ci</groupId>
     <artifactId>jenkins</artifactId>
-    <version>1.46</version>
+    <version>1.69</version>
     <relativePath />
   </parent>
 
   <artifactId>annotation-indexer</artifactId>
   <name>Annotation Indexer</name>
-  <version>1.15</version>
+  <version>1.16</version>
   <description>
     Creates index of annotations.
   </description>
+  <url>https://github.com/jenkinsci/lib-${project.artifactId}</url>
 
   <properties>
+    <revision>1.16</revision>
+    <changelist>-SNAPSHOT</changelist>
     <java.level>8</java.level>
-    <java.level.test>8</java.level.test>
+    <gitHubRepo>jenkinsci/lib-${project.artifactId}</gitHubRepo>
   </properties>
 
   <dependencies>
@@ -30,7 +33,6 @@
     <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
-      <version>4.13.1</version>
       <scope>test</scope>
     </dependency>
     <dependency>
@@ -42,17 +44,24 @@
   </dependencies>
 
   <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>
-    <url>https://github.com/jenkinsci/lib-annotation-indexer</url>
-    <tag>annotation-indexer-1.15</tag>
+    <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>http://jenkins-ci.org/mit-license</url>
+      <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>
+  </repositories>
+
 </project>


=====================================
src/main/java/org/jvnet/hudson/annotation_indexer/AnnotationProcessorImpl.java
=====================================
@@ -22,6 +22,8 @@ import java.io.InputStreamReader;
 import java.io.OutputStreamWriter;
 import java.io.PrintWriter;
 import java.lang.annotation.Retention;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.NoSuchFileException;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -50,11 +52,11 @@ public class AnnotationProcessorImpl extends AbstractProcessor {
         /**
          * Strings that designate FQCNs where annotations are used, either on a class or its members.
          */
-        final Set<String> classes = new TreeSet<String>();
+        final Set<String> classes = new TreeSet<>();
         /**
          * Keeps track of elements that has the annotation.
          */
-        final Set<Element> originatingElements = new HashSet<Element>();
+        final Set<Element> originatingElements = new HashSet<>();
 
         private Use(String annotationName) {
             this.annotationName = annotationName;
@@ -100,21 +102,16 @@ public class AnnotationProcessorImpl extends AbstractProcessor {
          * Loads existing index, if it exists.
          */
         List<String> loadExisting() throws IOException {
-            List<String> elements = new ArrayList<String>();
+            List<String> elements = new ArrayList<>();
             try {
                 FileObject in = processingEnv.getFiler().getResource(CLASS_OUTPUT, "", getIndexFileName());
                 // Read existing annotations, for incremental compilation.
-                BufferedReader is = new BufferedReader(new InputStreamReader(in.openInputStream(),"UTF-8"));
-                try {
+                try (BufferedReader is = new BufferedReader(new InputStreamReader(in.openInputStream(), StandardCharsets.UTF_8))) {
                     String line;
                     while ((line=is.readLine())!=null)
                         elements.add(line);
-                } finally {
-                    is.close();
                 }
-            } catch (FileNotFoundException x) {
-                // OK, created for the first time
-            } catch (java.nio.file.NoSuchFileException x) {
+            } catch (FileNotFoundException | NoSuchFileException x) {
                 // OK, created for the first time
             }
             return elements;
@@ -124,14 +121,11 @@ public class AnnotationProcessorImpl extends AbstractProcessor {
             try {
                 FileObject out = processingEnv.getFiler().createResource(CLASS_OUTPUT,
                         "", getIndexFileName(),
-                        originatingElements.toArray(new Element[originatingElements.size()]));
+                        originatingElements.toArray(new Element[0]));
 
-                PrintWriter w = new PrintWriter(new OutputStreamWriter(out.openOutputStream(),"UTF-8"));
-                try {
+                try (PrintWriter w = new PrintWriter(new OutputStreamWriter(out.openOutputStream(), StandardCharsets.UTF_8))) {
                     for (String el : classes)
                         w.println(el);
-                } finally {
-                    w.close();
                 }
             } catch (IOException x) {
                 processingEnv.getMessager().printMessage(Kind.ERROR, x.toString());
@@ -160,7 +154,7 @@ public class AnnotationProcessorImpl extends AbstractProcessor {
 
     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>();
+        Map<String,Use> output = new HashMap<>();
         scan(annotations, roundEnv, output);
         for (Use u : output.values())
             u.write();


=====================================
src/main/java/org/jvnet/hudson/annotation_indexer/Index.java
=====================================
@@ -7,6 +7,7 @@ import java.io.InputStreamReader;
 import java.lang.annotation.Annotation;
 import java.lang.reflect.AnnotatedElement;
 import java.net.URL;
+import java.nio.charset.StandardCharsets;
 import java.util.Arrays;
 import java.util.Enumeration;
 import java.util.Iterator;
@@ -35,8 +36,9 @@ 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>() {
+            @Override
             public Iterator<T> iterator() {
-                return new SubtypeIterator<AnnotatedElement,T>(base.iterator(), subType);
+                return new SubtypeIterator<>(base.iterator(), subType);
             }
         };
     }
@@ -59,7 +61,7 @@ public class Index {
                 URL url = res.nextElement();
 
                 try (InputStream is = url.openStream();
-                     BufferedReader r = new BufferedReader(new InputStreamReader(is, "UTF-8"))) {
+                     BufferedReader r = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8))) {
                     String line;
                     while ((line = r.readLine()) != null) {
                         ids.add(line);
@@ -77,6 +79,7 @@ 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>() {
+            @Override
             public Iterator<AnnotatedElement> iterator() {
                 return new Iterator<AnnotatedElement>() {
                     /**
@@ -86,13 +89,15 @@ public class Index {
 
                     private final Iterator<String> iditr = ids.iterator();
 
-                    private final List<AnnotatedElement> lookaheads = new LinkedList<AnnotatedElement>();
+                    private final List<AnnotatedElement> lookaheads = new LinkedList<>();
 
+                    @Override
                     public boolean hasNext() {
                         fetch();
                         return next!=null;
                     }
 
+                    @Override
                     public AnnotatedElement next() {
                         fetch();
                         AnnotatedElement r = next;
@@ -100,6 +105,7 @@ public class Index {
                         return r;
                     }
 
+                    @Override
                     public void remove() {
                         throw new UnsupportedOperationException();
                     }
@@ -127,11 +133,9 @@ public class Index {
                                 listAnnotatedElements(c.getDeclaredMethods());
                                 listAnnotatedElements(c.getDeclaredFields());
                                 listAnnotatedElements(c.getDeclaredConstructors());
-                            } catch (ClassNotFoundException e) {
-                                LOGGER.log(Level.FINE, "Failed to load: "+name,e);
-                            } catch (LinkageError x) {
-                                LOGGER.log(Level.WARNING, "Failed to load " + name, x);
-                            } catch (RuntimeException x) {
+                            } catch (ClassNotFoundException | NoClassDefFoundError x) {
+                                LOGGER.log(Level.FINE, "Failed to load: " + name, x);
+                            } catch (LinkageError | RuntimeException x) {
                                 LOGGER.log(Level.WARNING, "Failed to load " + name, x);
                             }
                         }


=====================================
src/main/java/org/jvnet/hudson/annotation_indexer/SubtypeIterator.java
=====================================
@@ -24,11 +24,13 @@ final class SubtypeIterator<T,U extends T> implements Iterator<U> {
         }
     }
 
+    @Override
     public boolean hasNext() {
         fetch();
         return fetched;
     }
 
+    @Override
     public U next() {
         fetch();
         if(!fetched)  throw new NoSuchElementException();
@@ -36,6 +38,7 @@ final class SubtypeIterator<T,U extends T> implements Iterator<U> {
         return type.cast(next);
     }
 
+    @Override
     public void remove() {
         core.remove();
     }


=====================================
src/test/java/org/jvnet/hudson/annotation_indexer/AnnotationProcessorImplTest.java
=====================================
@@ -15,7 +15,9 @@ import java.util.Collections;
 import java.util.Iterator;
 import net.java.dev.hickory.testing.Compilation;
 import org.junit.Test;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
 
 public class AnnotationProcessorImplTest {
 
@@ -105,7 +107,7 @@ public class AnnotationProcessorImplTest {
     @Test public void constructors() throws Exception {
         Iterator<AnnotatedElement> it = Index.list(OnConst.class, Stuff.class.getClassLoader()).iterator();
         assertTrue(it.hasNext());
-        Constructor<?> c = (Constructor) it.next();
+        Constructor<?> c = (Constructor<?>) it.next();
         assertEquals(Stuff.class, c.getDeclaringClass());
         assertFalse(it.hasNext());
     }


=====================================
src/test/java/org/jvnet/hudson/annotation_indexer/Utils.java
=====================================
@@ -2,15 +2,11 @@ package org.jvnet.hudson.annotation_indexer;
 
 import java.io.FileNotFoundException;
 import java.io.IOException;
-import java.io.StringReader;
 import java.lang.reflect.Field;
 import java.util.ArrayList;
-import java.util.Arrays;
+import java.util.Collections;
 import java.util.List;
 import java.util.Locale;
-import java.util.Properties;
-import java.util.TreeMap;
-import javax.annotation.processing.SupportedSourceVersion;
 import javax.tools.Diagnostic;
 import javax.tools.FileObject;
 import javax.tools.JavaFileManager;
@@ -23,12 +19,12 @@ 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 = Arrays.asList(
+    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<Diagnostic<? extends JavaFileObject>>();
+        List<Diagnostic<? extends JavaFileObject>> r = new ArrayList<>();
         for (Diagnostic<? extends JavaFileObject> d : diagnostics) {
             if (!isIgnored(d.getMessage(Locale.ENGLISH))) {
                 r.add(d);



View it on GitLab: https://salsa.debian.org/java-team/annotation-indexer/-/compare/aa7b32b131aa0d89c4cfd39cc138252513bcda37...d14101af2334d479d63a625a0bf73da762528738

-- 
View it on GitLab: https://salsa.debian.org/java-team/annotation-indexer/-/compare/aa7b32b131aa0d89c4cfd39cc138252513bcda37...d14101af2334d479d63a625a0bf73da762528738
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/20220430/42a7ca10/attachment.htm>


More information about the pkg-java-commits mailing list