Annotation Interface Pure


Pure is a method annotation that means both SideEffectFree and Deterministic. The more important of these, when performing pluggable type-checking, is usually SideEffectFree.

For pluggable type-checking, SideEffectFree lets flow-sensitive type refinement keep facts about the heap across a call to the method, and Deterministic lets it assume that a later invocation of the method, with the same arguments and in the same environment, returns the same value as an earlier one. Because a deterministic method that is not side-effect-free can change the environment itself, both are needed for a fact learned about the result of one invocation to hold for the result of the next; see Deterministic for an example. The Checker Framework therefore keeps a refinement of the result of a method call only if the method is @Pure (or both @Deterministic and @SideEffectFree).

For a discussion of the meaning of Pure on a constructor, see the documentation of Deterministic.

This annotation is inherited by subtypes, just as if it were meta-annotated with @InheritedAnnotation.

See the Checker Framework Manual:
Side effects, determinism, purity, and flow-sensitive analysis
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    The type of purity.