Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dagger 2 unchecked warnings

In a project where I'm currently working on I've experienced some unchecked warnings related to Dagger 2.

To exclude project related factors I've tried compiling the Dagger 2 examples provided on GitHub and they are also causing these unchecked warnings. See below.

/MY_DIRECTORY/../DaggerApplicationComponent.java:28: warning: [unchecked] unchecked conversion

this.demoApplicationMembersInjector = DemoApplication_MembersInjector.create((MembersInjector) MembersInjectors.noOp(), provideLocationManagerProvider);

required: MembersInjector<Application>

found: MembersInjector

Apparently the create method requires an MembersInjector<Application> but Dagger 2 casts the passed object to an MembersInjector by default.

I would like fix these issues so that the logs remain clean and the buildserver compiles the project again.

Some settings I'm using:

  • Compile against Android version 23
  • Dagger version 2.0.1
  • Dagger compiler version 2.0.1
  • Javax Annotation jsr250-api version 1.0
like image 405
Ben Groot Avatar asked Oct 09 '15 10:10

Ben Groot


1 Answers

I tried to upgrade Dagger to latest version 2.19, and the issue has gone.

See more: https://github.com/google/dagger/releases

like image 91
GianhTran Avatar answered Oct 30 '22 18:10

GianhTran