Skip to content

Suggestion: Improve error message when Provider/Lazy are accidentally used in multibindings #3677

Closed
@ZacSweers

Description

@ZacSweers

This snippet may be accidentally written to declare a multibinding

@Module
interface Example {
  @Multibinding
  Map<String, Provider<String>> someBindings();
}

The error is that it's using a Provider in the declaration when it should just be Map<String, String>. However, the error message is a little confusing as it seems to imply that it's not a Map at all.

error: @Multibinds methods must return Map<K, V> or Set<T>

I think it would be easier for folks to debug if this message could be more explicit, such as mentioning that dagger intrinsic types like Provider and Lazy are not supported and mentioning if it sees one in the signature.

Activity

added 2 commits that reference this issue on Jan 9, 2023
c7504fb
3528314
ZacSweers

ZacSweers commented on Jan 9, 2023

@ZacSweers
Author

Thanks!

added a commit that references this issue on Aug 1, 2024
f5ad2b2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @ZacSweers@bcorso

      Issue actions

        Suggestion: Improve error message when Provider/Lazy are accidentally used in multibindings · Issue #3677 · google/dagger