Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependencies, exclude JSR 305 #495

Merged
merged 11 commits into from
Dec 21, 2021
31 changes: 21 additions & 10 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
The MIT License

Expand Down Expand Up @@ -89,11 +90,6 @@ THE SOFTWARE.
</pluginRepositories>

<dependencies>
<dependency>
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-annotations</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.glassfish.tyrus.bundles</groupId>
<artifactId>tyrus-standalone-client-jdk</artifactId>
Expand All @@ -107,8 +103,8 @@ THE SOFTWARE.
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<version>1.3</version>
<artifactId>hamcrest</artifactId>
<version>2.2</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -120,7 +116,7 @@ THE SOFTWARE.
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>30.1.1-jre</version>
<version>31.0.1-jre</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -148,8 +144,8 @@ THE SOFTWARE.
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.10.19</version>
<artifactId>mockito-core</artifactId>
<version>4.2.0</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -162,6 +158,20 @@ THE SOFTWARE.
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-annotations</artifactId>
<scope>provided</scope>
<optional>true</optional>
<exclusions>
<exclusion>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>net.jcip</groupId>
<artifactId>jcip-annotations</artifactId>
<version>1.0</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
Expand All @@ -180,6 +190,7 @@ THE SOFTWARE.
<artifactId>access-modifier-annotation</artifactId>
<version>1.27</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>javax.websocket</groupId>
Expand Down
6 changes: 2 additions & 4 deletions src/main/java/hudson/remoting/AsyncFutureImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,10 @@
package hudson.remoting;

import edu.umd.cs.findbugs.annotations.CheckForNull;

import javax.annotation.Nonnegative;
import java.util.concurrent.CancellationException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.CancellationException;

