Skip to content

Commit

Permalink
chore(ci): fix new spotbugs check errors since upgrade `spotbugs-ma…
Browse files Browse the repository at this point in the history
…ven-plugin` 🐞
  • Loading branch information
oldratlee committed Dec 6, 2023
1 parent 9936cf2 commit 83d8b4d
Show file tree
Hide file tree
Showing 16 changed files with 30 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ttl-agent/src/main/java/com/alibaba/ttl3/agent/TtlAgent.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.alibaba.ttl3.agent.transformlet.internal.TimerTaskTtlTransformlet;
import com.alibaba.ttl3.executor.TtlExecutors;
import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

import java.lang.instrument.ClassFileTransformer;
import java.lang.instrument.Instrumentation;
Expand Down Expand Up @@ -365,6 +366,7 @@ static List<String> getOptionStringListValues(@NonNull String key) {
}


@SuppressFBWarnings("CT_CONSTRUCTOR_THROW")
private TtlAgent() {
throw new InstantiationError("Must not instantiate this class");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.Nullable;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

import java.util.*;

Expand Down Expand Up @@ -126,6 +127,7 @@ static List<String> splitListStringToStringList(@Nullable String listString) {
}


@SuppressFBWarnings("CT_CONSTRUCTOR_THROW")
private TtlAgentHelper() {
throw new InstantiationError("Must not instantiate this class");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.alibaba.ttl3.spi.TtlEnhanced;
import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.Nullable;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import javassist.*;

import java.lang.reflect.Modifier;
Expand Down Expand Up @@ -206,6 +207,7 @@ public static boolean isClassAtPackageJavaUtil(@NonNull String className) {
return isClassAtPackage(className, "java.util");
}

@SuppressFBWarnings("CT_CONSTRUCTOR_THROW")
private TtlTransformletHelper() {
throw new InstantiationError("Must not instantiate this class");
}
Expand Down
2 changes: 2 additions & 0 deletions ttl-core/src/main/java/com/alibaba/ttl3/TtlWrappers.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.alibaba.ttl3.spi.TtlWrapper;
import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.Nullable;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.jetbrains.annotations.Contract;

import java.util.concurrent.Callable;
Expand Down Expand Up @@ -310,6 +311,7 @@ public String toString() {
}
}

@SuppressFBWarnings("CT_CONSTRUCTOR_THROW")
private TtlWrappers() {
throw new InstantiationError("Must not instantiate this class");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.alibaba.ttl3.spi.TtlWrapper;
import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.Nullable;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.jetbrains.annotations.Contract;

import java.util.Comparator;
Expand Down Expand Up @@ -330,6 +331,7 @@ public static Comparator<Runnable> unwrapTtlRunnableUnwrapComparator(@Nullable C
return ((TtlUnwrapComparator<Runnable>) comparator).unwrap();
}

@SuppressFBWarnings("CT_CONSTRUCTOR_THROW")
private TtlExecutors() {
throw new InstantiationError("Must not instantiate this class");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.alibaba.ttl3.TransmittableThreadLocal;
import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

import java.util.HashMap;
import java.util.Map;
Expand Down Expand Up @@ -199,6 +200,7 @@ public void restore(@NonNull HashMap<ThreadLocal<Object>, Object> backup) {
TransmitteeRegistry.registerTransmittee(threadLocalTransmittee);
}

@SuppressFBWarnings("CT_CONSTRUCTOR_THROW")
private ThreadLocalTransmitRegistry() {
throw new InstantiationError("Must not instantiate this class");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.alibaba.ttl3.TransmittableThreadLocal;
import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

/**
* Transmittee(aka {@code ThreadLocal}) Integration,
Expand Down Expand Up @@ -50,6 +51,7 @@ public static <C, B> boolean unregisterTransmittee(@NonNull Transmittee<C, B> tr
return Transmitter.compositeCrrTransmit.unregisterCrrTransmit(transmittee);
}

@SuppressFBWarnings("CT_CONSTRUCTOR_THROW")
private TransmitteeRegistry() {
throw new InstantiationError("Must not instantiate this class");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ public static boolean unregisterCallback(@NonNull CrrTransmitCallback callback)
return compositeCallback.unregisterCallback(callback);
}

@SuppressFBWarnings("CT_CONSTRUCTOR_THROW")
private Transmitter() {
throw new InstantiationError("Must not instantiate this class");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1083,6 +1083,7 @@ public static <T> boolean unregisterThreadLocal(@NonNull ThreadLocal<T> threadLo

private static final TtlCopier<Object> shadowCopier = parentValue -> parentValue;

@SuppressFBWarnings("CT_CONSTRUCTOR_THROW")
private Transmitter() {
throw new InstantiationError("Must not instantiate this class");
}
Expand Down
2 changes: 2 additions & 0 deletions ttl2-compatible/src/main/java/com/alibaba/ttl/TtlUnwrap.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.alibaba.ttl.spi.TtlWrapper;
import edu.umd.cs.findbugs.annotations.Nullable;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.jetbrains.annotations.Contract;

/**
Expand Down Expand Up @@ -64,6 +65,7 @@ public static <T> boolean isWrapper(@Nullable T obj) {
return obj instanceof TtlWrapper;
}

@SuppressFBWarnings("CT_CONSTRUCTOR_THROW")
private TtlUnwrap() {
throw new InstantiationError("Must not instantiate this class");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.alibaba.ttl.spi.TtlWrapper;
import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.Nullable;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.jetbrains.annotations.Contract;

import java.util.function.*;
Expand Down Expand Up @@ -433,6 +434,7 @@ public String toString() {
}


@SuppressFBWarnings("CT_CONSTRUCTOR_THROW")
private TtlWrappers() {
throw new InstantiationError("Must not instantiate this class");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.alibaba.ttl.threadpool.agent.TtlAgent;
import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.Nullable;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.jetbrains.annotations.Contract;

import java.util.Comparator;
Expand Down Expand Up @@ -297,6 +298,7 @@ public static Comparator<Runnable> unwrap(@Nullable Comparator<Runnable> compara
return ((TtlUnwrapComparator<Runnable>) comparator).unwrap();
}

@SuppressFBWarnings("CT_CONSTRUCTOR_THROW")
private TtlExecutors() {
throw new InstantiationError("Must not instantiate this class");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.Nullable;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.jetbrains.annotations.Contract;

import java.util.concurrent.ForkJoinPool;
Expand Down Expand Up @@ -83,6 +84,7 @@ public static ForkJoinWorkerThreadFactory unwrap(@Nullable ForkJoinWorkerThreadF
return ((DisableInheritableForkJoinWorkerThreadFactory) threadFactory).unwrap();
}

@SuppressFBWarnings("CT_CONSTRUCTOR_THROW")
private TtlForkJoinPoolHelper() {
throw new InstantiationError("Must not instantiate this class");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.alibaba.ttl.threadpool.agent.transformlet.internal.TimerTaskTtlTransformlet;
import com.alibaba.ttl.threadpool.agent.transformlet.internal.PriorityBlockingQueueTtlTransformlet;
import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

import java.lang.instrument.ClassFileTransformer;
import java.lang.instrument.Instrumentation;
Expand Down Expand Up @@ -376,6 +377,7 @@ static List<String> getOptionStringListValues(@NonNull String key) {
}


@SuppressFBWarnings("CT_CONSTRUCTOR_THROW")
private TtlAgent() {
throw new InstantiationError("Must not instantiate this class");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.Nullable;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

import java.util.*;

Expand Down Expand Up @@ -127,6 +128,7 @@ static List<String> splitListStringToStringList(@Nullable String listString) {
}


@SuppressFBWarnings("CT_CONSTRUCTOR_THROW")
private TtlAgentHelper() {
throw new InstantiationError("Must not instantiate this class");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.alibaba.ttl.threadpool.agent.transformlet.TtlTransformlet;
import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.Nullable;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import javassist.*;

import java.lang.reflect.Modifier;
Expand Down Expand Up @@ -207,6 +208,7 @@ public static boolean isClassAtPackageJavaUtil(@NonNull String className) {
return isClassAtPackage(className, "java.util");
}

@SuppressFBWarnings("CT_CONSTRUCTOR_THROW")
private TtlTransformletHelper() {
throw new InstantiationError("Must not instantiate this class");
}
Expand Down

0 comments on commit 83d8b4d

Please sign in to comment.