Change theme
Help
Press space for more information.
Show links for this issue (Shortcut: i, l)
Copy issue ID
Previous Issue (Shortcut: k)
Next Issue (Shortcut: j)
Sign in to use full features.
Vote: I am impacted
Notification menu
Refresh (Shortcut: Shift+r)
Go home (Shortcut: u)
Pending code changes (auto-populated)
View issue level access limits(Press Alt + Right arrow for more information)
Unintended behavior
View staffing
Description
Using
KClass
orClass<>
for type info is preferred, but not always practical, for some use cases you need the classname in a String.E.g. see androidx.navigation.fragment.FragmentNavigator.Destination.setClassName
This issue requests the addition of an annotation (e.g.
@ClassName
) that specifies that aString
should contain the name of aClass
.Any string annotated with
@ClassName
should success with passed intoClass.forName
.This is similar to
@IntRange
,@IdRes
, etc. which give additional constraints on a type.This could be used for lint checks, refactoring and R8 optimizations.
This annotation could have additional info such as must extend a certain type.
FragmentNavigator.Destination.setClassName
could be annotated like this: