Skip to content

recompile downstream when Java annotation changes #1079

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 4, 2022

Conversation

SethTisue
Copy link
Member

@SethTisue SethTisue commented Mar 17, 2022

fixes #630

@SethTisue
Copy link
Member Author

Jason thinks the approach sounds good and notes,

Looks like Java annotations all have the same parent interface:

The direct superinterface type of an annotation interface is always
java.lang.annotation.Annotation (§9.1.3).

So we don't need to do any sort of transitive invalidation

@SethTisue SethTisue force-pushed the issue-630 branch 7 times, most recently from 68b4ee8 to 5ffb3a0 Compare May 9, 2022 14:59
@SethTisue SethTisue force-pushed the issue-630 branch 4 times, most recently from 760b1d1 to 95b33e4 Compare May 10, 2022 13:29
@SethTisue
Copy link
Member Author

SethTisue commented May 10, 2022

My initial implementation temporarily, kludgily overloaded the hasMacro flag to mean "has macro declaration or annotation definition", just as a quick way to get the tests passing.

The theme for today was to figure out what to do instead. I initially assumed that I would need to add an hasAnnotation flag to AnalyzedClass, alongside the existing hasMacro flag, and that would mean changing both the contraband and the protobuf.

But after discussion with @dwijnand and @retronym, we decided that would be overkill. We suspect that the hasMacro flag exists because the invalidation situation with macros is more complex: there is the definition and the separate implementation, and when the implementation changes we need to treat that (unlike the body of an ordinary method changing) as an API change.

But here the situation is simpler, so they suggested we could just have detectAPIChanges in IncrementalCommon directly check the parents to see if java.lang.annotation.Annotation is present.

And that approach seems to be working out.

@SethTisue SethTisue marked this pull request as ready for review May 10, 2022 14:37
@SethTisue
Copy link
Member Author

I think this is ready to go, but there's a customer that might like to test it before merge.

@SethTisue SethTisue requested a review from dwijnand May 10, 2022 15:27
@SethTisue
Copy link
Member Author

SethTisue commented May 10, 2022

@dwijnand I've review-requested you, but also, do you think there's anyone else who should or might like to take a look?

@SethTisue
Copy link
Member Author

(rebased, without any changes)

I discovered that ParserSpecification was only testing that the Parser
returned a non-null result, but that wasn't enough to fully exercise
the parser; the annotations parser, for example, doesn't kick in
unless you call `types` on the result. so let's do that.
@eed3si9n
Copy link
Member

eed3si9n commented Jul 4, 2022

I am gonna merge this so it'll be part of 1.7.0.

@eed3si9n eed3si9n merged commit 189d33b into sbt:develop Jul 4, 2022
@SethTisue
Copy link
Member Author

regression report at sbt/sbt#6969 — I'll work on a fix pronto

@SethTisue SethTisue deleted the issue-630 branch July 11, 2022 23:13
SethTisue added a commit to SethTisue/zinc that referenced this pull request Jul 11, 2022
SethTisue added a commit to SethTisue/zinc that referenced this pull request Jul 11, 2022
SethTisue added a commit to SethTisue/zinc that referenced this pull request Jul 11, 2022
SethTisue added a commit to SethTisue/zinc that referenced this pull request Jul 11, 2022
SethTisue added a commit to SethTisue/zinc that referenced this pull request Jul 11, 2022
SethTisue added a commit to SethTisue/zinc that referenced this pull request Jul 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants