Skip to content

Support @BindValue in Kotlin companion objects. - #5232

Merged
copybara-service[bot] merged 1 commit into
masterfrom
test_952218422
Jul 29, 2026
Merged

Support @BindValue in Kotlin companion objects.#5232
copybara-service[bot] merged 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 3 times, most recently from 0467243 to 6caf840 Compare July 29, 2026 02:43
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: 955614589
@copybara-service
copybara-service Bot merged commit 1259481 into master Jul 29, 2026
@copybara-service
copybara-service Bot deleted the test_952218422 branch July 29, 2026 03:04
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