Skip to content
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

core: Rewrite builder class signatures to avoid internal class #7834

Merged
merged 2 commits into from Jan 26, 2021

Conversation

ejona86
Copy link
Member

@ejona86 ejona86 commented Jan 22, 2021

This provides us a path forward with #7211 (hiding
AbstractManagedChannelImplBuilder and AbstractServerImplBuilder) while
providing users a migration path to manage the ABI breakage (#7552). We
do a .class hack so that recompiling avoids the internal class reference
yet the old methods are still available.

Leaving the classes as-is causes javac to compile two versions of each
method, one returning the public class (e.g. ServerBuilder) and one
returning the internal class (e.g., AbstractServerImplBuilder). However,
we rewrite the signature that is used at compile time so that new
compilations will not reference internal-returning methods.

This is intended to be temporary, just to give a migration path. Once we
have given users some time to recompile we will remove this rewriting
and change the generics to use public classes.


There's probably a way to make the guava version to be centrally defined in the settings.gradle. But it doesn't need to match the version we use elsewhere and we'll just be deleting it in the future. So it seems best to KISS and just have the version inline.

CC @njhill

This provides us a path forward with grpc#7211 (hiding
AbstractManagedChannelImplBuilder and AbstractServerImplBuilder) while
providing users a migration path to manage the ABI breakage (grpc#7552). We
do a .class hack so that recompiling avoids the internal class reference
yet the old methods are still available.

Leaving the classes as-is causes javac to compile two versions of each
method, one returning the public class (e.g. ServerBuilder) and one
returning the internal class (e.g., AbstractServerImplBuilder). However,
we rewrite the signature that is used at compile time so that new
compilations will not reference internal-returning methods.

This is intended to be temporary, just to give a migration path. Once we
have given users some time to recompile we will remove this rewriting
and change the generics to use public classes.
@ejona86 ejona86 requested a review from sergiitk January 22, 2021 22:32
@njhill
Copy link
Contributor

njhill commented Jan 23, 2021

nice! My vote would be to leave in until 2.x :)

core/build.gradle Outdated Show resolved Hide resolved
core/build.gradle Show resolved Hide resolved
@ejona86 ejona86 merged commit dbd903c into grpc:master Jan 26, 2021
@ejona86 ejona86 deleted the magic-magic-methods branch January 26, 2021 01:29
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 3, 2021
@grpc grpc unlocked this conversation Oct 3, 2023
@grpc grpc locked and limited conversation to collaborators Oct 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants