Browse documentation

Reflection by name

A class that reflectively looks up another class or member by a literal string is excluded from the renaming that string would otherwise break.

What it covers

A caller using Class.forName-style reflection with a literal string argument is excluded from nativization, since nativizing the call itself has no equivalent at runtime. Separately, every LDC string constant and static final String value across the whole JAR is collected before any renaming happens, and a class whose name shows up in that set is excluded from renaming entirely, the caller-side exclusion alone doesn't protect the target class from being renamed out from under a string that still names its original path.

Scope

Matches on literal, statically visible strings only. A class name assembled at runtime, string concatenation, a value read from configuration, can't be seen by a static scan and isn't covered.