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

[Refactor]: Move ProvisionMethods#create()/InjectionSiteMethods#create() into the generator that uses it. #4516

Merged
merged 1 commit into from
Nov 25, 2024

Conversation

copybara-service[bot]
Copy link

[Refactor]: Move ProvisionMethods#create()/InjectionSiteMethods#create() into the generator that uses it.

Note: this CL shouldn't cause any changes to the generated code.

FactoryGenerator is the only class that uses ProvisionMethods#create(), and MembersInjectorGenerator is the only class that uses InjectionSiteMethods#create(). Thus, I'm moving these methods into these classes for better encapsulation. This will also make the XPoet migration easier since I plan to migrate FactoryGenerator and MembersInjectorGenerator separately.

Note that these methods were sharing some logic that now needs to be duplicated, but IMO this creates more readable code since we're no longer entangling the two use cases. For example, now that ProvisionMethods and InjectionSiteMethods define their own versions of methodProxy() method, we no longer need the multiple enums (i.e. InstanceCastPolicy and CheckNotNullPolicy) as input to these methods.

RELNOTES=N/A

…eate()` into the generator that uses it.

Note: this CL shouldn't cause any changes to the generated code.

`FactoryGenerator` is the only class that uses `ProvisionMethods#create()`, and `MembersInjectorGenerator` is the only class that uses `InjectionSiteMethods#create()`. Thus, I'm moving these methods into these classes for better encapsulation. This will also make the XPoet migration easier since I plan to migrate `FactoryGenerator` and `MembersInjectorGenerator` separately.

Note that these methods were sharing some logic that now needs to be duplicated, but IMO this creates more readable code since we're no longer entangling the two use cases. For example, now that `ProvisionMethods` and `InjectionSiteMethods` define their own versions of `methodProxy()` method, we no longer need the multiple enums (i.e. `InstanceCastPolicy` and `CheckNotNullPolicy`) as input to these methods.

RELNOTES=N/A
PiperOrigin-RevId: 700035303
@copybara-service copybara-service bot merged commit fdbc63e into master Nov 25, 2024
1 check passed
@copybara-service copybara-service bot deleted the test_686601333 branch November 25, 2024 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant