Class GenericTemplateMember
Why this exists. EK9 monomorphises, so Box of String and Box of Integer are
separate aggregates whose members are substituted COPIES of the generic's. Every tool that reasons
about "the code" wants the one source, not the N copies — and three separate surfaces were found
(2026-09-13) to have lost sight of generics for exactly this reason:
- Coverage (D11) — probes were numbered per monomorphisation, so one source constructor acquired an identity per parameterisation and inflated the denominator.
- Input variety (D11/W5a) — the phase-9 floor is squirrelled on the TEMPLATE, but a parameterisation's members are copies made at resolution, so they never received it and no probe was emitted inside a generic at all.
- Reachability (D15) — the call graph enumerated template members while its edges targeted monomorphised ones, so a USED generic's methods were reported as dead code.
🔑 Correspondence is by SOURCE TOKEN — the declaration position — never by name or arity.
Symbol.copy carries setSourceToken(this.getSourceToken()) through substitution, so a
substituted member and its template share a position exactly. Name-and-arity cannot be used: a
constructor's name IS its type's name, which is mangled in the copy and not in the template, and a
generic may declare Box(T) beside Box(String) so arity is ambiguous. Matching those
wrongly is silent — it attributes work to the wrong member rather than failing.
Stateless; every method is static and null-tolerant.
-
Method Summary
Modifier and TypeMethodDescriptionstatic Optional<MethodSymbol> forMethod(MethodSymbol method) The generic's own method this one was substituted from.
-
Method Details
-
forMethod
The generic's own method this one was substituted from.- Parameters:
method- the method being examined; may be null- Returns:
- the template's corresponding method, or empty when
methodis not a member of a parameterised type (which includes every ordinary, non-generic method)
-