Skip to content
This repository has been archived by the owner on Aug 26, 2021. It is now read-only.

Bad error message for missing Set provider #432

Open
norrisboyd opened this issue Aug 19, 2014 · 0 comments
Open

Bad error message for missing Set provider #432

norrisboyd opened this issue Aug 19, 2014 · 0 comments

Comments

@norrisboyd
Copy link

Compiling the following class:

import dagger.ObjectGraph;
import dagger.Module;
import dagger.Provides;
import java.util.Set;

public class BadErrorMessage {
  @Module
  public static class MyModule {
    @Provides Long provideSum(Set<Integer> integers) {
      long sum = 0; 
      for (int i : integers) {
        sum += i;
      }
      return sum;
    } 
  } 

  public static void main(String[] args) {
    ObjectGraph graph = ObjectGraph.create(MyModule.class);
    System.out.println("sum = " + graph.get(Long.class).valueOf());
  }
}

Results in the error message:

BadErrorMessage.java:8: error: java.util.Set<java.lang.Integer> is a generic class or an array and can only be bound with concrete type parameter(s) in a @Provides method. required by provideSum(java.util.Set<java.lang.Integer>) for BadErrorMessage.MyModule
  public static class MyModule {
                ^
1 error

However,

Set<Integer>

is not a generic class or array.

tbroyer pushed a commit to tbroyer/dagger that referenced this issue Sep 3, 2016
Rename ExceptionSuperclass.NONE to NO_EXCEPTIONS for clarity.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant