Dagger: Experimental error message feedback

Created on 13 Mar 2020  Â·  6Comments  Â·  Source: google/dagger

This is a tracking issue for feedback on the experimental error messages.

When using this option, the format and some content of error messages will be changed in order to improve readability. Pending feedback, this format will eventually become the default and replace current error messages.

To opt-in to the new format use -Adagger.experimentalDaggerErrorMessages=enabled after version 2.27.

Currently, this flag:

  • Shortens all class names to the simple class name. A legend is output at the bottom of the errors to map short names to fully qualified names.
  • Reports errors as a single error for each root component.
  • Adds color to error tags to visibly separate individual errors
  • Reduces some extraneous information from some messages.
P2 dagger feature request

Most helpful comment

@tomislavhofman it depends on your build system. For Gradle I used this

 javaCompileOptions {
     annotationProcessorOptions {
          arguments = [
               "dagger.experimentalDaggerErrorMessages" : "enabled"
          ]
     }
 }

in android -> defaultConfig section

or

kapt {
        arguments {
            arg("dagger.experimentalDaggerErrorMessages", "enabled")
        }
    }

in android section

All 6 comments

We're testing the new error messages.

[Dagger/MissingBinding] FeatureProvider cannot be provided without an @Provides-annotated method.
      FeatureProvider is provided at
          DevelopmentLoginScreenComponent.featureProvider() [DemoLegacyAppComponent → DemoLegacyLoggedInComponent → DemoLegacyMainActivityComponent]

  ======================
  Full classname legend:
  ======================
  DemoLegacyAppComponent:          com.squareup.development.shell.demo.legacy.DemoLegacyAppComponent
  DemoLegacyLoggedInComponent:     com.squareup.development.shell.demo.legacy.DemoLegacyLoggedInComponent
  DemoLegacyMainActivityComponent: com.squareup.development.shell.demo.legacy.DemoLegacyMainActivityComponent
  DevelopmentLoginScreenComponent: com.squareup.development.shell.login.screen.DevelopmentLoginScreenComponent
  FeatureProvider:                 com.squareup.development.shell.login.screen.FeatureProvider

While correct the wording is very confusing. It says: FeatureProvider cannot be provided without... and FeatureProvider is provided at on the next line. Maybe change the 2nd line to FeatureProvider is required for / at.

Thanks for the feedback. I had noticed that before but forgot to submit that change. Funnily enough that wording is actually in the existing error messages, but I think it gets lost in the noise. I will likely change that wording to "requested at" or "injected at" which hopefully will make more sense.

I was aware that the confusing wording already exists. But I thought now is a good time to report it since it's more prominent. Both "requested at" and "injected at" make sense. I'd prefer the latter, because usually you "@Inject" something. For components providing dependencies "requested at" would make more sense, but that's not the norm.

Excuse my ignorance, where do we put -Adagger.experimentalDaggerErrorMessages=enabled

@tomislavhofman it depends on your build system. For Gradle I used this

 javaCompileOptions {
     annotationProcessorOptions {
          arguments = [
               "dagger.experimentalDaggerErrorMessages" : "enabled"
          ]
     }
 }

@tomislavhofman it depends on your build system. For Gradle I used this

 javaCompileOptions {
     annotationProcessorOptions {
          arguments = [
               "dagger.experimentalDaggerErrorMessages" : "enabled"
          ]
     }
 }

in android -> defaultConfig section

or

kapt {
        arguments {
            arg("dagger.experimentalDaggerErrorMessages", "enabled")
        }
    }

in android section

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SteinerOk picture SteinerOk  Â·  3Comments

blackberry2016 picture blackberry2016  Â·  3Comments

feinstein picture feinstein  Â·  3Comments

makaroffandrey picture makaroffandrey  Â·  3Comments

pyricau picture pyricau  Â·  4Comments