Class SuperConstructorAccessOrError
java.lang.Object
org.ek9lang.compiler.common.RuleSupport
org.ek9lang.compiler.common.TypedSymbolAccess
org.ek9lang.compiler.phase3.SuperConstructorAccessOrError
- All Implemented Interfaces:
Consumer<IAggregateSymbol>
final class SuperConstructorAccessOrError
extends TypedSymbolAccess
implements Consumer<IAggregateSymbol>
Every EK9 constructor chains to a super constructor: an explicit
super(...), an explicit
this(...) delegation, or - when neither is written - a hidden IMPLICIT super() to the
super's no-arg constructor. Explicit super(...) calls are policed where they are resolved
(ThisOrSuperCallOrError - NOT_ACCESSIBLE). This check closes the IMPLICIT hole when the
super's no-arg constructor is private (not accessible to a sub-type):
- The sub-type defines NO constructor at all - the synthetic public no-arg default was therefore
suppressed (see
AggregateManipulator), so the type is unconstructable. EmitCONSTRUCTOR_REQUIRED_FOR_PRIVATE_SUPER(E07177): the developer must write a constructor that calls an accessiblesuper(...). - The sub-type defines a constructor that relies on the hidden implicit
super()(adefault Sub(), or a body with no explicitsuper(...)/this(...)) - that developer constructor cannot reach the private super. EmitCONSTRUCTOR_USES_PRIVATE_SUPER(E07176).
This is the mechanism that makes 'default private X()' on a base with an uninitialised property
(E07175) actually enforce initialisation in sub-types. Each aggregate is validated purely on its own
constructors + its direct super - no inherited-property inspection.
-
Field Summary
Fields inherited from class RuleSupport
errorListener, symbolsAndScopes -
Constructor Summary
ConstructorsConstructorDescriptionSuperConstructorAccessOrError(SymbolsAndScopes symbolsAndScopes, ErrorListener errorListener) -
Method Summary
Methods inherited from class TypedSymbolAccess
getRecordedAndTypedSymbol, isProcessingScopePure, recordATypedSymbol
-
Constructor Details
-
SuperConstructorAccessOrError
SuperConstructorAccessOrError(SymbolsAndScopes symbolsAndScopes, ErrorListener errorListener)
-
-
Method Details
-
accept
- Specified by:
acceptin interfaceConsumer<IAggregateSymbol>
-