@Documented @Retention(value=CLASS) @Target(value={METHOD,FIELD,CONSTRUCTOR,TYPE}) public @interface UsedViaReflection
@UsedViaReflection notes that an element is accessed through
reflection or tests. It warns library maintainers against removing or hiding
the member.
Retention and effect: Retained in the class file and ignored at runtime unless tooling looks for it.
@UsedViaReflection
public void setAccessible() { }
Typical sources include YAML deserialisation, JMH harnesses and Spring
tests. Annotate the member with @SuppressWarnings("unused") to silence
compiler and IDE warnings.
-keep class ** { @UsedViaReflection *; }
PackageLocalCopyright © 2026 Chronicle Software Ltd. All rights reserved.