Update errorprone (#5016)
* Update errorprone * gwt * Remove unnecessary final Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>
This commit is contained in:
parent
55e44d790c
commit
f6bcd76219
|
@ -44,9 +44,21 @@ tasks {
|
|||
// consider for future.
|
||||
disable("Var")
|
||||
|
||||
// Don't support Android without desugar
|
||||
// We use animal sniffer
|
||||
disable("AndroidJdkLibsChecker")
|
||||
disable("Java7ApiChecker")
|
||||
disable("Java8ApiChecker")
|
||||
|
||||
// Prevents defensive null checks and we have nullaway anyways
|
||||
disable("ParameterMissingNullable")
|
||||
|
||||
// javax.annotation.Nullable doesn't support type parameter assertions
|
||||
disable("VoidMissingNullable")
|
||||
|
||||
// Overlaps with nullaway
|
||||
disable("FieldMissingNullable")
|
||||
disable("ReturnMissingNullable")
|
||||
|
||||
disable("StaticOrDefaultInterfaceMethod")
|
||||
|
||||
// Great check, but for bytecode manipulation it's too common to separate over
|
||||
|
|
|
@ -50,7 +50,7 @@ val DEPENDENCY_SETS = listOf(
|
|||
),
|
||||
DependencySet(
|
||||
"com.google.errorprone",
|
||||
"2.7.1",
|
||||
"2.10.0",
|
||||
listOf("error_prone_annotations", "error_prone_core")
|
||||
),
|
||||
DependencySet(
|
||||
|
|
|
@ -33,6 +33,7 @@ import java.util.Map;
|
|||
import java.util.NoSuchElementException;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* A thread-safe map with weak keys. Entries are based on a key's system hash code and keys are
|
||||
|
@ -293,7 +294,7 @@ abstract class AbstractWeakConcurrentMap<K, V, L> extends ReferenceQueue<K>
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
public boolean equals(@Nullable Object other) {
|
||||
if (other instanceof WeakKey<?>) {
|
||||
return ((WeakKey<?>) other).get() == get();
|
||||
} else {
|
||||
|
|
|
@ -30,6 +30,7 @@ import java.util.Map;
|
|||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* A thread-safe map with weak keys. Entries are based on a key's system hash code and keys are
|
||||
|
@ -178,7 +179,7 @@ public class WeakConcurrentMap<K, V>
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
public boolean equals(@Nullable Object other) {
|
||||
if (other instanceof WeakConcurrentMap.LookupKey<?>) {
|
||||
return ((LookupKey<?>) other).key == key;
|
||||
} else {
|
||||
|
|
|
@ -69,6 +69,7 @@ public final class PeerServiceAttributesExtractor<REQUEST, RESPONSE>
|
|||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private String mapToPeerService(String endpoint) {
|
||||
if (endpoint == null) {
|
||||
return null;
|
||||
|
|
|
@ -192,7 +192,7 @@ public abstract class HttpClientTracer<REQUEST, CARRIER, RESPONSE> extends BaseT
|
|||
URI url = url(request);
|
||||
if (url != null) {
|
||||
netPeerAttributes.setNetPeer(setter, url.getHost(), null, url.getPort());
|
||||
final URI sanitized;
|
||||
URI sanitized;
|
||||
if (url.getUserInfo() != null) {
|
||||
sanitized =
|
||||
new URI(
|
||||
|
|
|
@ -99,6 +99,7 @@ public final class NetPeerAttributes {
|
|||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private String mapToPeerService(String endpoint) {
|
||||
if (endpoint == null) {
|
||||
return null;
|
||||
|
|
|
@ -46,7 +46,7 @@ final class TracingFilter implements Filter {
|
|||
}
|
||||
Context context = instrumenter.start(parentContext, request);
|
||||
|
||||
final Result result;
|
||||
Result result;
|
||||
boolean isSynchronous = true;
|
||||
try (Scope ignored = context.makeCurrent()) {
|
||||
result = invoker.invoke(invocation);
|
||||
|
|
|
@ -14,7 +14,7 @@ final class LambdaUtils {
|
|||
|
||||
static void forceFlush(OpenTelemetrySdk openTelemetrySdk, long flushTimeout, TimeUnit unit) {
|
||||
CompletableResultCode traceFlush = openTelemetrySdk.getSdkTracerProvider().forceFlush();
|
||||
final CompletableResultCode metricsFlush = openTelemetrySdk.getSdkMeterProvider().forceFlush();
|
||||
CompletableResultCode metricsFlush = openTelemetrySdk.getSdkMeterProvider().forceFlush();
|
||||
CompletableResultCode.ofAll(Arrays.asList(traceFlush, metricsFlush)).join(flushTimeout, unit);
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ final class TracingClientInterceptor implements ClientInterceptor {
|
|||
GrpcRequest request = new GrpcRequest(method, null, null);
|
||||
Context parentContext = Context.current();
|
||||
Context context = instrumenter.start(parentContext, request);
|
||||
final ClientCall<REQUEST, RESPONSE> result;
|
||||
ClientCall<REQUEST, RESPONSE> result;
|
||||
try (Scope ignored = context.makeCurrent()) {
|
||||
try {
|
||||
// call other interceptors
|
||||
|
|
|
@ -39,7 +39,7 @@ public final class ContextStorageBridge extends Context.Storage {
|
|||
}
|
||||
|
||||
io.opentelemetry.context.Context base = OTEL_CONTEXT.get(toAttach);
|
||||
final io.opentelemetry.context.Context newOtelContext;
|
||||
io.opentelemetry.context.Context newOtelContext;
|
||||
if (base != null) {
|
||||
// gRPC context which has an OTel context associated with it via a call to
|
||||
// ContextStorageOverride.current(). Using it as the base allows it to be propagated together
|
||||
|
|
|
@ -20,6 +20,8 @@ public class GreetingEntryPoint implements EntryPoint {
|
|||
private final MessageServiceAsync messageServiceAsync = GWT.create(MessageService.class);
|
||||
|
||||
@Override
|
||||
// GWT compiler still expects pre-Java 8 semantics
|
||||
@SuppressWarnings("UnnecessaryFinal")
|
||||
public void onModuleLoad() {
|
||||
Button greetingButton = new Button("Greeting");
|
||||
greetingButton.addStyleName("greeting.button");
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
package spring.jpa;
|
||||
|
||||
import java.util.Objects;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
|
@ -58,7 +59,7 @@ public class Customer {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
public boolean equals(@Nullable Object obj) {
|
||||
if (obj == this) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -117,7 +117,7 @@ public final class JavaUtilLoggingHelper {
|
|||
private static class AccessibleFormatter extends Formatter {
|
||||
|
||||
@Override
|
||||
public String format(final LogRecord record) {
|
||||
public String format(LogRecord record) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,8 +45,8 @@ class JavaUtilLoggingInstrumentation implements TypeInstrumentation {
|
|||
|
||||
@Advice.OnMethodEnter(suppress = Throwable.class)
|
||||
public static void methodEnter(
|
||||
@Advice.This final Logger logger,
|
||||
@Advice.Argument(0) final LogRecord logRecord,
|
||||
@Advice.This Logger logger,
|
||||
@Advice.Argument(0) LogRecord logRecord,
|
||||
@Advice.Local("otelCallDepth") CallDepth callDepth) {
|
||||
// need to track call depth across all loggers in order to avoid double capture when one
|
||||
// logging framework delegates to another
|
||||
|
|
|
@ -148,14 +148,14 @@ public final class OpenTelemetryDriver implements Driver {
|
|||
return null;
|
||||
}
|
||||
|
||||
final String realUrl = extractRealUrl(url);
|
||||
String realUrl = extractRealUrl(url);
|
||||
|
||||
// find the real driver for the URL
|
||||
final Driver wrappedDriver = findDriver(realUrl);
|
||||
Driver wrappedDriver = findDriver(realUrl);
|
||||
|
||||
final Connection connection = wrappedDriver.connect(realUrl, info);
|
||||
Connection connection = wrappedDriver.connect(realUrl, info);
|
||||
|
||||
final DbInfo dbInfo = JdbcConnectionUrlParser.parse(realUrl, info);
|
||||
DbInfo dbInfo = JdbcConnectionUrlParser.parse(realUrl, info);
|
||||
|
||||
return new OpenTelemetryConnection(connection, dbInfo);
|
||||
}
|
||||
|
@ -174,8 +174,8 @@ public final class OpenTelemetryDriver implements Driver {
|
|||
throw new IllegalArgumentException("url is required");
|
||||
}
|
||||
|
||||
final String realUrl = extractRealUrl(url);
|
||||
final Driver wrappedDriver = findDriver(realUrl);
|
||||
String realUrl = extractRealUrl(url);
|
||||
Driver wrappedDriver = findDriver(realUrl);
|
||||
return wrappedDriver.getPropertyInfo(realUrl, info);
|
||||
}
|
||||
|
||||
|
|
|
@ -59,8 +59,7 @@ public class OpenTelemetryDataSource implements DataSource, AutoCloseable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Connection getConnection(final String username, final String password)
|
||||
throws SQLException {
|
||||
public Connection getConnection(String username, String password) throws SQLException {
|
||||
Connection connection = wrapCall(() -> delegate.getConnection(username, password));
|
||||
DbInfo dbInfo = computeDbInfo(connection);
|
||||
return new OpenTelemetryConnection(connection, dbInfo);
|
||||
|
@ -72,7 +71,7 @@ public class OpenTelemetryDataSource implements DataSource, AutoCloseable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setLogWriter(final PrintWriter out) throws SQLException {
|
||||
public void setLogWriter(PrintWriter out) throws SQLException {
|
||||
delegate.setLogWriter(out);
|
||||
}
|
||||
|
||||
|
@ -82,7 +81,7 @@ public class OpenTelemetryDataSource implements DataSource, AutoCloseable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setLoginTimeout(final int seconds) throws SQLException {
|
||||
public void setLoginTimeout(int seconds) throws SQLException {
|
||||
delegate.setLoginTimeout(seconds);
|
||||
}
|
||||
|
||||
|
@ -92,12 +91,12 @@ public class OpenTelemetryDataSource implements DataSource, AutoCloseable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public <T> T unwrap(final Class<T> iface) throws SQLException {
|
||||
public <T> T unwrap(Class<T> iface) throws SQLException {
|
||||
return delegate.unwrap(iface);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWrapperFor(final Class<?> iface) throws SQLException {
|
||||
public boolean isWrapperFor(Class<?> iface) throws SQLException {
|
||||
return delegate.isWrapperFor(iface);
|
||||
}
|
||||
|
||||
|
|
|
@ -51,35 +51,35 @@ public class OpenTelemetryConnection implements Connection {
|
|||
|
||||
@Override
|
||||
public Statement createStatement() throws SQLException {
|
||||
final Statement statement = delegate.createStatement();
|
||||
Statement statement = delegate.createStatement();
|
||||
return new OpenTelemetryStatement<>(statement, dbInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Statement createStatement(int resultSetType, int resultSetConcurrency)
|
||||
throws SQLException {
|
||||
final Statement statement = delegate.createStatement(resultSetType, resultSetConcurrency);
|
||||
Statement statement = delegate.createStatement(resultSetType, resultSetConcurrency);
|
||||
return new OpenTelemetryStatement<>(statement, dbInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Statement createStatement(
|
||||
int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
|
||||
final Statement statement =
|
||||
Statement statement =
|
||||
delegate.createStatement(resultSetType, resultSetConcurrency, resultSetHoldability);
|
||||
return new OpenTelemetryStatement<>(statement, dbInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PreparedStatement prepareStatement(String sql) throws SQLException {
|
||||
final PreparedStatement statement = delegate.prepareStatement(sql);
|
||||
PreparedStatement statement = delegate.prepareStatement(sql);
|
||||
return new OpenTelemetryPreparedStatement<>(statement, dbInfo, sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency)
|
||||
throws SQLException {
|
||||
final PreparedStatement statement =
|
||||
PreparedStatement statement =
|
||||
delegate.prepareStatement(sql, resultSetType, resultSetConcurrency);
|
||||
return new OpenTelemetryPreparedStatement<>(statement, dbInfo, sql);
|
||||
}
|
||||
|
@ -88,40 +88,39 @@ public class OpenTelemetryConnection implements Connection {
|
|||
public PreparedStatement prepareStatement(
|
||||
String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
|
||||
throws SQLException {
|
||||
final PreparedStatement statement =
|
||||
PreparedStatement statement =
|
||||
delegate.prepareStatement(sql, resultSetType, resultSetConcurrency, resultSetHoldability);
|
||||
return new OpenTelemetryPreparedStatement<>(statement, dbInfo, sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException {
|
||||
final PreparedStatement statement = delegate.prepareStatement(sql, autoGeneratedKeys);
|
||||
PreparedStatement statement = delegate.prepareStatement(sql, autoGeneratedKeys);
|
||||
return new OpenTelemetryPreparedStatement<>(statement, dbInfo, sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException {
|
||||
final PreparedStatement statement = delegate.prepareStatement(sql, columnIndexes);
|
||||
PreparedStatement statement = delegate.prepareStatement(sql, columnIndexes);
|
||||
return new OpenTelemetryPreparedStatement<>(statement, dbInfo, sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException {
|
||||
final PreparedStatement statement = delegate.prepareStatement(sql, columnNames);
|
||||
PreparedStatement statement = delegate.prepareStatement(sql, columnNames);
|
||||
return new OpenTelemetryPreparedStatement<>(statement, dbInfo, sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CallableStatement prepareCall(String sql) throws SQLException {
|
||||
final CallableStatement statement = delegate.prepareCall(sql);
|
||||
CallableStatement statement = delegate.prepareCall(sql);
|
||||
return new OpenTelemetryCallableStatement<>(statement, dbInfo, sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency)
|
||||
throws SQLException {
|
||||
final CallableStatement statement =
|
||||
delegate.prepareCall(sql, resultSetType, resultSetConcurrency);
|
||||
CallableStatement statement = delegate.prepareCall(sql, resultSetType, resultSetConcurrency);
|
||||
return new OpenTelemetryCallableStatement<>(statement, dbInfo, sql);
|
||||
}
|
||||
|
||||
|
@ -129,7 +128,7 @@ public class OpenTelemetryConnection implements Connection {
|
|||
public CallableStatement prepareCall(
|
||||
String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
|
||||
throws SQLException {
|
||||
final CallableStatement statement =
|
||||
CallableStatement statement =
|
||||
delegate.prepareCall(sql, resultSetType, resultSetConcurrency, resultSetHoldability);
|
||||
return new OpenTelemetryCallableStatement(statement, dbInfo, sql);
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ enum MessagePropertyGetter implements TextMapGetter<MessageWithDestination> {
|
|||
@Override
|
||||
public String get(MessageWithDestination carrier, String key) {
|
||||
String propName = key.replace("-", MessagePropertySetter.DASH);
|
||||
final Object value;
|
||||
Object value;
|
||||
try {
|
||||
value = carrier.message().getObjectProperty(propName);
|
||||
} catch (JMSException e) {
|
||||
|
|
|
@ -169,7 +169,7 @@ class TracingConsumer<K, V> implements Consumer<K, V> {
|
|||
|
||||
@Override
|
||||
public Map<TopicPartition, OffsetAndMetadata> committed(
|
||||
Set<TopicPartition> partitions, final Duration timeout) {
|
||||
Set<TopicPartition> partitions, Duration timeout) {
|
||||
return consumer.committed(partitions, timeout);
|
||||
}
|
||||
|
||||
|
|
|
@ -47,10 +47,10 @@ class Log4jAppenderInstrumentation implements TypeInstrumentation {
|
|||
|
||||
@Advice.OnMethodEnter(suppress = Throwable.class)
|
||||
public static void methodEnter(
|
||||
@Advice.This final Category logger,
|
||||
@Advice.Argument(1) final Priority level,
|
||||
@Advice.Argument(2) final Object message,
|
||||
@Advice.Argument(3) final Throwable t,
|
||||
@Advice.This Category logger,
|
||||
@Advice.Argument(1) Priority level,
|
||||
@Advice.Argument(2) Object message,
|
||||
@Advice.Argument(3) Throwable t,
|
||||
@Advice.Local("otelCallDepth") CallDepth callDepth) {
|
||||
// need to track call depth across all loggers to avoid double capture when one logging
|
||||
// framework delegates to another
|
||||
|
|
|
@ -58,10 +58,10 @@ class Log4jAppenderInstrumentation implements TypeInstrumentation {
|
|||
|
||||
@Advice.OnMethodEnter(suppress = Throwable.class)
|
||||
public static void methodEnter(
|
||||
@Advice.This final Logger logger,
|
||||
@Advice.Argument(0) final Level level,
|
||||
@Advice.Argument(4) final Message message,
|
||||
@Advice.Argument(5) final Throwable t,
|
||||
@Advice.This Logger logger,
|
||||
@Advice.Argument(0) Level level,
|
||||
@Advice.Argument(4) Message message,
|
||||
@Advice.Argument(5) Throwable t,
|
||||
@Advice.Local("otelCallDepth") CallDepth callDepth) {
|
||||
// need to track call depth across all loggers in order to avoid double capture when one
|
||||
// logging framework delegates to another
|
||||
|
|
|
@ -44,7 +44,7 @@ class LogbackInstrumentation implements TypeInstrumentation {
|
|||
|
||||
@Advice.OnMethodEnter(suppress = Throwable.class)
|
||||
public static void methodEnter(
|
||||
@Advice.Argument(0) final ILoggingEvent event,
|
||||
@Advice.Argument(0) ILoggingEvent event,
|
||||
@Advice.Local("otelCallDepth") CallDepth callDepth) {
|
||||
// need to track call depth across all loggers in order to avoid double capture when one
|
||||
// logging framework delegates to another
|
||||
|
|
|
@ -52,7 +52,7 @@ public final class LoggingEventMapper {
|
|||
captureMdcAttributes.size() == 1 && captureMdcAttributes.get(0).equals("*");
|
||||
}
|
||||
|
||||
public void capture(final ILoggingEvent event) {
|
||||
public void capture(ILoggingEvent event) {
|
||||
LogBuilder builder =
|
||||
GlobalLogEmitterProvider.get()
|
||||
.logEmitterBuilder(event.getLoggerName())
|
||||
|
|
|
@ -36,8 +36,8 @@ public final class UnionMap<K, V> extends AbstractMap<K, V> {
|
|||
return size;
|
||||
}
|
||||
|
||||
final Map<K, V> a;
|
||||
final Map<K, V> b;
|
||||
Map<K, V> a;
|
||||
Map<K, V> b;
|
||||
if (first.size() >= second.size()) {
|
||||
a = first;
|
||||
b = second;
|
||||
|
@ -110,7 +110,7 @@ public final class UnionMap<K, V> extends AbstractMap<K, V> {
|
|||
}
|
||||
}
|
||||
|
||||
final Set<Entry<K, V>> filteredSecond;
|
||||
Set<Entry<K, V>> filteredSecond;
|
||||
if (!secondHasDupes) {
|
||||
filteredSecond = second.entrySet();
|
||||
} else {
|
||||
|
|
|
@ -67,7 +67,7 @@ public final class FutureListenerWrappers {
|
|||
// to the key, that means it's no longer used (referenced) by the netty future anyways.
|
||||
}
|
||||
|
||||
final GenericFutureListener<? extends Future<?>> wrapper;
|
||||
GenericFutureListener<? extends Future<?>> wrapper;
|
||||
if (delegate instanceof GenericProgressiveFutureListener) {
|
||||
wrapper =
|
||||
new WrappedProgressiveFutureListener(
|
||||
|
|
|
@ -20,7 +20,7 @@ public final class NettyServerInstrumenterFactory {
|
|||
public static Instrumenter<HttpRequestAndChannel, HttpResponse> create(
|
||||
String instrumentationName) {
|
||||
|
||||
final NettyHttpServerAttributesExtractor httpAttributesExtractor =
|
||||
NettyHttpServerAttributesExtractor httpAttributesExtractor =
|
||||
new NettyHttpServerAttributesExtractor();
|
||||
|
||||
return Instrumenter.<HttpRequestAndChannel, HttpResponse>builder(
|
||||
|
|
|
@ -34,7 +34,7 @@ public class HttpServerResponseTracingHandler extends ChannelOutboundHandlerAdap
|
|||
return;
|
||||
}
|
||||
|
||||
final ChannelPromise writePromise;
|
||||
ChannelPromise writePromise;
|
||||
|
||||
if (msg instanceof LastHttpContent) {
|
||||
if (prm.isVoid()) {
|
||||
|
|
|
@ -17,6 +17,7 @@ import application.io.opentelemetry.api.trace.StatusCode;
|
|||
import application.io.opentelemetry.context.Context;
|
||||
import io.opentelemetry.javaagent.instrumentation.opentelemetryapi.context.AgentContextStorage;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import javax.annotation.Nullable;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -141,7 +142,7 @@ class ApplicationSpan implements Span {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
public boolean equals(@Nullable Object obj) {
|
||||
if (obj == this) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ public class OpenTelemetryInstrumentation implements TypeInstrumentation {
|
|||
none(), OpenTelemetryInstrumentation.class.getName() + "$InitAdvice");
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@SuppressWarnings({"unused", "ReturnValueIgnored"})
|
||||
public static class InitAdvice {
|
||||
@Advice.OnMethodEnter
|
||||
public static void init() {
|
||||
|
|
|
@ -28,7 +28,7 @@ public class OpenTelemetryInstrumentation implements TypeInstrumentation {
|
|||
none(), OpenTelemetryInstrumentation.class.getName() + "$InitAdvice");
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@SuppressWarnings({"unused", "ReturnValueIgnored"})
|
||||
public static class InitAdvice {
|
||||
@Advice.OnMethodEnter
|
||||
public static void init() {
|
||||
|
|
|
@ -104,6 +104,7 @@ class RmiTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("ReturnValueIgnored")
|
||||
void serverBuiltinMethods() throws Exception {
|
||||
Server server = new Server();
|
||||
serverRegistry.rebind(Server.RMI_ID, server);
|
||||
|
|
|
@ -76,7 +76,7 @@ public final class TracingChunkExecutionListener implements ChunkListener, Order
|
|||
// TracingJobExecutionListener will be present in an ordered set of listeners
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
public boolean equals(@Nullable Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ import io.opentelemetry.context.Context;
|
|||
import io.opentelemetry.context.Scope;
|
||||
import io.opentelemetry.instrumentation.api.field.VirtualField;
|
||||
import io.opentelemetry.javaagent.instrumentation.spring.batch.ContextAndScope;
|
||||
import javax.annotation.Nullable;
|
||||
import org.springframework.batch.core.JobExecution;
|
||||
import org.springframework.batch.core.JobExecutionListener;
|
||||
import org.springframework.core.Ordered;
|
||||
|
@ -57,7 +58,7 @@ public final class TracingJobExecutionListener implements JobExecutionListener,
|
|||
// TracingJobExecutionListener will be present in an ordered set of listeners
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
public boolean equals(@Nullable Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ import io.opentelemetry.context.Context;
|
|||
import io.opentelemetry.context.Scope;
|
||||
import io.opentelemetry.instrumentation.api.field.VirtualField;
|
||||
import io.opentelemetry.javaagent.instrumentation.spring.batch.ContextAndScope;
|
||||
import javax.annotation.Nullable;
|
||||
import org.springframework.batch.core.ExitStatus;
|
||||
import org.springframework.batch.core.StepExecution;
|
||||
import org.springframework.batch.core.StepExecutionListener;
|
||||
|
@ -60,7 +61,7 @@ public final class TracingStepExecutionListener implements StepExecutionListener
|
|||
// TracingStepExecutionListener will be present in an ordered set of listeners
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
public boolean equals(@Nullable Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
package spring.jpa;
|
||||
|
||||
import java.util.Objects;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
|
@ -58,7 +59,7 @@ public class JpaCustomer {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
public boolean equals(@Nullable Object obj) {
|
||||
if (obj == this) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ public abstract class MessageWithChannel {
|
|||
}
|
||||
|
||||
public String getChannelName() {
|
||||
final String channelName;
|
||||
String channelName;
|
||||
MessageChannel channel = getMessageChannel();
|
||||
if (channel instanceof AbstractMessageChannel) {
|
||||
channelName = ((AbstractMessageChannel) channel).getFullChannelName();
|
||||
|
|
|
@ -72,7 +72,7 @@ final class TracingChannelInterceptor implements ExecutorChannelInterceptor {
|
|||
Context parentContext = Context.current();
|
||||
MessageWithChannel messageWithChannel = MessageWithChannel.create(message, messageChannel);
|
||||
|
||||
final Context context;
|
||||
Context context;
|
||||
MessageHeaderAccessor messageHeaderAccessor = createMutableHeaderAccessor(message);
|
||||
|
||||
// only start a new CONSUMER span when there is no span in the context: this situation happens
|
||||
|
|
|
@ -18,6 +18,7 @@ import java.util.Objects;
|
|||
import java.util.ResourceBundle;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
import javax.annotation.Nullable;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.InOrder;
|
||||
import org.mockito.Mockito;
|
||||
|
@ -845,7 +846,7 @@ class PatchLoggerTest {
|
|||
String returnType;
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
public boolean equals(@Nullable Object obj) {
|
||||
if (obj == this) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import static net.bytebuddy.matcher.ElementMatchers.hasSignature;
|
|||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import javax.annotation.Nullable;
|
||||
import net.bytebuddy.description.method.MethodDescription;
|
||||
import net.bytebuddy.description.type.TypeDefinition;
|
||||
import net.bytebuddy.description.type.TypeList;
|
||||
|
@ -78,7 +79,7 @@ class HasSuperMethodMatcher<T extends MethodDescription>
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
public boolean equals(@Nullable Object obj) {
|
||||
if (obj == this) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
package io.opentelemetry.javaagent.extension.matcher;
|
||||
|
||||
import java.util.Objects;
|
||||
import javax.annotation.Nullable;
|
||||
import net.bytebuddy.description.method.MethodDescription;
|
||||
import net.bytebuddy.description.type.TypeDescription;
|
||||
import net.bytebuddy.matcher.ElementMatcher;
|
||||
|
@ -35,7 +36,7 @@ class MethodDeclaringTypeMatcher<T extends MethodDescription>
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
public boolean equals(@Nullable Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ package io.opentelemetry.javaagent.extension.matcher;
|
|||
|
||||
import static io.opentelemetry.javaagent.extension.matcher.Utils.safeTypeDefinitionName;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import net.bytebuddy.description.type.TypeDefinition;
|
||||
import net.bytebuddy.description.type.TypeDescription;
|
||||
import net.bytebuddy.matcher.ElementMatcher;
|
||||
|
@ -71,7 +72,7 @@ class SafeErasureMatcher<T extends TypeDefinition> extends ElementMatcher.Juncti
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
public boolean equals(@Nullable Object obj) {
|
||||
if (obj == this) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ package io.opentelemetry.javaagent.extension.matcher;
|
|||
|
||||
import static io.opentelemetry.javaagent.extension.matcher.SafeHasSuperTypeMatcher.safeGetSuperClass;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import net.bytebuddy.description.type.TypeDefinition;
|
||||
import net.bytebuddy.description.type.TypeDescription;
|
||||
import net.bytebuddy.matcher.ElementMatcher;
|
||||
|
@ -39,7 +40,7 @@ class SafeExtendsClassMatcher extends ElementMatcher.Junction.AbstractBase<TypeD
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
public boolean equals(@Nullable Object obj) {
|
||||
if (obj == this) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -119,7 +119,7 @@ class SafeHasSuperTypeMatcher extends ElementMatcher.Junction.AbstractBase<TypeD
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
public boolean equals(@Nullable Object obj) {
|
||||
if (obj == this) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
package io.opentelemetry.javaagent.tooling;
|
||||
|
||||
import io.opentelemetry.api.metrics.MeterProvider;
|
||||
import io.opentelemetry.instrumentation.api.config.Config;
|
||||
import io.opentelemetry.javaagent.bootstrap.AgentInitializer;
|
||||
import io.opentelemetry.javaagent.instrumentation.api.OpenTelemetrySdkAccess;
|
||||
|
@ -43,8 +42,7 @@ public class OpenTelemetryInstaller {
|
|||
OpenTelemetrySdkAccess.internalSetForceFlush(
|
||||
(timeout, unit) -> {
|
||||
CompletableResultCode traceResult = sdk.getSdkTracerProvider().forceFlush();
|
||||
MeterProvider meterProvider = sdk.getSdkMeterProvider();
|
||||
final CompletableResultCode metricsResult = sdk.getSdkMeterProvider().forceFlush();
|
||||
CompletableResultCode metricsResult = sdk.getSdkMeterProvider().forceFlush();
|
||||
CompletableResultCode.ofAll(Arrays.asList(traceResult, metricsResult))
|
||||
.join(timeout, unit);
|
||||
});
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
package io.opentelemetry.javaagent.tooling.bytebuddy;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import net.bytebuddy.matcher.ElementMatcher;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -55,7 +56,7 @@ public class LoggingFailSafeMatcher<T> extends ElementMatcher.Junction.AbstractB
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
public boolean equals(@Nullable Object obj) {
|
||||
if (obj == this) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ package io.opentelemetry.javaagent.tooling.muzzle;
|
|||
|
||||
import io.opentelemetry.instrumentation.api.cache.Cache;
|
||||
import java.lang.ref.WeakReference;
|
||||
import javax.annotation.Nullable;
|
||||
import net.bytebuddy.agent.builder.AgentBuilder;
|
||||
import net.bytebuddy.description.annotation.AnnotationList;
|
||||
import net.bytebuddy.description.method.MethodDescription;
|
||||
|
@ -123,7 +124,7 @@ public class AgentCachingPoolStrategy implements AgentBuilder.PoolStrategy {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
public boolean equals(@Nullable Object obj) {
|
||||
if (obj == this) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ import io.opentelemetry.javaagent.tooling.muzzle.references.MethodRef;
|
|||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Stream;
|
||||
import javax.annotation.Nullable;
|
||||
import net.bytebuddy.description.field.FieldDescription;
|
||||
import net.bytebuddy.description.method.MethodDescription.InDefinedShape;
|
||||
import net.bytebuddy.description.type.TypeDescription;
|
||||
|
@ -74,7 +75,7 @@ interface HelperReferenceWrapper {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
public boolean equals(@Nullable Object obj) {
|
||||
if (obj == this) {
|
||||
return true;
|
||||
}
|
||||
|
@ -126,7 +127,7 @@ interface HelperReferenceWrapper {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
public boolean equals(@Nullable Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import static io.opentelemetry.javaagent.tooling.muzzle.references.ReferenceMerg
|
|||
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.annotation.Nullable;
|
||||
import org.objectweb.asm.Type;
|
||||
|
||||
/**
|
||||
|
@ -76,7 +77,7 @@ public final class FieldRef {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
public boolean equals(@Nullable Object obj) {
|
||||
if (obj == this) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ import java.util.Objects;
|
|||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
import javax.annotation.Nullable;
|
||||
import org.objectweb.asm.Type;
|
||||
|
||||
/**
|
||||
|
@ -70,7 +71,7 @@ public final class MethodRef {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
public boolean equals(@Nullable Object obj) {
|
||||
if (obj == this) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
package io.opentelemetry.javaagent.tooling.muzzle.references;
|
||||
|
||||
import java.util.Objects;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* Represents the source (file name, line number) of a reference.
|
||||
|
@ -31,7 +32,7 @@ public final class Source {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
public boolean equals(@Nullable Object obj) {
|
||||
if (obj == this) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ public class DeclaredFieldTestClass {
|
|||
public static class Helper extends LibraryBaseClass {
|
||||
private String helperField;
|
||||
|
||||
@SuppressWarnings("ReturnValueIgnored")
|
||||
public void foo() {
|
||||
superField.toString();
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ package io.opentelemetry.javaagent.tooling.muzzle;
|
|||
import io.opentelemetry.context.Context;
|
||||
import io.opentelemetry.instrumentation.api.field.VirtualField;
|
||||
|
||||
@SuppressWarnings("ReturnValueIgnored")
|
||||
public class VirtualFieldTestClasses {
|
||||
public static class ValidAdvice {
|
||||
public static void advice() {
|
||||
|
|
|
@ -89,6 +89,7 @@ public class TestClasses {
|
|||
}
|
||||
|
||||
public static class LdcAdvice {
|
||||
@SuppressWarnings("ReturnValueIgnored")
|
||||
public static void ldcMethod() {
|
||||
MethodBodyAdvice.A.class.getName();
|
||||
}
|
||||
|
|
|
@ -379,7 +379,7 @@ public abstract class AbstractHttpClientTest<REQUEST> {
|
|||
URI uri = resolveAddress("/circular-redirect");
|
||||
|
||||
Throwable thrown = catchThrowable(() -> doRequest(method, uri));
|
||||
final Throwable ex;
|
||||
Throwable ex;
|
||||
if (thrown instanceof ExecutionException) {
|
||||
ex = thrown.getCause();
|
||||
} else {
|
||||
|
@ -502,7 +502,7 @@ public abstract class AbstractHttpClientTest<REQUEST> {
|
|||
|
||||
Throwable thrown =
|
||||
catchThrowable(() -> testing.runWithSpan("parent", () -> doRequest(method, uri)));
|
||||
final Throwable ex;
|
||||
Throwable ex;
|
||||
if (thrown instanceof ExecutionException) {
|
||||
ex = thrown.getCause();
|
||||
} else {
|
||||
|
@ -543,7 +543,7 @@ public abstract class AbstractHttpClientTest<REQUEST> {
|
|||
method, uri, () -> testing.runWithSpan("callback", () -> {})));
|
||||
|
||||
Throwable thrown = catchThrowable(result::get);
|
||||
final Throwable ex;
|
||||
Throwable ex;
|
||||
if (thrown instanceof ExecutionException) {
|
||||
ex = thrown.getCause();
|
||||
} else {
|
||||
|
@ -573,7 +573,7 @@ public abstract class AbstractHttpClientTest<REQUEST> {
|
|||
|
||||
Throwable thrown =
|
||||
catchThrowable(() -> testing.runWithSpan("parent", () -> doRequest(method, uri)));
|
||||
final Throwable ex;
|
||||
Throwable ex;
|
||||
if (thrown instanceof ExecutionException) {
|
||||
ex = thrown.getCause();
|
||||
} else {
|
||||
|
@ -606,7 +606,7 @@ public abstract class AbstractHttpClientTest<REQUEST> {
|
|||
|
||||
Throwable thrown =
|
||||
catchThrowable(() -> testing.runWithSpan("parent", () -> doRequest(method, uri)));
|
||||
final Throwable ex;
|
||||
Throwable ex;
|
||||
if (thrown instanceof ExecutionException) {
|
||||
ex = thrown.getCause();
|
||||
} else {
|
||||
|
|
|
@ -139,7 +139,7 @@ public final class AgentTestingExporterAccess {
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static List<SpanData> getExportedSpans() {
|
||||
final List<byte[]> exportRequests;
|
||||
List<byte[]> exportRequests;
|
||||
try {
|
||||
exportRequests = (List<byte[]>) getSpanExportRequests.invokeExact();
|
||||
} catch (Throwable t) {
|
||||
|
@ -232,7 +232,7 @@ public final class AgentTestingExporterAccess {
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static List<MetricData> getExportedMetrics() {
|
||||
final List<byte[]> exportRequests;
|
||||
List<byte[]> exportRequests;
|
||||
try {
|
||||
exportRequests = (List<byte[]>) getMetricExportRequests.invokeExact();
|
||||
} catch (Throwable t) {
|
||||
|
@ -273,7 +273,7 @@ public final class AgentTestingExporterAccess {
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static List<LogData> getExportedLogs() {
|
||||
final List<byte[]> exportRequests;
|
||||
List<byte[]> exportRequests;
|
||||
try {
|
||||
exportRequests = (List<byte[]>) getLogExportRequests.invokeExact();
|
||||
} catch (Throwable t) {
|
||||
|
@ -415,7 +415,7 @@ public final class AgentTestingExporterAccess {
|
|||
return points.stream()
|
||||
.map(
|
||||
point -> {
|
||||
final double value;
|
||||
double value;
|
||||
switch (point.getValueCase()) {
|
||||
case AS_INT:
|
||||
value = point.getAsInt();
|
||||
|
@ -438,7 +438,7 @@ public final class AgentTestingExporterAccess {
|
|||
return points.stream()
|
||||
.map(
|
||||
point -> {
|
||||
final long value;
|
||||
long value;
|
||||
switch (point.getValueCase()) {
|
||||
case AS_INT:
|
||||
value = point.getAsInt();
|
||||
|
@ -566,7 +566,7 @@ public final class AgentTestingExporterAccess {
|
|||
}
|
||||
|
||||
private static StatusData fromProto(Status status) {
|
||||
final StatusCode code;
|
||||
StatusCode code;
|
||||
switch (status.getCode()) {
|
||||
case STATUS_CODE_OK:
|
||||
code = StatusCode.OK;
|
||||
|
|
Loading…
Reference in New Issue