Skip to content
This repository has been archived by the owner on Oct 10, 2024. It is now read-only.

1.10.0 contained a binary-incompatible change #741

Closed
cpovirk opened this issue Oct 4, 2019 · 4 comments
Closed

1.10.0 contained a binary-incompatible change #741

cpovirk opened this issue Oct 4, 2019 · 4 comments

Comments

@cpovirk
Copy link

cpovirk commented Oct 4, 2019

870ece8#diff-4ca26bfec5c8a3f2731fb1662b1b40beL61 changed the return type of ClassName.withoutAnnotations():

https://abi-laboratory.pro/index.php?view=compat_report&lang=java&l=javapoet&v1=1.9.0&v2=1.10.0&obj=ad89e&kind=bin#Method_Problems_High

I noticed this because, in our project, Maven was choosing the older JavaPoet version from one of our annotation processors instead of the newer version from another. I can fix the problem for us by overriding to the new version (which is the right thing to do, anyway), but in theory, there could be a problem if some annotation processor were compiled against the old version and another against the new. Of course the old one should update and recompile, but presumably the intention was to maintain binary compatibility.

I also see a report here: https://stackoverflow.com/q/57490437/28465
And possibly this is similar: apollographql/apollo-kotlin#1113

I have a PR underway.

@cpovirk
Copy link
Author

cpovirk commented Oct 4, 2019

(I am a little confused because I thought that the supermethod forced the compiler to generate a bridge method already, but either it's not there, or it's not being selected for some reason....)

@JakeWharton
Copy link
Collaborator

But the change was a covariant specialization which shouldn't cause compatibility in practice, right?

@cpovirk
Copy link
Author

cpovirk commented Oct 4, 2019

Oh, wait, yeah, the bridge method is already there. The problem, again, is Maven's choice of the old version. I'm surprised that the ABI Tracker is getting it wrong.

Given that, the error is what you'd expect:

java.lang.NoSuchMethodError: com.squareup.javapoet.ClassName.withoutAnnotations()Lcom/squareup/javapoet/ClassName;

I'd gotten confused and thought the report was:

java.lang.NoSuchMethodError: com.squareup.javapoet.ClassName.withoutAnnotations()Lcom/squareup/javapoet/TypeName;

Sorry for the noise.

@cpovirk cpovirk closed this as completed Oct 4, 2019
@cpovirk
Copy link
Author

cpovirk commented Oct 4, 2019

(There's already an issue for the ABI Tracker: lvc/japi-compliance-checker#50)

cpovirk added a commit to google/caliper that referenced this issue Oct 4, 2019
1. AutoValue depends on an older version of JavaPoet than Dagger does, but Maven picks AutoValue's version, so Dagger sees:

java.lang.NoSuchMethodError: com.squareup.javapoet.ClassName.withoutAnnotations()Lcom/squareup/javapoet/ClassName;

(I thought at one point that there was a real problem with JavaPoet's binary compatibility, but I was wrong: square/javapoet#741)

2. The newer version of AutoValue is split into auto-value and auto-value-annotations. Our compile dependencies need to be on the latter.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=272884058
cpovirk added a commit to google/caliper that referenced this issue Oct 4, 2019
1. AutoValue depends on an older version of JavaPoet than Dagger does, but Maven picks AutoValue's version, so Dagger sees:

java.lang.NoSuchMethodError: com.squareup.javapoet.ClassName.withoutAnnotations()Lcom/squareup/javapoet/ClassName;

(I thought at one point that there was a real problem with JavaPoet's binary compatibility, but I was wrong: square/javapoet#741)

2. The newer version of AutoValue is split into auto-value and auto-value-annotations. Our compile dependencies need to be on the latter.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=272884058
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants