Enable checkstyle overload method ordering rule for Google Java Style (#1656)
This commit is contained in:
parent
cea28356c6
commit
2e51003900
|
@ -270,9 +270,7 @@
|
|||
PARAMETER_DEF, VARIABLE_DEF, METHOD_DEF, PATTERN_VARIABLE_DEF, RECORD_DEF,
|
||||
RECORD_COMPONENT_DEF"/>
|
||||
</module>
|
||||
<!--
|
||||
<module name="OverloadMethodsDeclarationOrder"/>
|
||||
-->
|
||||
<!-- there are only a few violations of this, and they all appear to be for good reasons
|
||||
<module name="VariableDeclarationUsageDistance"/>
|
||||
-->
|
||||
|
|
|
@ -64,7 +64,7 @@ public abstract class HttpClientTracer<REQUEST, CARRIER, RESPONSE> extends BaseT
|
|||
}
|
||||
|
||||
public Span startSpan(REQUEST request, long startTimeNanos) {
|
||||
return startSpan(request, spanNameForRequest(request), startTimeNanos);
|
||||
return internalStartSpan(request, spanNameForRequest(request), startTimeNanos);
|
||||
}
|
||||
|
||||
public Scope startScope(Span span, CARRIER carrier) {
|
||||
|
@ -103,7 +103,7 @@ public abstract class HttpClientTracer<REQUEST, CARRIER, RESPONSE> extends BaseT
|
|||
* Returns a new client {@link Span} if there is no client {@link Span} in the current {@link
|
||||
* Context}, or an invalid {@link Span} otherwise.
|
||||
*/
|
||||
private Span startSpan(REQUEST request, String name, long startTimeNanos) {
|
||||
private Span internalStartSpan(REQUEST request, String name, long startTimeNanos) {
|
||||
Context context = Context.current();
|
||||
Span clientSpan = context.get(CONTEXT_CLIENT_SPAN_KEY);
|
||||
|
||||
|
|
|
@ -88,6 +88,11 @@ public abstract class TracingRequestStreamHandler implements RequestStreamHandle
|
|||
delegate.write(b, off, len);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(int b) throws IOException {
|
||||
delegate.write(b);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flush() throws IOException {
|
||||
delegate.flush();
|
||||
|
@ -99,10 +104,5 @@ public abstract class TracingRequestStreamHandler implements RequestStreamHandle
|
|||
tracer.end(span);
|
||||
OpenTelemetrySdk.getGlobalTracerManagement().forceFlush().join(1, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(int b) throws IOException {
|
||||
delegate.write(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -135,13 +135,6 @@ public class TracingCqlSession implements CqlSession {
|
|||
return session.getMetrics();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public <RequestT extends Request, ResultT> ResultT execute(
|
||||
@NonNull RequestT request, @NonNull GenericType<ResultT> resultType) {
|
||||
return session.execute(request, resultType);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NonNull
|
||||
public CompletionStage<Void> closeFuture() {
|
||||
|
@ -170,15 +163,21 @@ public class TracingCqlSession implements CqlSession {
|
|||
session.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public <RequestT extends Request, ResultT> ResultT execute(
|
||||
@NonNull RequestT request, @NonNull GenericType<ResultT> resultType) {
|
||||
return session.execute(request, resultType);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NonNull
|
||||
public ResultSet execute(@NonNull Statement<?> statement) {
|
||||
String query = getQuery(statement);
|
||||
public ResultSet execute(@NonNull String query) {
|
||||
|
||||
Span span = tracer().startSpan(session, query);
|
||||
try (Scope ignored = tracer().startScope(span)) {
|
||||
try {
|
||||
ResultSet resultSet = session.execute(statement);
|
||||
ResultSet resultSet = session.execute(query);
|
||||
tracer().onResponse(span, resultSet.getExecutionInfo());
|
||||
return resultSet;
|
||||
} catch (RuntimeException e) {
|
||||
|
@ -192,12 +191,13 @@ public class TracingCqlSession implements CqlSession {
|
|||
|
||||
@Override
|
||||
@NonNull
|
||||
public ResultSet execute(@NonNull String query) {
|
||||
public ResultSet execute(@NonNull Statement<?> statement) {
|
||||
String query = getQuery(statement);
|
||||
|
||||
Span span = tracer().startSpan(session, query);
|
||||
try (Scope ignored = tracer().startScope(span)) {
|
||||
try {
|
||||
ResultSet resultSet = session.execute(query);
|
||||
ResultSet resultSet = session.execute(statement);
|
||||
tracer().onResponse(span, resultSet.getExecutionInfo());
|
||||
return resultSet;
|
||||
} catch (RuntimeException e) {
|
||||
|
|
|
@ -48,11 +48,21 @@ public class TracingList extends TracingIterable implements List<ConsumerRecord<
|
|||
return delegate.add(consumerRecord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(int index, ConsumerRecord element) {
|
||||
delegate.add(index, element);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean remove(Object o) {
|
||||
return delegate.remove(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConsumerRecord<?, ?> remove(int index) {
|
||||
return delegate.remove(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsAll(Collection<?> c) {
|
||||
return delegate.containsAll(c);
|
||||
|
@ -94,16 +104,6 @@ public class TracingList extends TracingIterable implements List<ConsumerRecord<
|
|||
return delegate.set(index, element);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(int index, ConsumerRecord element) {
|
||||
delegate.add(index, element);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConsumerRecord<?, ?> remove(int index) {
|
||||
return delegate.remove(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int indexOf(Object o) {
|
||||
return delegate.indexOf(o);
|
||||
|
|
|
@ -44,17 +44,6 @@ public class Bridging {
|
|||
}
|
||||
}
|
||||
|
||||
public static io.opentelemetry.api.trace.Span toAgentOrNull(Span applicationSpan) {
|
||||
if (!applicationSpan.getSpanContext().isValid()) {
|
||||
// no need to wrap
|
||||
return io.opentelemetry.api.trace.Span.getInvalid();
|
||||
} else if (applicationSpan instanceof ApplicationSpan) {
|
||||
return ((ApplicationSpan) applicationSpan).getAgentSpan();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static SpanContext toApplication(io.opentelemetry.api.trace.SpanContext agentContext) {
|
||||
if (agentContext.isRemote()) {
|
||||
return SpanContext.createFromRemoteParent(
|
||||
|
@ -71,6 +60,32 @@ public class Bridging {
|
|||
}
|
||||
}
|
||||
|
||||
private static TraceState toApplication(io.opentelemetry.api.trace.TraceState agentTraceState) {
|
||||
TraceState.Builder applicationTraceState = TraceState.builder();
|
||||
agentTraceState.forEach(applicationTraceState::set);
|
||||
return applicationTraceState.build();
|
||||
}
|
||||
|
||||
public static io.opentelemetry.api.trace.Span toAgentOrNull(Span applicationSpan) {
|
||||
if (!applicationSpan.getSpanContext().isValid()) {
|
||||
// no need to wrap
|
||||
return io.opentelemetry.api.trace.Span.getInvalid();
|
||||
} else if (applicationSpan instanceof ApplicationSpan) {
|
||||
return ((ApplicationSpan) applicationSpan).getAgentSpan();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static io.opentelemetry.api.trace.Span.Kind toAgentOrNull(Span.Kind applicationSpanKind) {
|
||||
try {
|
||||
return io.opentelemetry.api.trace.Span.Kind.valueOf(applicationSpanKind.name());
|
||||
} catch (IllegalArgumentException e) {
|
||||
log.debug("unexpected span kind: {}", applicationSpanKind.name());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static io.opentelemetry.api.trace.SpanContext toAgent(SpanContext applicationContext) {
|
||||
if (applicationContext.isRemote()) {
|
||||
return io.opentelemetry.api.trace.SpanContext.createFromRemoteParent(
|
||||
|
@ -150,21 +165,6 @@ public class Bridging {
|
|||
return agentCanonicalCode;
|
||||
}
|
||||
|
||||
public static io.opentelemetry.api.trace.Span.Kind toAgentOrNull(Span.Kind applicationSpanKind) {
|
||||
try {
|
||||
return io.opentelemetry.api.trace.Span.Kind.valueOf(applicationSpanKind.name());
|
||||
} catch (IllegalArgumentException e) {
|
||||
log.debug("unexpected span kind: {}", applicationSpanKind.name());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static TraceState toApplication(io.opentelemetry.api.trace.TraceState agentTraceState) {
|
||||
TraceState.Builder applicationTraceState = TraceState.builder();
|
||||
agentTraceState.forEach(applicationTraceState::set);
|
||||
return applicationTraceState.build();
|
||||
}
|
||||
|
||||
private static io.opentelemetry.api.trace.TraceState toAgent(TraceState applicationTraceState) {
|
||||
io.opentelemetry.api.trace.TraceState.Builder agentTraceState =
|
||||
io.opentelemetry.api.trace.TraceState.builder();
|
||||
|
|
|
@ -68,14 +68,6 @@ public class AdviceUtils {
|
|||
}
|
||||
}
|
||||
|
||||
private static void finishSpanIfPresentInAttributes(
|
||||
Map<String, Object> attributes, Throwable throwable) {
|
||||
|
||||
io.opentelemetry.context.Context context =
|
||||
(io.opentelemetry.context.Context) attributes.remove(CONTEXT_ATTRIBUTE);
|
||||
finishSpanIfPresent(context, throwable);
|
||||
}
|
||||
|
||||
static void finishSpanIfPresent(io.opentelemetry.context.Context context, Throwable throwable) {
|
||||
if (context != null) {
|
||||
Span span = Span.fromContext(context);
|
||||
|
@ -87,6 +79,14 @@ public class AdviceUtils {
|
|||
}
|
||||
}
|
||||
|
||||
private static void finishSpanIfPresentInAttributes(
|
||||
Map<String, Object> attributes, Throwable throwable) {
|
||||
|
||||
io.opentelemetry.context.Context context =
|
||||
(io.opentelemetry.context.Context) attributes.remove(CONTEXT_ATTRIBUTE);
|
||||
finishSpanIfPresent(context, throwable);
|
||||
}
|
||||
|
||||
public static class SpanFinishingSubscriber<T> implements CoreSubscriber<T> {
|
||||
|
||||
private final CoreSubscriber<? super T> subscriber;
|
||||
|
|
|
@ -127,7 +127,7 @@ public final class ReferenceMatcher {
|
|||
new Mismatch.MissingClass(
|
||||
reference.getSources().toArray(new Source[0]), reference.getClassName()));
|
||||
}
|
||||
return checkMatch(reference, resolution.resolve());
|
||||
return checkThirdPartyTypeMatch(reference, resolution.resolve());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
if (e.getMessage().startsWith("Cannot resolve type description for ")) {
|
||||
|
@ -187,7 +187,8 @@ public final class ReferenceMatcher {
|
|||
superType -> collectMethodsFromTypeHierarchy(superType, abstractMethods, plainMethods));
|
||||
}
|
||||
|
||||
private static List<Mismatch> checkMatch(Reference reference, TypeDescription typeOnClasspath) {
|
||||
private static List<Mismatch> checkThirdPartyTypeMatch(
|
||||
Reference reference, TypeDescription typeOnClasspath) {
|
||||
List<Mismatch> mismatches = Collections.emptyList();
|
||||
|
||||
for (Reference.Flag flag : reference.getFlags()) {
|
||||
|
|
Loading…
Reference in New Issue