Skip to content

Commit

Permalink
Switch from JSR-305 javax findbugs/spotbugs annotations back to the o…
Browse files Browse the repository at this point in the history
…riginals

As noted at spotbugs/spotbugs#130 , there are
problems with the JSR-305 FindBugs annotations we'd previously been
using for nullability and thread-safety annotations. It seems the safest
thing to do is switch to the Spotbugs and net.jcip annotations, instead,
keeping them as compileOnly dependencies.
  • Loading branch information
jmason committed Nov 6, 2020
1 parent 286ae0a commit 0d47c80
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 15 deletions.
5 changes: 3 additions & 2 deletions build.gradle
Expand Up @@ -28,8 +28,9 @@ repositories {

dependencies {
compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.7'
compileOnly group: 'findbugs', name: 'annotations', version: '1.0.0'
compileOnly group: 'com.google.code.findbugs', name: 'jsr305', version: '2.0.2'

compileOnly group: 'com.github.spotbugs', name: 'spotbugs-annotations', version: '4.1.4'
compileOnly group: 'net.jcip', name: 'jcip-annotations', version: '1.0'

testCompile group: 'junit', name: 'junit', version: '4.11'
testCompile group: 'ch.qos.logback', name: 'logback-classic', version: '1.1.2'
Expand Down
Expand Up @@ -3,9 +3,9 @@
import org.slf4j.Logger;
import org.slf4j.Marker;

import javax.annotation.Nullable;
import javax.annotation.concurrent.GuardedBy;
import javax.annotation.concurrent.ThreadSafe;
import edu.umd.cs.findbugs.annotations.Nullable;
import net.jcip.annotations.GuardedBy;
import net.jcip.annotations.ThreadSafe;
import java.time.Duration;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLong;
Expand Down
Expand Up @@ -3,7 +3,7 @@
import org.slf4j.Logger;
import org.slf4j.Marker;

import javax.annotation.concurrent.ThreadSafe;
import net.jcip.annotations.ThreadSafe;
import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;

Expand Down
Expand Up @@ -2,8 +2,8 @@

import org.slf4j.Logger;

import javax.annotation.Nullable;
import javax.annotation.concurrent.NotThreadSafe;
import edu.umd.cs.findbugs.annotations.Nullable;
import net.jcip.annotations.NotThreadSafe;
import java.time.Duration;
import java.util.Objects;

Expand Down
Expand Up @@ -3,8 +3,8 @@
import org.slf4j.Logger;
import org.slf4j.Marker;

import javax.annotation.Nullable;
import javax.annotation.concurrent.ThreadSafe;
import edu.umd.cs.findbugs.annotations.Nullable;
import net.jcip.annotations.ThreadSafe;
import java.time.Duration;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicReferenceArray;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/swrve/ratelimitedlogger/Registry.java
Expand Up @@ -3,7 +3,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.annotation.concurrent.ThreadSafe;
import net.jcip.annotations.ThreadSafe;
import java.time.Duration;
import java.util.Locale;
import java.util.Map;
Expand Down
10 changes: 6 additions & 4 deletions src/main/java/com/swrve/ratelimitedlogger/package-info.java
Expand Up @@ -2,10 +2,12 @@
* an SLF4J-compatible, simple, fluent API for rate-limited logging in Java; start with {@link com.swrve.ratelimitedlogger.RateLimitedLog}.
*/

@ParametersAreNonnullByDefault
@DefaultAnnotation(Nonnull.class)
@ReturnValuesAreNonnullByDefault
@DefaultAnnotation(NonNull.class)
@DefaultAnnotationForParameters(NonNull.class)
package com.swrve.ratelimitedlogger;

import edu.umd.cs.findbugs.annotations.DefaultAnnotation;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
import edu.umd.cs.findbugs.annotations.DefaultAnnotationForParameters;
import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.ReturnValuesAreNonnullByDefault;

0 comments on commit 0d47c80

Please sign in to comment.