Add default implementations for getInstrumentationScopeInfo methods (#4640)
This commit is contained in:
parent
467a275825
commit
facbf4fb9e
|
@ -39,6 +39,11 @@ class AllowDefaultMethodRule : AbstractRecordingSeenMembers() {
|
|||
// semver.
|
||||
continue
|
||||
}
|
||||
if (change == JApiCompatibilityChange.METHOD_ABSTRACT_NOW_DEFAULT) {
|
||||
// Adding default implementations to interface methods previously abstract is not a breaking
|
||||
// change.
|
||||
continue
|
||||
}
|
||||
if (!change.isBinaryCompatible) {
|
||||
return Violation.notBinaryCompatible(member, Severity.error)
|
||||
}
|
||||
|
@ -101,7 +106,8 @@ if (!project.hasProperty("otel.release") && !project.name.startsWith("bom")) {
|
|||
|
||||
// Reproduce defaults from https://github.com/melix/japicmp-gradle-plugin/blob/09f52739ef1fccda6b4310cf3f4b19dc97377024/src/main/java/me/champeau/gradle/japicmp/report/ViolationsGenerator.java#L130
|
||||
// only changing the BinaryIncompatibleRule to our custom one that allows new default methods
|
||||
// on interfaces.
|
||||
// on interfaces, and adding default implementations to interface methods previously
|
||||
// abstract.
|
||||
richReport {
|
||||
addSetupRule(RecordSeenMembersSetup::class.java)
|
||||
addRule(JApiChangeStatus.NEW, SourceCompatibleRule::class.java)
|
||||
|
|
|
@ -1,2 +1,4 @@
|
|||
Comparing source compatibility of against
|
||||
No changes.
|
||||
**** MODIFIED CLASS: PUBLIC ABSTRACT io.opentelemetry.sdk.testing.trace.TestSpanData (not serializable)
|
||||
=== CLASS FILE FORMAT VERSION: 52.0 <- 52.0
|
||||
+++* NEW METHOD: PUBLIC(+) ABSTRACT(+) io.opentelemetry.sdk.common.InstrumentationScopeInfo getInstrumentationScopeInfo()
|
||||
|
|
|
@ -1,2 +1,7 @@
|
|||
Comparing source compatibility of against
|
||||
No changes.
|
||||
***! MODIFIED INTERFACE: PUBLIC ABSTRACT io.opentelemetry.sdk.trace.data.SpanData (not serializable)
|
||||
=== CLASS FILE FORMAT VERSION: 52.0 <- 52.0
|
||||
***! MODIFIED METHOD: PUBLIC NON_ABSTRACT (<- ABSTRACT) io.opentelemetry.sdk.common.InstrumentationScopeInfo getInstrumentationScopeInfo()
|
||||
***! MODIFIED INTERFACE: PUBLIC ABSTRACT io.opentelemetry.sdk.trace.ReadableSpan (not serializable)
|
||||
=== CLASS FILE FORMAT VERSION: 52.0 <- 52.0
|
||||
***! MODIFIED METHOD: PUBLIC NON_ABSTRACT (<- ABSTRACT) io.opentelemetry.sdk.common.InstrumentationScopeInfo getInstrumentationScopeInfo()
|
||||
|
|
|
@ -63,6 +63,9 @@ public abstract class TestSpanData implements SpanData {
|
|||
return InstrumentationScopeUtil.toInstrumentationLibraryInfo(getInstrumentationScopeInfo());
|
||||
}
|
||||
|
||||
@Override
|
||||
public abstract InstrumentationScopeInfo getInstrumentationScopeInfo();
|
||||
|
||||
/** A {@code Builder} class for {@link TestSpanData}. */
|
||||
@AutoValue.Builder
|
||||
public abstract static class Builder {
|
||||
|
|
|
@ -10,6 +10,7 @@ import io.opentelemetry.api.trace.Span;
|
|||
import io.opentelemetry.api.trace.SpanContext;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.sdk.common.InstrumentationScopeInfo;
|
||||
import io.opentelemetry.sdk.internal.InstrumentationScopeUtil;
|
||||
import io.opentelemetry.sdk.trace.data.SpanData;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
|
@ -68,7 +69,9 @@ public interface ReadableSpan {
|
|||
*
|
||||
* @return an instance of {@link InstrumentationScopeInfo} describing the instrumentation scope
|
||||
*/
|
||||
InstrumentationScopeInfo getInstrumentationScopeInfo();
|
||||
default InstrumentationScopeInfo getInstrumentationScopeInfo() {
|
||||
return InstrumentationScopeUtil.toInstrumentationScopeInfo(getInstrumentationLibraryInfo());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether this Span has already been ended.
|
||||
|
|
|
@ -9,6 +9,7 @@ import io.opentelemetry.api.common.Attributes;
|
|||
import io.opentelemetry.api.trace.SpanContext;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.sdk.common.InstrumentationScopeInfo;
|
||||
import io.opentelemetry.sdk.internal.InstrumentationScopeUtil;
|
||||
import io.opentelemetry.sdk.resources.Resource;
|
||||
import io.opentelemetry.sdk.trace.SpanLimits;
|
||||
import java.util.List;
|
||||
|
@ -165,7 +166,9 @@ public interface SpanData {
|
|||
*
|
||||
* @return an instance of {@link InstrumentationScopeInfo}
|
||||
*/
|
||||
InstrumentationScopeInfo getInstrumentationScopeInfo();
|
||||
default InstrumentationScopeInfo getInstrumentationScopeInfo() {
|
||||
return InstrumentationScopeUtil.toInstrumentationScopeInfo(getInstrumentationLibraryInfo());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the resource of this {@code Span}.
|
||||
|
|
Loading…
Reference in New Issue