Remove japicmp special case (#6933)
This commit is contained in:
parent
23780762b0
commit
af1e1d57ee
|
@ -47,55 +47,8 @@ class AllowNewAbstractMethodOnAutovalueClasses : AbstractRecordingSeenMembers()
|
|||
}
|
||||
|
||||
class SourceIncompatibleRule : AbstractRecordingSeenMembers() {
|
||||
|
||||
fun ignoreAddLogRecordProcessorCustomizerReturnTypeChange(member: JApiCompatibility): Violation? {
|
||||
if (member is JApiClass &&
|
||||
member.newClass.get().name.equals("io.opentelemetry.sdk.autoconfigure.AutoConfiguredOpenTelemetrySdkBuilder") &&
|
||||
member.isChangeCausedByClassElement
|
||||
) {
|
||||
// member.isChangeCausedByClassElement check above
|
||||
// limits source of changes to fields, methods and constructors
|
||||
|
||||
for (method in member.methods) {
|
||||
if (!method.isSourceCompatible()) {
|
||||
// addLogRecordProcessorCustomizer method had a return type change from base to impl class,
|
||||
// japicmp (correctly) doesn't consider it as a METHOD_RETURN_TYPE_CHANGED
|
||||
// compatibility issue. But still thinks that something wrong.
|
||||
// Since it thinks that method did not change, it reports it as class-level violation,
|
||||
// and we need to suppress it, but keep other checks on.
|
||||
if (method.name.equals("addLogRecordProcessorCustomizer") &&
|
||||
method.compatibilityChanges.isEmpty() &&
|
||||
method.changeStatus == JApiChangeStatus.UNCHANGED) {
|
||||
return null;
|
||||
}
|
||||
return Violation.error(method, "Method is not source compatible: $method")
|
||||
}
|
||||
}
|
||||
|
||||
for (field in member.fields) {
|
||||
if (!field.isSourceCompatible()) {
|
||||
return Violation.error(field, "Field is not source compatible: $field")
|
||||
}
|
||||
}
|
||||
|
||||
for (constructor in member.constructors) {
|
||||
if (!constructor.isSourceCompatible()) {
|
||||
return Violation.error(constructor, "Constructor is not source compatible: $constructor")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Violation.error(member, "Not source compatible: $member")
|
||||
}
|
||||
|
||||
override fun maybeAddViolation(member: JApiCompatibility): Violation? {
|
||||
if (!member.isSourceCompatible()) {
|
||||
// TODO: remove after 1.36.0 is released, see https://github.com/open-telemetry/opentelemetry-java/pull/6248
|
||||
if (member.compatibilityChanges.isEmpty()) {
|
||||
return ignoreAddLogRecordProcessorCustomizerReturnTypeChange(member)
|
||||
}
|
||||
// end of suppression
|
||||
|
||||
return Violation.error(member, "Not source compatible: $member")
|
||||
}
|
||||
return null
|
||||
|
|
Loading…
Reference in New Issue