@Incubating
class CombinerChecker
extends TypeCheckingDSL
A compile-time checker that verifies the combiner passed to an
order-independent parallel reduction (sumParallel,
injectParallel) carries the associativity contract those methods
silently require — mirroring the design of PurityChecker.
Associativity is undecidable in general, so this checker is deliberately
conservative. It has two modes, selected via the extension option
mode:
// default (lenient): only flag high-confidence problems
@TypeChecked(extensions = 'groovy.typecheckers.CombinerChecker')
// strict: additionally require the combiner to be declared @Associative/@Reducer
@TypeChecked(extensions = "groovy.typecheckers.CombinerChecker(mode: 'strict')")
What it does, by combiner shape:
-, /, %, **) directly to the
two combiner parameters (e.g. { a, b -> a - b })
— flagged in any mode (high confidence).injectParallel seed that contradicts a @Reducer's
declared zero() (both statically constant) — flagged.{ a, b -> a + b }; the single error channel of a
type-checking extension makes false-positive aversion essential. | Constructor and description |
|---|
CombinerChecker() |
Copyright © 2003-2026 The Apache Software Foundation. All rights reserved.