Class DefaultCopyOfCloseableOrError

java.lang.Object
org.ek9lang.compiler.phase5.DefaultCopyOfCloseableOrError

final class DefaultCopyOfCloseableOrError extends Object
The generated copy of a closeable holder is refused (R-A, Steve 2026-10-06, decision D9; E81065).

default operator :=: - written alone, or by the bare default operator that includes it - copies each field by reference: a shallow copy, by design (decision 4), so that the generated copy never invents a deep-copy semantics a type did not ask for. For a closeable field that is a second owner: after a :=: b both objects hold b's resource, both close it, and a's own resource is never closed. Nothing the generator could emit makes that right, so it is refused. A type that needs copying writes its own operator :=:, whose stores are then judged by the fresh-store rule (CloseableSlotStoreOrError).

The fields judged are GeneratedOperatorFields.of(AggregateSymbol) - exactly the set the generated copy walks - filtered by CloseableResourceToBeChecked.isManagedCloseableType(ISymbol). Inherited fields are the super's own copy's concern.