Skip to content

Commit

Permalink
Bump errorProneVersion from 2.18.0 to 2.19.0 (#8459)
Browse files Browse the repository at this point in the history
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Lauri Tulmin <[email protected]>
  • Loading branch information
dependabot[bot] and laurit committed May 10, 2023
1 parent 24b65ab commit 3122897
Show file tree
Hide file tree
Showing 37 changed files with 105 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ tasks {
// Allow underscore in test-type method names
disable("MemberName")
}
if (project.path.endsWith(":testing") || name.contains("Test")) {
// This check causes too many failures, ignore the ones in tests
disable("CanIgnoreReturnValueSuggester")
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion dependencyManagement/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ val DEPENDENCY_BOMS = listOf(

val autoServiceVersion = "1.0.1"
val autoValueVersion = "1.10.1"
val errorProneVersion = "2.18.0"
val errorProneVersion = "2.19.0"
val byteBuddyVersion = "1.14.4"
val asmVersion = "9.5"
val jmhVersion = "1.36"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@

package io.opentelemetry.instrumentation.api.instrumenter.http;

import java.util.Locale;
import javax.annotation.Nullable;

final class ForwardedHeaderParser {

/** Extract proto (aka scheme) from "Forwarded" http header. */
@Nullable
static String extractProtoFromForwardedHeader(String forwarded) {
int start = forwarded.toLowerCase().indexOf("proto=");
int start = forwarded.toLowerCase(Locale.ROOT).indexOf("proto=");
if (start < 0) {
return null;
}
Expand All @@ -32,7 +33,7 @@ static String extractProtoFromForwardedProtoHeader(String forwardedProto) {
/** Extract client IP address from "Forwarded" http header. */
@Nullable
static String extractClientIpFromForwardedHeader(String forwarded) {
int start = forwarded.toLowerCase().indexOf("for=");
int start = forwarded.toLowerCase(Locale.ROOT).indexOf("for=");
if (start < 0) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

package io.opentelemetry.instrumentation.api.instrumenter;

import com.google.errorprone.annotations.CanIgnoreReturnValue;
import io.opentelemetry.api.trace.Span;
import io.opentelemetry.api.trace.SpanKind;
import io.opentelemetry.context.Context;
Expand All @@ -20,6 +21,7 @@ enum Noop implements SpanSuppressor {
INSTANCE;

@Override
@CanIgnoreReturnValue
public Context storeInContext(Context context, SpanKind spanKind, Span span) {
return context;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.amazonaws.Response;
import com.amazonaws.handlers.HandlerContextKey;
import com.amazonaws.handlers.RequestHandler2;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import io.opentelemetry.context.Context;
import io.opentelemetry.contrib.awsxray.propagator.AwsXrayPropagator;
import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter;
Expand Down Expand Up @@ -47,6 +48,7 @@ public void beforeRequest(Request<?> request) {
}

@Override
@CanIgnoreReturnValue
public AmazonWebServiceRequest beforeMarshalling(AmazonWebServiceRequest request) {
if (SqsReceiveMessageRequestAccess.isInstance(request)) {
if (!SqsReceiveMessageRequestAccess.getAttributeNames(request)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.BiConsumer;
import java.util.function.Function;
Expand Down Expand Up @@ -838,7 +839,7 @@ private static SpanDataAssert assertClientSpan(
equalTo(SemanticAttributes.DB_CONNECTION_STRING, "h2:mem:"),
satisfies(
SemanticAttributes.DB_STATEMENT,
stringAssert -> stringAssert.startsWith(verb.toLowerCase())),
stringAssert -> stringAssert.startsWith(verb.toLowerCase(Locale.ROOT))),
equalTo(SemanticAttributes.DB_OPERATION, verb),
equalTo(SemanticAttributes.DB_SQL_TABLE, "Value"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import static net.bytebuddy.matcher.ElementMatchers.named;

import com.google.errorprone.annotations.CanIgnoreReturnValue;
import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation;
import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer;
import net.bytebuddy.asm.AsmVisitorWrapper;
Expand Down Expand Up @@ -42,6 +43,7 @@ public int mergeWriter(int flags) {
}

@Override
@CanIgnoreReturnValue
public int mergeReader(int flags) {
return flags;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import static net.bytebuddy.matcher.ElementMatchers.named;

import com.google.errorprone.annotations.CanIgnoreReturnValue;
import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation;
import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer;
import net.bytebuddy.asm.AsmVisitorWrapper;
Expand Down Expand Up @@ -41,6 +42,7 @@ public int mergeWriter(int flags) {
}

@Override
@CanIgnoreReturnValue
public int mergeReader(int flags) {
return flags;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

package io.opentelemetry.javaagent.instrumentation.jaxrs;

import com.google.errorprone.annotations.CanIgnoreReturnValue;
import io.opentelemetry.context.Context;
import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter;
import java.util.function.BiFunction;
Expand All @@ -22,6 +23,7 @@ public CompletionStageFinishCallback(
}

@Override
@CanIgnoreReturnValue
public T apply(T result, Throwable throwable) {
instrumenter.end(context, handlerData, null, throwable);
return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import static java.util.logging.Level.FINE;
import static java.util.regex.Pattern.CASE_INSENSITIVE;

import com.google.errorprone.annotations.CanIgnoreReturnValue;
import io.opentelemetry.instrumentation.jdbc.internal.dbinfo.DbInfo;
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes.DbSystemValues;
import java.io.UnsupportedEncodingException;
Expand Down Expand Up @@ -36,6 +37,7 @@
public enum JdbcConnectionUrlParser {
GENERIC_URL_LIKE() {
@Override
@CanIgnoreReturnValue
DbInfo.Builder doParse(String jdbcUrl, DbInfo.Builder builder) {
try {
// Attempt generic parsing
Expand Down Expand Up @@ -78,6 +80,7 @@ DbInfo.Builder doParse(String jdbcUrl, DbInfo.Builder builder) {
// see http:https://jtds.sourceforge.net/faq.html#urlFormat
JTDS_URL_LIKE() {
@Override
@CanIgnoreReturnValue
DbInfo.Builder doParse(String jdbcUrl, DbInfo.Builder builder) {
String serverName = "";

Expand Down Expand Up @@ -150,6 +153,7 @@ DbInfo.Builder doParse(String jdbcUrl, DbInfo.Builder builder) {
CASE_INSENSITIVE);

@Override
@CanIgnoreReturnValue
DbInfo.Builder doParse(String jdbcUrl, DbInfo.Builder builder) {
String serverName = "";
Integer port = null;
Expand Down Expand Up @@ -361,6 +365,7 @@ DbInfo.Builder doParse(String jdbcUrl, DbInfo.Builder builder) {
private final Pattern userPattern = Pattern.compile("\\(\\s*user\\s*=\\s*([^ )]+)\\s*\\)");

@Override
@CanIgnoreReturnValue
DbInfo.Builder doParse(String jdbcUrl, DbInfo.Builder builder) {
int addressEnd = jdbcUrl.indexOf(",address=");
if (addressEnd > 0) {
Expand Down Expand Up @@ -527,6 +532,7 @@ DbInfo.Builder doParse(String jdbcUrl, DbInfo.Builder builder) {

ORACLE_AT() {
@Override
@CanIgnoreReturnValue
DbInfo.Builder doParse(String jdbcUrl, DbInfo.Builder builder) {
if (jdbcUrl.contains("@(description")) {
return ORACLE_AT_DESCRIPTION.doParse(jdbcUrl, builder);
Expand Down Expand Up @@ -569,6 +575,7 @@ DbInfo.Builder doParse(String jdbcUrl, DbInfo.Builder builder) {
Pattern.compile("\\(\\s*service_name\\s*=\\s*([^ )]+)\\s*\\)");

@Override
@CanIgnoreReturnValue
DbInfo.Builder doParse(String jdbcUrl, DbInfo.Builder builder) {
String[] atSplit = jdbcUrl.split("@", 2);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

package io.opentelemetry.instrumentation.jmx.yaml;

import com.google.errorprone.annotations.CanIgnoreReturnValue;
import io.opentelemetry.instrumentation.jmx.engine.BeanAttributeExtractor;
import io.opentelemetry.instrumentation.jmx.engine.BeanGroup;
import io.opentelemetry.instrumentation.jmx.engine.MetricAttribute;
Expand Down Expand Up @@ -79,6 +80,7 @@ public void setPrefix(String prefix) {
this.prefix = validatePrefix(prefix.trim());
}

@CanIgnoreReturnValue
private String validatePrefix(String prefix) {
// Do not accept empty string.
// While it is theoretically acceptable, it probably indicates a user error.
Expand All @@ -98,6 +100,7 @@ public void setMapping(Map<String, Metric> mapping) {
this.mapping = validateAttributeMapping(mapping);
}

@CanIgnoreReturnValue
private static Map<String, Metric> validateAttributeMapping(Map<String, Metric> mapping) {
if (mapping.isEmpty()) {
throw new IllegalStateException("No MBean attributes specified");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

package io.opentelemetry.instrumentation.jmx.yaml;

import com.google.errorprone.annotations.CanIgnoreReturnValue;
import io.opentelemetry.instrumentation.jmx.engine.MetricInfo;
import javax.annotation.Nullable;

Expand All @@ -28,6 +29,7 @@ public void setMetric(String metric) {
this.metric = validateMetricName(metric.trim());
}

@CanIgnoreReturnValue
private String validateMetricName(String name) {
requireNonEmpty(name, "The metric name is empty");
return name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@

package io.opentelemetry.instrumentation.jmx.yaml;

import com.google.errorprone.annotations.CanIgnoreReturnValue;
import io.opentelemetry.instrumentation.jmx.engine.MetricAttribute;
import io.opentelemetry.instrumentation.jmx.engine.MetricAttributeExtractor;
import io.opentelemetry.instrumentation.jmx.engine.MetricInfo;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Map;

/**
Expand Down Expand Up @@ -37,7 +39,7 @@ abstract class MetricStructure {

public void setType(String t) {
// Do not complain about case variations
t = t.trim().toUpperCase();
t = t.trim().toUpperCase(Locale.ROOT);
this.metricType = MetricInfo.Type.valueOf(t);
}

Expand All @@ -49,6 +51,7 @@ public void setUnit(String unit) {
this.unit = validateUnit(unit.trim());
}

@CanIgnoreReturnValue
private String validateUnit(String unit) {
requireNonEmpty(unit, "Metric unit is empty");
return unit;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

package io.opentelemetry.instrumentation.kafkaclients.v2_6;

import com.google.errorprone.annotations.CanIgnoreReturnValue;
import io.opentelemetry.api.GlobalOpenTelemetry;
import java.util.Map;
import java.util.Objects;
Expand All @@ -27,6 +28,7 @@ public class TracingConsumerInterceptor<K, V> implements ConsumerInterceptor<K,
private String clientId;

@Override
@CanIgnoreReturnValue
public ConsumerRecords<K, V> onConsume(ConsumerRecords<K, V> records) {
telemetry.buildAndFinishSpan(records, consumerGroup, clientId);
return records;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

package io.opentelemetry.instrumentation.kafkaclients.v2_6;

import com.google.errorprone.annotations.CanIgnoreReturnValue;
import io.opentelemetry.api.GlobalOpenTelemetry;
import java.util.Map;
import java.util.Objects;
Expand All @@ -26,6 +27,7 @@ public class TracingProducerInterceptor<K, V> implements ProducerInterceptor<K,
@Nullable private String clientId;

@Override
@CanIgnoreReturnValue
public ProducerRecord<K, V> onSend(ProducerRecord<K, V> producerRecord) {
telemetry.buildAndInjectSpan(producerRecord, clientId);
return producerRecord;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import static io.opentelemetry.javaagent.instrumentation.play.v2_6.Play26Singletons.instrumenter;

import com.google.errorprone.annotations.CanIgnoreReturnValue;
import io.opentelemetry.context.Context;
import play.api.mvc.Result;
import scala.concurrent.ExecutionContext;
Expand All @@ -21,13 +22,15 @@ public static Future<Result> wrap(
return future.transform(
new AbstractFunction1<Result, Result>() {
@Override
@CanIgnoreReturnValue
public Result apply(Result result) {
instrumenter().end(context, null, null, null);
return result;
}
},
new AbstractFunction1<Throwable, Throwable>() {
@Override
@CanIgnoreReturnValue
public Throwable apply(Throwable throwable) {
instrumenter().end(context, null, null, throwable);
return throwable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import io.opentelemetry.api.common.AttributesBuilder;
import io.opentelemetry.sdk.resources.Resource;
import io.opentelemetry.semconv.resource.attributes.ResourceAttributes;
import java.util.Locale;
import javax.annotation.Nullable;

/** Factory of a {@link Resource} which provides information about the current operating system. */
Expand Down Expand Up @@ -60,7 +61,7 @@ static Resource buildResource() {

@Nullable
private static String getOs(String os) {
os = os.toLowerCase();
os = os.toLowerCase(Locale.ROOT);
if (os.startsWith("windows")) {
return ResourceAttributes.OsTypeValues.WINDOWS;
} else if (os.startsWith("linux")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import java.util.regex.Pattern;

/** Factory of a {@link Resource} which provides information about the current running process. */
Expand Down Expand Up @@ -72,7 +73,7 @@ private static Resource doBuildResource() {
.append("bin")
.append(File.separatorChar)
.append("java");
if (osName != null && osName.toLowerCase().startsWith("windows")) {
if (osName != null && osName.toLowerCase(Locale.ROOT).startsWith("windows")) {
executablePath.append(".exe");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public static ContextPayload from(Context context) {
return payload;
}

@SuppressWarnings("BanSerializableRead")
public static ContextPayload read(ObjectInput oi) throws IOException {
try {
Object object = oi.readObject();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

package io.opentelemetry.instrumentation.spring.integration.v4_1;

import com.google.errorprone.annotations.CanIgnoreReturnValue;
import io.opentelemetry.api.trace.Span;
import io.opentelemetry.context.Context;
import io.opentelemetry.context.propagation.ContextPropagators;
Expand Down Expand Up @@ -137,6 +138,7 @@ public boolean preReceive(MessageChannel messageChannel) {
}

@Override
@CanIgnoreReturnValue
public Message<?> postReceive(Message<?> message, MessageChannel messageChannel) {
return message;
}
Expand All @@ -146,6 +148,7 @@ public void afterReceiveCompletion(
Message<?> message, MessageChannel messageChannel, Exception e) {}

@Override
@CanIgnoreReturnValue
public Message<?> beforeHandle(
Message<?> message, MessageChannel channel, MessageHandler handler) {

Expand Down
Loading

0 comments on commit 3122897

Please sign in to comment.