Configure japicmp classpath to avoid false positives #7945
Merged
+67
−40
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I was working on potential changes to the API and got dragged down a rabbit hole when japicmp was inappropriately flagging a change as breaking binary compatibility. I.e. japicmp had a false positive.
In my case, I was toying with lifting a method from
Spanto a new superinterface. Japicmp flagged the method as deleted even tho it still exists on the new superinterface. After too many hours debugging and inspecting the japicmp source code, I figured out that its because we improperly configure japicmp. Japicmp has config properties that allow you to set the old and new archives to compare, and the old and new classpaths for those archives. We are:The second point causes japicmp to blow up when it tries to resolve superinterfaces / superclasses which come from different artifacts. For example,
Span extends ImplicitKeyedContext- japicmp is unable to resolveImplicitKeyedContextbecauseopentelemetry-contextis not on the classpath.My solution: for each artifact we're comparing, set the classpath to the set of all artifacts published by
opentelemetry-java. If the artifact isn't needed, it doesn't hurt for it to be present. This means we're still exposed to these types of false positives if published classes / interfaces which extended types from external projects (i.e. if we had something in theopentelemetry-exporter-zipkinthat extended something fromzipkin-sender-okhttp3), but this should be rare or non existent.I spent too much time on this for the impact, but I'm pretty sure I've come across these types of false positives in the past. At some point, you just have to bite the bullet and take the time to understand the tools you depend on.