I am using Dagger 2.24.
I have a subcomponent:
@Subcomponent(modules = MyModule.class)
public interface MySubComponent {
void inject(MyApplication app);
}
Since my subcomponent is only used by classes of a specific module, so, I try to declare my subcomponent in that module class by:
//Compiler error: An annotation argument must be a compile-time constant
@Module(subcomponents = MySubComponent.class)
abstract class MyModule {
...
}
When I do above thing, compiler complains "An annotation argument must be a compile-time constant". Why?