anvil
anvil copied to clipboard
Generics typealias codegen error
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>
Behavior unchanged in 2.5.0 release