Class MutexLockArgumentFreshnessOrError
java.lang.Object
org.ek9lang.compiler.common.RuleSupport
org.ek9lang.compiler.common.TypedSymbolAccess
org.ek9lang.compiler.phase3.MutexLockArgumentFreshnessOrError
- All Implemented Interfaces:
BiConsumer<CallSymbol, EK9Parser.ParamExpressionContext>
final class MutexLockArgumentFreshnessOrError
extends TypedSymbolAccess
implements BiConsumer<CallSymbol, EK9Parser.ParamExpressionContext>
Inbound-encapsulation check on
MutexLock(...) constructor calls.
The argument passed to a MutexLock(...) constructor becomes the lock's protected
payload. If the caller retains a reference to that argument, the caller can mutate the
payload outside the lock — bypassing enter() entirely. To close this loophole,
the argument must be a fresh value:
- A literal:
MutexLock(0),MutexLock(""),MutexLock(true). - A constructor call:
MutexLock(List() of Item),MutexLock(MyClass()). - An explicit copy via constructor:
MutexLock(List(existing)).
Bare references to existing state (identifiers, field accesses, non-constructor call
results) are rejected — the user adds Type(existing) at the construction site
for an explicit copy.
Part of EK9's compile-time data-race detection (slice 1, model rule §2.6a).
Error E08257 MUTEX_LOCK_ARG_NOT_FRESH.
-
Field Summary
Fields inherited from class RuleSupport
errorListener, symbolsAndScopes -
Constructor Summary
ConstructorsConstructorDescriptionMutexLockArgumentFreshnessOrError(SymbolsAndScopes symbolsAndScopes, ErrorListener errorListener) -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(CallSymbol callSymbol, EK9Parser.ParamExpressionContext paramExpression) Methods inherited from class TypedSymbolAccess
getRecordedAndTypedSymbol, isProcessingScopePure, recordATypedSymbolMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface BiConsumer
andThen
-
Constructor Details
-
MutexLockArgumentFreshnessOrError
MutexLockArgumentFreshnessOrError(SymbolsAndScopes symbolsAndScopes, ErrorListener errorListener)
-
-
Method Details
-
accept
- Specified by:
acceptin interfaceBiConsumer<CallSymbol, EK9Parser.ParamExpressionContext>
-