Package groovy.contracts

# Annotation Type Invariant

@Retention(RUNTIME) @Target(TYPE) @Incubating @ClassInvariant @AnnotationProcessorImplementation(ClassInvariantAnnotationProcessor.class) public @interface Invariant

Represents a class-invariant.

The class-invariant defines assertions holding during the entire objects life-time.

Class-invariants are verified at runtime at the following pointcuts:

- after a constructor call
- before a method call
- after a method call

Whenever a class has a parent which itself specifies a class-invariant, that class-invariant expression is combined with the actual class's invariant (by using a logical AND).

- ## Required Element Summary

  Required Elements
  Modifier and Type
  Required Element
  Description
  `Class`
  `value`

- ## Element Details

  - ### value

    Class value