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

Generics typealias codegen error #1031

Open
bubenheimer opened this issue Jul 14, 2024 · 0 comments
Open

Generics typealias codegen error #1031

bubenheimer opened this issue Jul 14, 2024 · 0 comments

Comments

@bubenheimer
Copy link

bubenheimer commented Jul 14, 2024

The below kind of typealias usage with a generic generates invalid code in 2.5.0-beta09; not sure if it will build in prior versions:

typealias Alias<T> = Foo<Bar<T>, T> // in a separate file, not sure it matters

class SomeActivity {
    @Inject
    internal lateinit var alias: Alias<Boolean>
}

This generates code like below; note the raw Bar<T>:

public class SomeActivity_MembersInjector(
  private val alias: Provider<@JvmSuppressWildcards Foo<Bar<T>, Boolean>>,
) : MembersInjector<SomeActivity> {
//...
}

Anvil only seems to expand generics at the top level here, not a second-level usage. A typealias like this works fine:

typealias Alias<T> = Foo<Int, T>
@bubenheimer bubenheimer changed the title Generics typealias build error Generics typealias codegen error Jul 14, 2024
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

No branches or pull requests

1 participant