Skip to content

Introduce parameterless @Binds methods to explicitly bind @Inject constructors.#5157

Merged
copybara-service[bot] merged 1 commit intomasterfrom
test_886813781
Apr 21, 2026
Merged

Introduce parameterless @Binds methods to explicitly bind @Inject constructors.#5157
copybara-service[bot] merged 1 commit intomasterfrom
test_886813781

Conversation

@copybara-service
Copy link
Copy Markdown

Introduce parameterless @BINDS methods to explicitly bind @Inject constructors.

This change allows users to use a zero-parameter @BINDS method to explicitly bind the @Inject constructor of the return type. Annotations on the @BINDS method (like pinmultibindings) are applied to the resulting injection binding. One-parameter @BINDS methods continue to function as delegate bindings. Validation is updated to ensure parameterless @BINDS methods return a type with exactly one @Inject constructor. Scopes and qualifiers would not be available in either the implicit @Inject nor the explicit parameterless @BINDS to avoid confusions.

RELNOTES=Introduced parameterless @BINDS methods to explicitly bind @Inject constructors

…structors.

This change allows users to use a zero-parameter @BINDS method to explicitly bind the @Inject constructor of the return type. Annotations on the @BINDS method (like pinmultibindings) are applied to the resulting injection binding. One-parameter @BINDS methods continue to function as delegate bindings. Validation is updated to ensure parameterless @BINDS methods return a type with exactly one @Inject constructor. Scopes and qualifiers would not be available in either the implicit @Inject nor the explicit parameterless @BINDS to avoid confusions.

RELNOTES=Introduced parameterless @BINDS methods to explicitly bind @Inject constructors
PiperOrigin-RevId: 902919023
@copybara-service copybara-service Bot merged commit 4c81e94 into master Apr 21, 2026
@copybara-service copybara-service Bot deleted the test_886813781 branch April 21, 2026 01:21
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