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

public record CloseSteps(List<ISymbol> closed, Optional<MethodSymbol> parentClose) extends Record
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) and parentClose() (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 - marked OWNED_CAPTURE in PRE_IR_CHECKS, IsOwnedCapture; captures are constructor arguments, set before any initialiser runs), then its OWN getProperties() in declaration order, keeping those whose type is a managed closeable (CloseableResourceToBeChecked.isManagedCloseableType(ISymbol), so never a bare T and 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.
  • 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 is Closeable'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 for default 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 Details

    • CloseSteps

      public CloseSteps(List<ISymbol> closed, Optional<MethodSymbol> parentClose)
      Creates an instance of a CloseSteps record class.
      Parameters:
      closed - the value for the closed record component
      parentClose - the value for the parentClose record component
  • Method Details

    • isEmpty

      public boolean isEmpty()
      Nothing to close and no parent close: nothing is generated.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • closed

      public List<ISymbol> closed()
      Returns the value of the closed record component.
      Returns:
      the value of the closed record component
    • parentClose

      public Optional<MethodSymbol> parentClose()
      Returns the value of the parentClose record component.
      Returns:
      the value of the parentClose record component