[Git][java-team/access-modifier-checker][upstream] 2 commits: New upstream version 1.26
Emmanuel Bourg (@ebourg)
gitlab at salsa.debian.org
Sat Apr 30 14:04:23 BST 2022
Emmanuel Bourg pushed to branch upstream at Debian Java Maintainers / access-modifier-checker
Commits:
456dc964 by Emmanuel Bourg at 2022-04-30T14:59:12+02:00
New upstream version 1.26
- - - - -
5956cd66 by Emmanuel Bourg at 2022-04-30T14:59:25+02:00
New upstream version 1.27
- - - - -
15 changed files:
- .github/dependabot.yml
- Jenkinsfile
- access-modifier-annotation/pom.xml
- access-modifier-annotation/src/main/java/org/kohsuke/accmod/impl/ErrorListener.java
- access-modifier-annotation/src/main/java/org/kohsuke/accmod/impl/Location.java
- access-modifier-annotation/src/main/java/org/kohsuke/accmod/impl/RestrictedElement.java
- access-modifier-annotation/src/main/java/org/kohsuke/accmod/restrictions/DoNotUse.java
- access-modifier-annotation/src/main/java/org/kohsuke/accmod/restrictions/None.java
- access-modifier-checker/pom.xml
- access-modifier-checker/src/main/java/org/kohsuke/accmod/impl/AccessRestrictionFactory.java
- access-modifier-checker/src/main/java/org/kohsuke/accmod/impl/Checker.java
- access-modifier-checker/src/main/java/org/kohsuke/accmod/impl/EnforcerMojo.java
- access-modifier-checker/src/main/java/org/kohsuke/accmod/impl/Restrictions.java
- access-modifier-suppressions/pom.xml
- pom.xml
Changes:
=====================================
.github/dependabot.yml
=====================================
@@ -6,3 +6,7 @@ updates:
directory: "/"
schedule:
interval: "weekly"
+ - package-ecosystem: "github-actions"
+ directory: "/"
+ schedule:
+ interval: "weekly"
=====================================
Jenkinsfile
=====================================
@@ -1,8 +1,10 @@
-// While this isn't a plugin, it is much simpler to reuse the pipeline code for CI
-// allowing easy windows / linux testing and producing incrementals
-// the only feature that buildPlugin has that relates to plugins is allowing you to test against multiple jenkins versions
-buildPlugin(configurations: [
- [ platform: "linux", jdk: "8", jenkins: null ],
- [ platform: "linux", jdk: "11", jenkins: null, javaLevel: "8" ],
- [ platform: "windows", jdk: "11", jenkins: null, javaLevel: "8" ]
+/*
+ * 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', jenkins: null ],
+ [ platform: 'linux', jdk: '11', jenkins: null ],
+ [ platform: 'windows', jdk: '11', jenkins: null ]
])
=====================================
access-modifier-annotation/pom.xml
=====================================
@@ -4,7 +4,7 @@
<parent>
<artifactId>access-modifier</artifactId>
<groupId>org.kohsuke</groupId>
- <version>1.25</version>
+ <version>1.27</version>
</parent>
<artifactId>access-modifier-annotation</artifactId>
@@ -26,9 +26,5 @@
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>com.github.spotbugs</groupId>
- <artifactId>spotbugs-annotations</artifactId>
- </dependency>
</dependencies>
</project>
=====================================
access-modifier-annotation/src/main/java/org/kohsuke/accmod/impl/ErrorListener.java
=====================================
@@ -34,9 +34,11 @@ public interface ErrorListener {
* No-op listener.
*/
ErrorListener NULL = new ErrorListener() {
+ @Override
public void onError(Throwable t, Location loc, String msg) {
}
+ @Override
public void onWarning(Throwable t, Location loc, String msg) {
}
};
=====================================
access-modifier-annotation/src/main/java/org/kohsuke/accmod/impl/Location.java
=====================================
@@ -61,6 +61,7 @@ public interface Location {
* Obtains a human readable description of the location.
* Useful for an error message.
*/
+ @Override
String toString();
/**
=====================================
access-modifier-annotation/src/main/java/org/kohsuke/accmod/impl/RestrictedElement.java
=====================================
@@ -38,5 +38,6 @@ public interface RestrictedElement {
*/
boolean isInTheInspectedModule();
+ @Override
String toString();
}
=====================================
access-modifier-annotation/src/main/java/org/kohsuke/accmod/restrictions/DoNotUse.java
=====================================
@@ -34,26 +34,32 @@ import org.kohsuke.accmod.impl.RestrictedElement;
* @author Kohsuke Kawaguchi
*/
public class DoNotUse extends AccessRestriction {
+ @Override
public void written(Location loc, RestrictedElement target, ErrorListener errorListener) {
error(loc,target,errorListener);
}
+ @Override
public void usedAsSuperType(Location loc, RestrictedElement target, ErrorListener errorListener) {
error(loc,target,errorListener);
}
+ @Override
public void usedAsInterface(Location loc, RestrictedElement target, ErrorListener errorListener) {
error(loc,target,errorListener);
}
+ @Override
public void instantiated(Location loc, RestrictedElement target, ErrorListener errorListener) {
error(loc,target,errorListener);
}
+ @Override
public void invoked(Location loc, RestrictedElement target, ErrorListener errorListener) {
error(loc,target,errorListener);
}
+ @Override
public void read(Location loc, RestrictedElement target, ErrorListener errorListener) {
error(loc,target,errorListener);
}
=====================================
access-modifier-annotation/src/main/java/org/kohsuke/accmod/restrictions/None.java
=====================================
@@ -11,21 +11,27 @@ import org.kohsuke.accmod.impl.RestrictedElement;
* @author Kohsuke Kawaguchi
*/
public class None extends AccessRestriction {
+ @Override
public void usedAsSuperType(Location loc, RestrictedElement target, ErrorListener errorListener) {
}
+ @Override
public void usedAsInterface(Location loc, RestrictedElement target, ErrorListener errorListener) {
}
+ @Override
public void instantiated(Location loc, RestrictedElement target, ErrorListener errorListener) {
}
+ @Override
public void invoked(Location loc, RestrictedElement target, ErrorListener errorListener) {
}
+ @Override
public void read(Location loc, RestrictedElement target, ErrorListener errorListener) {
}
+ @Override
public void written(Location loc, RestrictedElement target, ErrorListener errorListener) {
}
}
=====================================
access-modifier-checker/pom.xml
=====================================
@@ -4,14 +4,14 @@
<parent>
<artifactId>access-modifier</artifactId>
<groupId>org.kohsuke</groupId>
- <version>1.25</version>
+ <version>1.27</version>
</parent>
<artifactId>access-modifier-checker</artifactId>
<packaging>maven-plugin</packaging>
<name>Custom Access Modifier Checker</name>
<properties>
- <maven.version>3.8.2</maven.version>
+ <maven.version>3.8.4</maven.version>
</properties>
<dependencies>
@@ -58,7 +58,7 @@
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
- <version>3.6.1</version>
+ <version>3.6.2</version>
<optional>true</optional> <!-- annotations are not used at runtime because @Retention(value=CLASS), they are needed only to build the plugin -->
</dependency>
</dependencies>
@@ -87,7 +87,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>mrm-maven-plugin</artifactId>
- <version>1.2.0</version>
+ <version>1.3.0</version>
<executions>
<execution>
<goals>
=====================================
access-modifier-checker/src/main/java/org/kohsuke/accmod/impl/AccessRestrictionFactory.java
=====================================
@@ -23,6 +23,8 @@
*/
package org.kohsuke.accmod.impl;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+
import org.kohsuke.accmod.AccessRestriction;
import org.objectweb.asm.Type;
@@ -35,9 +37,10 @@ import java.util.Map;
* @author Kohsuke Kawaguchi
*/
public class AccessRestrictionFactory {
- private final Map<String,AccessRestriction> instances = new HashMap<String, AccessRestriction>();
+ private final Map<String,AccessRestriction> instances = new HashMap<>();
private final ClassLoader cl;
+ @SuppressFBWarnings("EI_EXPOSE_REP2")
public AccessRestrictionFactory(ClassLoader cl) {
this.cl = cl;
}
=====================================
access-modifier-checker/src/main/java/org/kohsuke/accmod/impl/Checker.java
=====================================
@@ -23,6 +23,9 @@
*/
package org.kohsuke.accmod.impl;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+
+import java.nio.charset.StandardCharsets;
import java.util.HashSet;
import java.util.Set;
import org.apache.maven.plugin.logging.Log;
@@ -85,7 +88,7 @@ public class Checker {
* <li>internal name of a type + '.' + method name + method descriptor
* </ul>
*/
- private final Map<String,Restrictions> restrictions = new HashMap<String,Restrictions>();
+ private final Map<String,Restrictions> restrictions = new HashMap<>();
private final AccessRestrictionFactory factory;
@@ -93,6 +96,7 @@ public class Checker {
private int line;
+ @SuppressFBWarnings("EI_EXPOSE_REP2")
public Checker(ClassLoader dependencies, ErrorListener errorListener, Properties properties,
Log log) throws IOException {
this.dependencies = dependencies;
@@ -146,12 +150,11 @@ public class Checker {
*
* @param isInTheInspectedModule
* This value shows up in {@link RestrictedElement#isInTheInspectedModule()}.
- * @param stream
*/
public void loadRestrictions(InputStream stream, final boolean isInTheInspectedModule) throws IOException {
if (stream==null) return;
- BufferedReader r = new BufferedReader(new InputStreamReader(stream, "UTF-8"));
+ BufferedReader r = new BufferedReader(new InputStreamReader(stream, StandardCharsets.UTF_8));
String className;
while ((className=r.readLine())!=null) {
InputStream is = dependencies.getResourceAsStream(className.replace('.','/') + ".class");
@@ -200,10 +203,12 @@ public class Checker {
private AnnotationVisitor onAnnotationFor(final String keyName, String desc) {
if (RESTRICTED_DESCRIPTOR.equals(desc)) {
RestrictedElement target = new RestrictedElement() {
+ @Override
public boolean isInTheInspectedModule() {
return isInTheInspectedModule;
}
+ @Override
public String toString() { return keyName; }
};
return new Parser(target) {
@@ -211,11 +216,7 @@ public class Checker {
public void visitEnd() {
try {
restrictions.put(keyName,build(factory));
- } catch (ClassNotFoundException e) {
- failure(e);
- } catch (InstantiationException e) {
- failure(e);
- } catch (IllegalAccessException e) {
+ } catch (ClassNotFoundException | IllegalAccessException | InstantiationException e) {
failure(e);
}
}
@@ -241,12 +242,9 @@ public class Checker {
* Inspects a class for the restriction violations.
*/
public void checkClass(File clazz) throws IOException {
- FileInputStream in = new FileInputStream(clazz);
- try {
+ try (FileInputStream in = new FileInputStream(clazz)) {
ClassReader cr = new ClassReader(in);
cr.accept(new RestrictedClassVisitor(), SKIP_FRAMES);
- } finally {
- in.close();
}
}
@@ -359,26 +357,32 @@ public class Checker {
* Constant that represents the current location.
*/
private final Location currentLocation = new Location() {
+ @Override
public String getClassName() {
return className.replace('/','.');
}
+ @Override
public String getMethodName() {
return methodName;
}
+ @Override
public String getMethodDescriptor() {
return methodDesc;
}
+ @Override
public int getLineNumber() {
return line;
}
+ @Override
public String toString() {
return className+':'+line;
}
+ @Override
public ClassLoader getDependencyClassLoader() {
return dependencies;
}
@@ -429,6 +433,7 @@ public class Checker {
line = _line;
}
+ @Override
public void visitTypeInsn(int opcode, String type) {
switch (opcode) {
case Opcodes.NEW:
=====================================
access-modifier-checker/src/main/java/org/kohsuke/accmod/impl/EnforcerMojo.java
=====================================
@@ -18,7 +18,6 @@ import java.io.InputStream;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.List;
import java.util.Properties;
import java.util.stream.Collectors;
@@ -54,6 +53,7 @@ public class EnforcerMojo extends AbstractMojo {
@Parameter
private Properties properties;
+ @Override
@SuppressFBWarnings(value = {
"UWF_UNWRITTEN_FIELD",
"URLCONNECTION_SSRF_FD",
@@ -70,16 +70,17 @@ public class EnforcerMojo extends AbstractMojo {
try {
File outputDir = new File(project.getBuild().getOutputDirectory());
- List<URL> dependencies = new ArrayList<URL>();
- for (Artifact a : (Collection<Artifact>)project.getArtifacts())
+ List<URL> dependencies = new ArrayList<>();
+ for (Artifact a : project.getArtifacts())
dependencies.add(a.getFile().toURI().toURL());
URL outputURL = outputDir.toURI().toURL();
dependencies.add(outputURL);
getLog().debug("inspecting\n" + dependencies.stream().map(URL::toString).collect(Collectors.joining("\n")));
final boolean[] failed = new boolean[1];
- Checker checker = new Checker(new URLClassLoader(dependencies.toArray(new URL[dependencies.size()]), getClass().getClassLoader()),
+ Checker checker = new Checker(new URLClassLoader(dependencies.toArray(new URL[0]), getClass().getClassLoader()),
new ErrorListener() {
+ @Override
public void onError(Throwable t, Location loc, String msg) {
String locMsg = loc+" "+msg;
if (failOnError) {
@@ -90,6 +91,7 @@ public class EnforcerMojo extends AbstractMojo {
failed[0] = true;
}
+ @Override
public void onWarning(Throwable t, Location loc, String msg) {
getLog().warn(loc+" "+msg,t);
}
=====================================
access-modifier-checker/src/main/java/org/kohsuke/accmod/impl/Restrictions.java
=====================================
@@ -93,7 +93,7 @@ public class Restrictions extends ArrayList<AccessRestriction> {
}
abstract static class Parser extends AnnotationVisitor {
- private List<Type> restrictions = new ArrayList<Type>();
+ private List<Type> restrictions = new ArrayList<>();
private final RestrictedElement target;
protected Parser(RestrictedElement target) {
@@ -101,21 +101,26 @@ public class Restrictions extends ArrayList<AccessRestriction> {
this.target = target;
}
+ @Override
public void visit(String name, Object value) {
restrictions.add((Type)value);
}
+ @Override
public void visitEnum(String name, String desc, String value) {
}
+ @Override
public AnnotationVisitor visitAnnotation(String name, String desc) {
return this;
}
+ @Override
public AnnotationVisitor visitArray(String name) {
return this;
}
+ @Override
public abstract void visitEnd();
public Restrictions build(AccessRestrictionFactory f) throws ClassNotFoundException, InstantiationException, IllegalAccessException {
=====================================
access-modifier-suppressions/pom.xml
=====================================
@@ -4,7 +4,7 @@
<parent>
<artifactId>access-modifier</artifactId>
<groupId>org.kohsuke</groupId>
- <version>1.25</version>
+ <version>1.27</version>
</parent>
<artifactId>access-modifier-suppressions</artifactId>
=====================================
pom.xml
=====================================
@@ -4,13 +4,13 @@
<parent>
<groupId>org.jenkins-ci</groupId>
<artifactId>jenkins</artifactId>
- <version>1.65</version>
+ <version>1.69</version>
<relativePath />
</parent>
<groupId>org.kohsuke</groupId>
<artifactId>access-modifier</artifactId>
- <version>1.25</version>
+ <version>1.27</version>
<name>Custom access modifier for Java</name>
<packaging>pom</packaging>
@@ -18,7 +18,7 @@
<url>https://github.com/jenkinsci/lib-access-modifier</url>
<properties>
- <revision>1.25</revision>
+ <revision>1.27</revision>
<changelist>-SNAPSHOT</changelist>
<gitHubRepo>jenkinsci/lib-access-modifier</gitHubRepo>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -36,7 +36,7 @@
<connection>scm:git:git at github.com/${gitHubRepo}.git</connection>
<developerConnection>scm:git:ssh://git@github.com/${gitHubRepo}.git</developerConnection>
<url>https://github.com/${gitHubRepo}</url>
- <tag>access-modifier-1.25</tag>
+ <tag>access-modifier-1.27</tag>
</scm>
<developers>
@@ -77,7 +77,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
- <version>3.6.1</version>
+ <version>3.6.2</version>
<executions>
<execution>
<id>default-descriptor</id>
@@ -97,6 +97,11 @@
<dependencyManagement>
<dependencies>
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-utils</artifactId>
+ <version>3.4.1</version>
+ </dependency>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
@@ -105,6 +110,20 @@
</dependencies>
</dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>com.github.spotbugs</groupId>
+ <artifactId>spotbugs-annotations</artifactId>
+ <optional>true</optional>
+ <exclusions>
+ <exclusion>
+ <groupId>com.google.code.findbugs</groupId>
+ <artifactId>jsr305</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+
<repositories>
<repository>
<id>repo.jenkins-ci.org</id>
View it on GitLab: https://salsa.debian.org/java-team/access-modifier-checker/-/compare/7c4480b69339fbc330dbdb91d5a823da2c7152e0...5956cd66803655f9adcefc05bfe7b24407325e5e
--
View it on GitLab: https://salsa.debian.org/java-team/access-modifier-checker/-/compare/7c4480b69339fbc330dbdb91d5a823da2c7152e0...5956cd66803655f9adcefc05bfe7b24407325e5e
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/7b7461fd/attachment.htm>
More information about the pkg-java-commits
mailing list