/**
* {@link Future} implementation whose computation is carried out elsewhere.
Expand Down Expand Up @@ -87,7 +85,7 @@ public synchronized V get() throws InterruptedException, ExecutionException {

@Override
@CheckForNull
public synchronized V get(@Nonnegative long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {
public synchronized V get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {
// The accuracy of wait(long) operation is milliseconds anyway, but ok.
long endWaitTime = System.nanoTime() + unit.toNanos(timeout);
while (!completed) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/hudson/remoting/Capability.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* Each {@link Channel} exposes its capability to {@link Channel#getProperty(Object)}.
*
* <p>
* This mechanism allows two different versions of <tt>remoting.jar</tt> to talk to each other.
* This mechanism allows two different versions of {@code remoting.jar} to talk to each other.
*
* @author Kohsuke Kawaguchi
* @see Channel#remoteCapability
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/hudson/remoting/ChannelBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public Capability getCapability() {
}

/**
* If non-null, receive the portion of data in <tt>is</tt> before
* If non-null, receive the portion of data in {@code is} before
* the data goes into the "binary mode". This is useful
* when the established communication channel might include some data that might
* be useful for debugging/trouble-shooting.
Expand Down
7 changes: 3 additions & 4 deletions src/main/java/hudson/remoting/Engine.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.Collectors;
import javax.annotation.concurrent.NotThreadSafe;
import javax.net.ssl.KeyManagerFactory;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocketFactory;
Expand All @@ -78,14 +77,14 @@
import javax.websocket.EndpointConfig;
import javax.websocket.HandshakeResponse;
import javax.websocket.Session;

import org.jenkinsci.remoting.engine.JnlpEndpointResolver;
import net.jcip.annotations.NotThreadSafe;
import org.jenkinsci.remoting.engine.Jnlp4ConnectionState;
import org.jenkinsci.remoting.engine.JnlpAgentEndpoint;
import org.jenkinsci.remoting.engine.JnlpAgentEndpointConfigurator;
import org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver;
import org.jenkinsci.remoting.engine.JnlpConnectionState;
import org.jenkinsci.remoting.engine.JnlpConnectionStateListener;
import org.jenkinsci.remoting.engine.JnlpEndpointResolver;
import org.jenkinsci.remoting.engine.JnlpProtocolHandler;
import org.jenkinsci.remoting.engine.JnlpProtocolHandlerFactory;
import org.jenkinsci.remoting.engine.WorkDirManager;
Expand Down Expand Up @@ -149,7 +148,7 @@ public Thread newThread(@NonNull final Runnable r) {
private List<X509Certificate> candidateCertificates;

/**
* URL that points to Jenkins's tcp agent listener, like <tt>http://myhost/hudson/</tt>
* URL that points to Jenkins's tcp agent listener, like {@code http://myhost/hudson/}
*
* <p>
* This value is determined from {@link #candidateUrls} after a successful connection.
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/hudson/remoting/ExportTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ public String toString() {
* The class is not serializable.
*/
@Restricted(NoExternalUse.class)
@SuppressFBWarnings(value = "SE_BAD_FIELD_INNER_CLASS",
@SuppressFBWarnings(value = {"EQ_DOESNT_OVERRIDE_EQUALS", "SE_BAD_FIELD_INNER_CLASS"},
justification = "ExportList is supposed to be serializable as ArrayList, but it is not. "
+ "The issue is ignored since the class does not belong to the public API")
public final class ExportList extends ArrayList<Entry<?>> {
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/hudson/remoting/FileSystemJarCache.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.jenkinsci.remoting.util.PathUtils;

import javax.annotation.concurrent.GuardedBy;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
Expand All @@ -18,6 +15,8 @@
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.jcip.annotations.GuardedBy;
import org.jenkinsci.remoting.util.PathUtils;

/**
* {@link JarCache} that stores files in a single directory.
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/hudson/remoting/Pipe.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
* <p>
* There are two kinds of pipes. One is for having a local system write to a remote system,
* and the other is for having a remote system write to a local system. Use
* the different versions of the <tt>create</tt> method to create the appropriate kind
* the different versions of the {@code create} method to create the appropriate kind
* of pipes.
*
* <p>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/hudson/remoting/ProxyWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import java.util.concurrent.ExecutionException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.concurrent.GuardedBy;
import net.jcip.annotations.GuardedBy;

/**
* {@link Writer} that sends bits to an exported
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/hudson/remoting/VirtualChannel.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ public interface VirtualChannel {
* @param type
* Interface to be remoted.
* @return
* the proxy object that implements <tt>T</tt>. This object can be transferred
* the proxy object that implements {@code T}. This object can be transferred
* to the other {@link Channel}, and calling methods on it from the remote side
* will invoke the same method on the given local <tt>instance</tt> object.
* will invoke the same method on the given local {@code instance} object.
* {@code null} if the input instance is {@code null}.
*/
@Nullable
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/hudson/remoting/jnlp/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
* Entry point to JNLP agent.
*
* <p>
* See also <tt>jenkins-agent.jnlp.jelly</tt> in the core.
* See also {@code jenkins-agent.jnlp.jelly} in the core.
*
* @author Kohsuke Kawaguchi
*/
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/hudson/remoting/jnlp/package-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@
*
* <p>
* This involves in getting the connection parameters through command line,
* which is provided from <tt>jenkins-agent.jnlp.jelly</tt> file in the core.
* which is provided from {@code jenkins-agent.jnlp.jelly} file in the core.
*/
package hudson.remoting.jnlp;
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.annotation.concurrent.NotThreadSafe;
import net.jcip.annotations.NotThreadSafe;
import org.jenkinsci.remoting.protocol.impl.ConnectionRefusalException;

/**
Expand Down
4 changes: 1 addition & 3 deletions src/main/java/org/jenkinsci/remoting/nio/FifoBuffer.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
import java.nio.channels.ClosedChannelException;
import java.nio.channels.ReadableByteChannel;
import java.nio.channels.WritableByteChannel;
import javax.annotation.Nonnegative;
import javax.annotation.concurrent.GuardedBy;
import net.jcip.annotations.GuardedBy;

/**
* FIFO buffer for a reader thread and a writer thread to collaborate.
Expand Down Expand Up @@ -236,7 +235,6 @@ public int readable() {
* @return Number of bytes we can write to the buffer.
* If the buffer is closed, may return the value beyond the limit (JENKINS-37514)
*/
@Nonnegative
public int writable() {
synchronized(lock) {
return Math.max(0,limit-readable());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,14 @@
*/
package org.jenkinsci.remoting.protocol;

import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.Nullable;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.SocketChannel;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.concurrent.GuardedBy;

import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.Nullable;
import net.jcip.annotations.GuardedBy;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;

Expand Down
15 changes: 7 additions & 8 deletions src/main/java/org/jenkinsci/remoting/protocol/FilterLayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,15 @@
*/
package org.jenkinsci.remoting.protocol;

import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.Nullable;
import edu.umd.cs.findbugs.annotations.OverrideMustInvoke;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.logging.Level;
import java.util.logging.LogRecord;
import java.util.logging.Logger;
import javax.annotation.OverridingMethodsMustInvokeSuper;
import javax.annotation.concurrent.GuardedBy;

import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.Nullable;
import net.jcip.annotations.GuardedBy;
import org.jenkinsci.remoting.util.ByteBufferQueue;

/**
Expand Down Expand Up @@ -75,7 +74,7 @@ public abstract class FilterLayer implements ProtocolLayer, ProtocolLayer.Send,
* {@inheritDoc}
*/
@Override
@OverridingMethodsMustInvokeSuper
@OverrideMustInvoke
public final synchronized void init(@NonNull ProtocolStack<?>.Ptr ptr) throws IOException {
synchronized (this) {
if (this.ptr != null && this.ptr != ptr) {
Expand Down Expand Up @@ -274,7 +273,7 @@ protected final void flushSend(ByteBufferQueue queue) throws IOException {
* {@inheritDoc}
*/
@Override
@OverridingMethodsMustInvokeSuper
@OverrideMustInvoke
public void onRecvClosed(IOException cause) throws IOException {
if (LOGGER.isLoggable(Level.FINEST)) {
LOGGER.log(Level.FINEST, "[{0}] RECV Closed", stack().name());
Expand Down Expand Up @@ -316,7 +315,7 @@ public boolean isRecvOpen() {
* {@inheritDoc}
*/
@Override
@OverridingMethodsMustInvokeSuper
@OverrideMustInvoke
public void doCloseSend() throws IOException {
if (LOGGER.isLoggable(Level.FINEST)) {
LOGGER.log(Level.FINEST, "[{0}] Closing SEND", stack().name());
Expand Down
15 changes: 7 additions & 8 deletions src/main/java/org/jenkinsci/remoting/protocol/IOHub.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
package org.jenkinsci.remoting.protocol;

import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.OverrideMustInvoke;
import hudson.remoting.Future;
import java.io.Closeable;
import java.io.IOException;
Expand Down Expand Up @@ -53,9 +54,7 @@
import java.util.logging.Level;
import java.util.logging.LogRecord;
import java.util.logging.Logger;
import javax.annotation.OverridingMethodsMustInvokeSuper;
import javax.annotation.concurrent.GuardedBy;

import net.jcip.annotations.GuardedBy;
import org.jenkinsci.remoting.util.ByteBufferPool;
import org.jenkinsci.remoting.util.DirectByteBufferPool;
import org.kohsuke.accmod.Restricted;
Expand Down Expand Up @@ -187,7 +186,7 @@ public final Selector getSelector() {
* {@inheritDoc}
*/
@Override
@OverridingMethodsMustInvokeSuper
@OverrideMustInvoke
public void execute(@NonNull Runnable task) {
executor.execute(task);
}
Expand All @@ -200,7 +199,7 @@ public void execute(@NonNull Runnable task) {
* @throws RejectedExecutionException if this task cannot be accepted for execution
* @throws NullPointerException if task is null
*/
@OverridingMethodsMustInvokeSuper
@OverrideMustInvoke
public void executeOnSelector(Runnable task) {
if (task == null) {
throw new NullPointerException("Task is null");
Expand Down Expand Up @@ -228,7 +227,7 @@ public void executeOnSelector(Runnable task) {
* @throws RejectedExecutionException if this task cannot be accepted for execution
* @throws NullPointerException if task is null
*/
@OverridingMethodsMustInvokeSuper
@OverrideMustInvoke
public Future<?> executeLater(Runnable task, long delay, TimeUnit units) {
if (task == null) {
throw new NullPointerException("Task is null");
Expand All @@ -246,7 +245,7 @@ public Future<?> executeLater(Runnable task, long delay, TimeUnit units) {
*
* @return {@code true} if the hub is open.
*/
@OverridingMethodsMustInvokeSuper
@OverrideMustInvoke
public boolean isOpen() {
return selector.isOpen();
}
Expand All @@ -255,7 +254,7 @@ public boolean isOpen() {
* {@inheritDoc}
*/
@Override
@OverridingMethodsMustInvokeSuper
@OverrideMustInvoke
public void close() throws IOException {
selector.close();
}
Expand Down
Loading