Record Class CloseSteps
java.lang.Object
java.lang.Record
org.ek9lang.compiler.support.closeables.CloseSteps
- Record Components:
closed- the fields closed, in ACQUISITION order (closed in reverse: last made, first closed)parentClose- the super class's close, called non-virtually after them
THE decision of what a type's
operator close is responsible for - use it, never re-derive it. "If you
hold it, you close it" (Steve, 2026-10-06, D8): every check and every generator that asks "which of this type's
fields must its close close?", "which parent close does it chain to?" or "does this type declare its own close?"
asks the classes of this package, so the holder-must-close rule (E81067), the vacuous-default rule (E81070), the
phase-5 call graph and the generated close chain in phase 7 cannot disagree.
IsCloseOperator- the method is a type's close operator.CloseStepsOf- THE chain, this record:closed()(what its close closes, in ACQUISITION order - the generated code closes them last first) andparentClose()(the one parent close it then calls, non-virtually).ClosedProperties- the fields its close closes, in acquisition order: first the captures a dynamic class OWNS (OwnedCaptures: a fresh captured expression is a transfer, R-E - markedOWNED_CAPTUREin PRE_IR_CHECKS,IsOwnedCapture; captures are constructor arguments, set before any initialiser runs), then its OWNgetProperties()in declaration order, keeping those whose type is a managed closeable (CloseableResourceToBeChecked.isManagedCloseableType(ISymbol), so never a bareTand never a standard stream), minus the exclusions (R-G), stated once there:- an injected property (
store as Store!) - the application's registry owns it; - the delegate of a
by-delegation proxy close - the proxy forwards close to it, so it is closed already (a class that writes its own close gets no proxy and owns the delegate like any property); - a capture that is not fresh (named,
(owner: this)) - a borrow: its owner is the scope that made the dynamic class.
- an injected property (
ParentClose- the super CLASS's close, when it has a non-abstract one (its own or one it inherits from a class). A trait's close is never chained (D8: a trait's close is abstract, E81066), so neither isCloseable's.DeclaredClose- the close this type DECLARES ITSELF: in its own scope, not abstract and not a delegation proxy. An inherited close never counts - it cannot see a field the sub-type adds (critic c15).IsDefaultedClose- the type asked fordefault operator close.ChainedCloses- the closes the chain calls, for the call graph;IsCloseableType- a type (not a field) whose close the compiler must see run.
Inherited properties are the super's to close, through the super's own close - which is why the chain ends in
parentClose(). A body the developer writes runs FIRST, with everything still open; the chain then
runs on every path (it is the body's finally). Nothing is generated when isEmpty().
-
Constructor Summary
ConstructorsConstructorDescriptionCloseSteps(List<ISymbol> closed, Optional<MethodSymbol> parentClose) Creates an instance of aCloseStepsrecord class. -
Method Summary
Modifier and TypeMethodDescriptionclosed()Returns the value of theclosedrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanisEmpty()Nothing to close and no parent close: nothing is generated.Returns the value of theparentCloserecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
CloseSteps
Creates an instance of aCloseStepsrecord class.- Parameters:
closed- the value for theclosedrecord componentparentClose- the value for theparentCloserecord component
-
-
Method Details
-
isEmpty
public boolean isEmpty()Nothing to close and no parent close: nothing is generated. -
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
closed
-
parentClose
Returns the value of theparentCloserecord component.- Returns:
- the value of the
parentCloserecord component
-