ZacSweers/auto-service-ksp

Confusing error message

lexa-diky opened this issue · 0 comments

Improvement description

The following code, rightfully, produces an error:

Code:

interface MyService

@AutoService() // note, no interfaces specified
class MyServiceImpl : MyService

Error

No service interfaces provided for element!

This error is quite confusing from the developer's perspective line of thought is as follows:

  • Which element? Error points to line with class instead of annotation
  • But my class inherits the desired interface!
  • Sad wondering around the office

My company is actively migrating to Kotlin, had this thing in learning chats a couple of times already :)

Proposed solution

Add more clear message:

No service interfaces specified by @AutoService annotation!
You can provide them in annotation parameters: @AutoService(YourService::class)