AssistedInject crashes without message when using with class with generic parameter
See original GitHub issueAssistedInject fails without explanation when I try to use it with various classes that use generics. The simplest case that fails for me with Dagger 2.24, AssistedInject 0.5.0 and Kotlin 1.3.50:
class AClass<A> @AssistedInject constructor(
@Assisted dependency: String
) {
@AssistedInject.Factory
interface Factory {
fun create(dependency: String): AClass<String>
}
}
The only error that appears is the following:
error: cannot find symbol
@dagger.Module(includes = {AssistedInject_PresentationModule.class})
^
symbol: class AssistedInject_PresentationModule
FAILURE: Build failed with an exception.
This is just a simplified version of what I was trying to do initially, which also fails with no meaningful message:
abstract class Base<T>
class Wrapper<A, B>
class AClass<A, B> @AssistedInject constructor(
@Assisted dependency: (A) -> B
) : Base<Wrapper<A, B>>() {
@AssistedInject.Factory
interface Factory {
fun <A, B> create(dependency: (A) -> B): AClass<A, B>
}
}
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
AssistedInject crashes without message when using with class ...
AssistedInject fails without explanation when I try to use it with various classes that use generics. The simplest case that fails for me ......
Read more >Problem with generic return type in guice assisted inject factory
There are two issues with your code above. First, RealPayment implements Payment<SwissFrancs> , but PaymentFactory.create returns Payment<Currency> .
Read more >Connecting The Dots: Dagger • ViewModel • Saved State
The generic parameter T serves as way to inform AssistedInject about what type of ViewModel it should generate.
Read more >Use Hilt with other Jetpack libraries - Android Developers
Inject ViewModel objects with Hilt Provide a ViewModel by annotating it with @HiltViewModel and using the @Inject annotation in the ViewModel ...
Read more >How to Set up Dagger With ViewModel & Saved State Module
I'm not going to get deep into Dagger, so if you don't know the basics ... dynamic parameters? Crash! ...Or an improperly initialized...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Narrowed in on the cause. The fix isn’t so trivial though, but I’m working on it.
Seems like this is closed by #125, but fyi the test you added in #123 wasn’t un-ignored and still fails. Not sure if it’s the test that’s incorrect or this was closed by mistake