@Documented
@Incubating
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface Associative
Declares that a two-argument combining method is associative:
combine(a, combine(b, c)) produces the same result as
combine(combine(a, b), c) for all inputs.
Associativity is the contract that makes a combiner safe to use with
order-independent reductions such as the parallel Collection
methods (sumParallel, injectParallel). Tooling such as
groovy.typecheckers.CombinerChecker consumes this declaration to
verify, at compile time, that a combiner passed to a parallel reduction
carries the contract.
This annotation asserts the law; it does not prove it. The assertion is intended to be backed by tests (for example auto-derived property-based tests). See also Reducer, which additionally declares an identity element.