Simple scope annotation:
@Scope
@Retention(RUNTIME)
public @interface SimpleScope {
}
Simple component:
@SimpleScope
@Component
public interface SimpleComponent {
}
compiler error:
error: Scoping annotations are only allowed on concrete types and
@Provides methods
The compiler error is actually coming from Dagger 1 annotation processor. Specifically here: Dagger 1 ValidationProcessor. If the annotation processor sees that any interface is annotated with a javax.inject.Scope annotation, it reports an error. Even if the interface or scope are not used by Dagger 1 in any way.
We are currently migrating from Dagger 1 to Dagger 2, and hence both annotation processors are running on Gradle modules that use both Dagger 1 and Dagger 2.
One solution is to fully migrate each Gradle module, so that both annotation processors don't have to run on the same code. However, this is not always easy.
Our solution was to fork Dagger 1 and modify the ValidationProcessor to not fail if the interface is a Dagger 2 component.