Annotation Interface AccessedViaReflection


@Documented @Target({METHOD,CONSTRUCTOR,FIELD,TYPE}) @Retention(SOURCE) @Beta public @interface AccessedViaReflection
When placed on a method or constructor, indicates that the member is called via reflection, and is this used and should not be considered for removal. When placed on a field, it indicates that the field is accessed via reflection to get or set it. When placed on a type (class, interface, annotation, enum, or record), indicates that the type may be loaded via reflection using Class.forName(String) or a similar mechanism. Placing on a type can also mean that the type and/or some or all of its members may be accessed reflectively.

When this annotation is present, you might also consider adding @SuppressWarnings("unused"). This is necessary since SuppressWarnings is not Inherited so we cannot include it in this annotation.

  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Optional description of when, where, why, how this annotated element is accessed via reflection.
  • Element Details

    • value

      String value
      Optional description of when, where, why, how this annotated element is accessed via reflection.

      While this value is optional, it is recommended, since it can be difficult to track down when and where reflective code invokes methods, constructors, etc.

      Default:
      ""