Closed vRallev closed 2 months ago
Interestingly enough the javadoc for Scope says they should not have attributes, but I verified that dagger does support this.
Many many years ago (around 2017/18) in a conversation with a Dagger 2 maintainer he mentioned that they have to support it now, because many folks rely on it, but it's not part of the standard. They "accidentally" supported it.
For each scope we need to define a new scope annotation, e.g.
Rather, I'd like to define a single annotation and use different arguments:
Then I only need to define new class references and can reuse the same scope:
The challenge is that more argument types such as ints, strings and enums must be supported for this.
Note that scope annotations using this mechanism today compile fine, but
@SingleIn(AppScope::class)
would be treated the same as@SingleIn(LoggedInScope::class)
. The argument is ignored for comparisons.The same should be supported for qualifiers #253.