Annotation Type NonFinalForTesting


  • @Documented
    @Retention(SOURCE)
    @Target({FIELD,METHOD,TYPE})
    public @interface NonFinalForTesting
    Annotation that discourages future maintainers from marking a field final.

    This annotation serves purely as documention to indicate that even though a private field may appear safe to change to final, it will actually be reflectively modified by a unit test, and therefore should not be final.

    When this annotation is used on methods, it means that you should not override the method and it's only non-final so it can be mocked.