Skip to content

Commit

Permalink
Actually remove findbugs annotations
Browse files Browse the repository at this point in the history
As discussed in #2408, we should prefer the `jakarta` annotations,
but that's not what actually got committed here. So clean that up
  • Loading branch information
stevenschlansker committed Aug 7, 2023
1 parent 8861a1d commit ec3b311
Show file tree
Hide file tree
Showing 26 changed files with 101 additions and 133 deletions.
16 changes: 5 additions & 11 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,6 @@
<artifactId>slf4j-api</artifactId>
</dependency>

<dependency>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-annotations</artifactId>
</dependency>

<dependency>
<groupId>com.google.errorprone</groupId>
<artifactId>error_prone_annotations</artifactId>
Expand All @@ -66,6 +61,11 @@
<artifactId>geantyref</artifactId>
</dependency>

<dependency>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
</dependency>

<dependency>
<groupId>org.immutables</groupId>
<artifactId>value</artifactId>
Expand All @@ -92,12 +92,6 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
Expand Down
5 changes: 3 additions & 2 deletions core/src/main/java/org/jdbi/v3/core/Sql.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
import java.util.stream.Collectors;
import java.util.stream.StreamSupport;

import edu.umd.cs.findbugs.annotations.NonNull;
import jakarta.annotation.Nonnull;

import org.jdbi.v3.meta.Beta;

/**
Expand Down Expand Up @@ -103,7 +104,7 @@ public char charAt(int index) {
return str.charAt(index);
}

@NonNull
@Nonnull
@Override
public CharSequence subSequence(int start, int end) {
return str.subSequence(start, end);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.function.Function;

import jakarta.annotation.Nonnull;
import jakarta.annotation.Nullable;

import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.Nullable;
import org.jdbi.v3.meta.Alpha;

import static java.util.Objects.requireNonNull;
Expand Down Expand Up @@ -66,7 +66,7 @@ public JdbiInterceptionChainHolder(JdbiInterceptionChainHolder<S, T> that) {
* @param source A source object.
* @return A target object processed by one of the registered {@link JdbiInterceptor} instances.
*/
@NonNull
@Nonnull
public T process(@Nullable S source) {
ChainInstance instance = new ChainInstance(source);
T result = instance.next();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
*/
package org.jdbi.v3.core.interceptor;

import edu.umd.cs.findbugs.annotations.CheckForNull;
import edu.umd.cs.findbugs.annotations.Nullable;
import com.google.errorprone.annotations.CheckReturnValue;
import jakarta.annotation.Nullable;

import org.jdbi.v3.meta.Alpha;

/**
Expand Down Expand Up @@ -50,6 +51,7 @@ public interface JdbiInterceptor<S, T> {
* @param source A source object.
* @return The destination type.
*/
@CheckForNull
@Nullable
@CheckReturnValue
T intercept(@Nullable S source, JdbiInterceptionChain<T> chain);
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@
import java.io.UncheckedIOException;
import java.lang.reflect.InvocationTargetException;

import edu.umd.cs.findbugs.annotations.CheckReturnValue;
import edu.umd.cs.findbugs.annotations.NonNull;
import jakarta.annotation.Nonnull;

import com.google.errorprone.annotations.CheckReturnValue;
import org.jdbi.v3.core.internal.UtilityClassException;

public class Sneaky {
Expand All @@ -33,7 +34,7 @@ private Sneaky() {
* Will <b>always</b> throw an exception, so the caller should also always throw the dummy return value to make sure the control flow remains clear.
*/
@CheckReturnValue
@NonNull
@Nonnull
public static DummyException throwAnyway(Throwable t) {

if (t instanceof Error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
import java.util.regex.Pattern;
import java.util.stream.Collectors;

import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.Nullable;
import jakarta.annotation.Nonnull;
import jakarta.annotation.Nullable;

public class ClasspathBuilder {
private static final String DOT = ".";
Expand All @@ -42,17 +42,17 @@ public ClasspathBuilder setExtension(@Nullable String extension) {
}

// org.foo.Bar$Inner -> org/foo/Bar$Inner
public ClasspathBuilder appendFullyQualifiedClassName(@NonNull Class<?> clazz) {
public ClasspathBuilder appendFullyQualifiedClassName(@Nonnull Class<?> clazz) {
return appendDotPath(clazz.getName());
}

// com.google.guava -> com/google/guava
public ClasspathBuilder appendDotPath(@NonNull String path) {
public ClasspathBuilder appendDotPath(@Nonnull String path) {
return appendVerbatim(path.replace(DOT, SLASH));
}

// because sometimes you just don't have fancy data structures or patterns to work on
public ClasspathBuilder appendVerbatim(@NonNull String s) {
public ClasspathBuilder appendVerbatim(@Nonnull String s) {
return addCarefully(s);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import java.util.Objects;
import java.util.stream.Stream;

import edu.umd.cs.findbugs.annotations.Nullable;
import jakarta.annotation.Nullable;

import static java.util.Objects.requireNonNull;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@
import java.util.function.Consumer;
import java.util.function.Function;

import edu.umd.cs.findbugs.annotations.CheckForNull;
import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.Nullable;
import com.google.errorprone.annotations.CheckReturnValue;
import jakarta.annotation.Nonnull;
import jakarta.annotation.Nullable;

import org.jdbi.v3.core.argument.Argument;
import org.jdbi.v3.core.argument.Arguments;
import org.jdbi.v3.core.argument.NamedArgumentFinder;
Expand Down Expand Up @@ -138,7 +139,7 @@ void bindNamedCheck(Binding binding, List<String> paramNames) {
}
}

@NonNull
@Nonnull
QualifiedType<?> typeOf(@Nullable Object value) {
return value instanceof TypedValue
? ((TypedValue) value).getType()
Expand Down Expand Up @@ -197,7 +198,7 @@ private UnableToCreateStatementException factoryNotFound(QualifiedType<?> qualif
return new UnableToCreateStatementException("No argument factory registered for '" + value + "' of qualified type " + qualifiedType, ctx);
}

@CheckForNull
@CheckReturnValue
static Object unwrap(@Nullable Object maybeTypedValue) {
return maybeTypedValue instanceof TypedValue ? ((TypedValue) maybeTypedValue).getValue() : maybeTypedValue;
}
Expand Down

0 comments on commit ec3b311

Please sign in to comment.