question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

@JvmSuppressWildcards is placed in the wrong position in generated membersInjector

See original GitHub issue

Given I have a class

class Box<T: CharSequence> @Inject constructor(val element: T)

and a second class where the first is injected:

class Fragment {
    @Inject lateinit var box: Box<String>

then I see a members injector generated as:

class Fragment_MembersInjector(
  private val param0: Provider<@JvmSuppressWildcards Box<String>>
) : MembersInjector<Fragment> {

but I think the position of @JvmSuppressWildcards is incorrect and should be instead

class Fragment_MembersInjector(
  private val param0: Provider<Box<@JvmSuppressWildcards String>>
) : MembersInjector<Fragment> {

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
quiro91commented, Sep 23, 2020

I’m gonna need to double check this, I was getting an error from KAPT in a downstream module that used a module where Anvil was generating factories. I’ll try it out as soon as I can

0reactions
quiro91commented, Sep 25, 2020

I can confirm this compiles fine. Closing the issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

XX_MembersInjector.class is repeatedly generated in ... - GitHub
When dagger processes the other modules, and doesn't find that MembersInjector , it generates one, in each module. The duplicate generated ...
Read more >
JvmSuppressWildcards - Kotlin Programming Language
Instructs compiler to generate or omit wildcards for type arguments corresponding to parameters with declaration-site variance, for example such as Collection< ...
Read more >
Getting rid of Dagger 2 warning "Generating a MembersInjector"
in Dagger 2 when injecting dependencies into a class which extends from an abstract base class which also contains dependencies, Dagger shows a ......
Read more >
JvmSuppressWildcards: The secret sauce to your sandwich ...
If generic types are exposed in Kotlin API, consider @JvmSuppressWildcards so that your Java consumer can compile successfully.
Read more >
The anvil from square - GithubHelp
@JvmSuppressWildcards is placed in the wrong position in generated membersInjector. Given I have a class. class Box<T: CharSequence> @Inject constructor(val ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found