dagger-reflect icon indicating copy to clipboard operation
dagger-reflect copied to clipboard

Add support for new Dagger Kotlin features

Open JakeWharton opened this issue 5 years ago • 4 comments

  • [ ] Not requiring module instance for provision methods in an object.
  • [ ] Automatically traversing into module companion objects to look for provision methods (built on above support)

JakeWharton avatar Jan 30 '20 18:01 JakeWharton

I just run recently to the point one - added methods in the component builder for object modules.

emartynov avatar Feb 04 '20 16:02 emartynov

Care to give some implementation hints where to start? I'd try and pick this one up.

realdadfish avatar Sep 09 '20 12:09 realdadfish

Both will be changes to ReflectiveModuleParser. The easiest way to get started is to get a failing test case in the integration tests that passes on the codegen backend. Then you can debug through as it's parsing the module to see how to read and handle these new Kotlin method shapes.

JakeWharton avatar Sep 10 '20 19:09 JakeWharton

In my experience of this, you can get the Kotlin code to work with dagger-reflect by adding @JvmStatic to the @Provides functions in the companion object. Whether this solves ALL aspects is still unclear since I never got to the stage where things actually run, but at least it appears to do the right thing when examine the results in the debugger.

catellie avatar Nov 05 '20 09:11 catellie