Skip to content

Conversation

Stephan202
Copy link
Contributor

This mirrors the changes in 04c1b7a for
similar #compare methods.

This mirrors the changes in 04c1b7a for
similar `#compare` methods.
@cpovirk cpovirk self-assigned this Aug 23, 2024
@cpovirk cpovirk added type=documentation Documentation that is other than for an API package=primitives P2 labels Aug 23, 2024
copybara-service bot pushed a commit that referenced this pull request Aug 23, 2024
This mirrors the changes in 04c1b7a for
similar `#compare` methods.

Fixes #7371

RELNOTES=n/a
PiperOrigin-RevId: 666903924
@Stephan202 Stephan202 deleted the improvement/inlineme-additional-compare-methods branch August 23, 2024 21:25
@Stephan202
Copy link
Contributor Author

Super fast @cpovirk! 🚀

@kluever
Copy link
Member

kluever commented Aug 25, 2024

@Stephan202 Just curious if the addition of @InlineMe on deprecated, inlineable APIs like this is helpful for you / your organization? Inside of Google, we have a lot of automation to perform these edits automatically, but would love to hear if / how these are helpful for external users! Thanks

@Stephan202
Copy link
Contributor Author

Hey @kluever! Inside Picnic, by default, all Java builds run with Error Prone and -Werror, so @InlineMe is an effective way for library authors to nudge us away from a (soft-)deprecated API:

  • We can't accidentally miss the relevant release note during an upgrade. (Cause usage of an @InlineMe-annotated method will cause the build to fail. (Likewise for usage of @Deprecated-annotated methods, but the #compare methods aren't annotated as such.))
  • Thanks for Error Prone's patching feature, each team can accept the inline suggestion simply by running a shared patch.sh script: at scale this can save significant developer time.

Our setup also runs Refaster as an Error Prone check, which can achieve similar behavior. That's why PicnicSupermarket/error-prone-support#1293 triggered me to file this pull request: I noticed that we could phase out only 5 out of 7 similar Refaster rules; this PR covers the remainder.

I think it'd be great if more libraries adopted @InlineMe; one could even imagine a future where tools such as Renovate and Dependabot are configured to automatically apply the suggested changes.

@Stephan202
Copy link
Contributor Author

(For anybody interested in what the Picnic build setup concretely looks like: this Maven parent and this patch script should give one an idea. Not 100% identical, but close enough.)

@kluever
Copy link
Member

kluever commented Aug 26, 2024

@Stephan202 Amazing --- that's great to hear! A few years ago, after implementing @InlineMe, I spent some time open-sourcing it, and I've always been curious if anyone anyone externally was benefiting from it --- so this anecdote is very helpful. Thank you!

Inside of Google, we actually have the patches produced by @InlineMe automatically applied, approved, and submitted across the codebase --- so adding the annotation triggers a very powerful pipeline. I realize that setup doesn't exist externally, but it's still reassuring to hear that it's been useful, even in it's current state.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 package=primitives type=documentation Documentation that is other than for an API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants