Skip to content

Support @BindValue in Kotlin companion objects. - #5232

Open
copybara-service[bot] wants to merge 1 commit into
masterfrom
test_952218422
Open

Support @BindValue in Kotlin companion objects.#5232
copybara-service[bot] wants to merge 1 commit into
masterfrom
test_952218422

Conversation

@copybara-service

Copy link
Copy Markdown

Support @bindvalue in Kotlin companion objects.

This change updates the Hilt to support @bindvalue within companion objects in Kotlin to match the behavior in Java where we allow @bindvalue on static fields.

Technically, we already support this in KAPT when @JvmField is used, since the Java stub will treat that as a static field in the test class. However, this CL allows companion object properties without @JvmField.

This CL also fixes a bug where we didn't properly handle properties in companion objects when processing with KSP both with and without @JvmField (b/493642906).

RELNOTES=N/A

@copybara-service
copybara-service Bot force-pushed the test_952218422 branch 2 times, most recently from 87ce9d8 to 0467243 Compare July 28, 2026 19:07
This change updates the Hilt to support @bindvalue within companion objects in Kotlin to match the behavior in Java where we allow @bindvalue on static fields.

Technically, we already support this in KAPT when `@JvmField` is used, since the Java stub will treat that as a static field in the test class. However, this CL allows companion object properties without `@JvmField`.

This CL also fixes a bug where we didn't properly handle properties in companion objects when processing with KSP both with and without `@JvmField` (b/493642906).

RELNOTES=N/A
PiperOrigin-RevId: 952218422
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