Why does the following code compile:
final String name = "works"; @Provides @Named(name) String provideAboutTitle() { return "ABC"; }
But the following code does not work (at least with the Eclipse compiler):
final String name = UUID.randomUUID().toString(); @Provides @Named(name) String provideAboutTitle() { return "ABC"; }
The Eclipse compiler returns the following error:
The value for annotation attribute Named.value must be a constant expression
source share