Skip to content

Conversation

@wbonnefond
Copy link
Contributor

After updating our Android project from Kotlin 2.1.20 to 2.2.0 we started seeing compilation errors due to missing imports in some bindings generated by auto-dagger.

Screenshot 2025-09-30 at 10 32 09 AM

After debugging we found that .toAnnotationSpecFixed() was not pulling the fully qualified name. Switching this to Kotlin Poet's .toAnnotationSpec() allowed it to get the fully qualified name.

Before:
Screenshot 2025-09-29 at 5 47 35 PM

After:
Screenshot 2025-09-30 at 10 17 47 AM

@wbonnefond wbonnefond requested a review from ansman as a code owner September 30, 2025 14:36
Copy link
Owner

@ansman ansman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wbonnefond thanks for this! Looks great, but do you mind adding test that validates this?

@wbonnefond
Copy link
Contributor Author

wbonnefond commented Oct 1, 2025

@ansman I added a test for the specific case that caused issues for us. I also updated existing tests which now are generated with value parameter name which I don't think should cause any issues since it's only on the generated code

The only change that I am concerned about is the need to change from @get:Named to @Named otherwise I saw the following errors:

  e: file:///var/folders/7t/1rj0m6gd72lgvl1fzt3brn0m0000gp/T/junit-5518362231190188529/auto_initialize/binding.qualified/ksp/ksp/sources/kotlin/tests/auto_initialize/binding/qualified/AutoInitializeBindingModule.kt:23:42 '@get:' annotations can only be applied to property declarations.
  e: file:///var/folders/7t/1rj0m6gd72lgvl1fzt3brn0m0000gp/T/junit-5518362231190188529/auto_initialize/binding.qualified/ksp/ksp/sources/kotlin/tests/auto_initialize/binding/qualified/AutoInitializeBindingModule.kt:23:42 This annotation is not applicable to target 'value parameter' and use-site target '@get'. Applicable targets: class, annotation class, property, field, local variable, value parameter, constructor, function, getter, setter, backing field, expression

@ansman ansman enabled auto-merge (squash) October 2, 2025 00:37
@ansman ansman disabled auto-merge October 2, 2025 00:40
@ansman ansman enabled auto-merge (squash) October 2, 2025 00:59
@ansman ansman merged commit 171af2d into ansman:main Oct 2, 2025
2 checks passed
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.

2 participants