Class SanitizedModifierOrError
java.lang.Object
org.ek9lang.compiler.common.RuleSupport
org.ek9lang.compiler.common.TypedSymbolAccess
org.ek9lang.compiler.phase3.SanitizedModifierOrError
- All Implemented Interfaces:
Consumer<SanitizedCheckData>
final class SanitizedModifierOrError
extends TypedSymbolAccess
implements Consumer<SanitizedCheckData>
Checks that an overriding method or function keeps every 'sanitized' parameter of the declaration it overrides
(E07940). 'sanitized' is part of the contract, like 'pure': a caller holding the super type passes untrusted input
expecting it to be cleaned, so an override may never DROP it.
An override MAY ADD 'sanitized' - a subtype may weaken a precondition (Liskov). The receiving callable cleans its own 'sanitized' parameters, so the stricter override cleans its input on every route, including dispatch through the super. Checking only the drop direction also means a compiler-synthesised super function, which never carries 'sanitized', can never raise this error.
Text locales use the same check: the text base carries 'sanitized' if ANY locale declares it (see TextFactory), so a locale that disagrees is always one that drops it. So do dispatcher handlers against their entry point: the dispatch table reaches a handler before the entry point's prologue runs.
-
Field Summary
Fields inherited from class RuleSupport
errorListener, symbolsAndScopes -
Constructor Summary
ConstructorsConstructorDescriptionSanitizedModifierOrError(SymbolsAndScopes symbolsAndScopes, ErrorListener errorListener) -
Method Summary
Methods inherited from class TypedSymbolAccess
emitTypeNotResolvedError, getRecordedAndTypedSymbol, isProcessingScopePure, recordATypedSymbol
-
Constructor Details
-
SanitizedModifierOrError
SanitizedModifierOrError(SymbolsAndScopes symbolsAndScopes, ErrorListener errorListener)
-
-
Method Details
-
accept
- Specified by:
acceptin interfaceConsumer<SanitizedCheckData>
-