Class MethodKindTable

java.lang.Object
org.ek9lang.compiler.backend.jvm.support.MethodKindTable

public final class MethodKindTable extends Object
Per-class accumulator of Ek9MethodKind entries, populated as methods are emitted and turned into the Ek9MethodKinds class attribute just before visitEnd() (mirroring how the SMAP is collected then attached). One instance per generated class.

Both emission layers feed the same table: IR-funnel methods (keyed on their MethodSymbol) and generator-invented, symbol-less methods (each generator records its own). See docs/strategic/EK9_DEBUGGER_STRATEGY.md §18.4.

Keyed by (name, descriptor) with last-record-wins: when both layers classify the same method (e.g. iterator() is retro-marked ENUM_OP then re-classified ENUM_ITERATOR, §18.2), the later record(...) overrides — so exactly one wire entry per method, never a conflicting pair. Insertion order is preserved for stable golden output.

  • Constructor Details

    • MethodKindTable

      public MethodKindTable()
  • Method Details

    • record

      public void record(String name, String descriptor, Ek9MethodKind kind)
      Record a generated method's kind (last-wins per name+descriptor). Ordinary user-code methods are simply never recorded.
    • isEmpty

      public boolean isEmpty()
    • toAttribute

      public Ek9MethodKindsAttribute toAttribute()
      Build the attribute to attach via classWriter.visitAttribute(...) before visitEnd.
    • attachTo

      public void attachTo(org.objectweb.asm.ClassWriter classWriter)
      Attach the accumulated kinds as the Ek9MethodKinds class attribute, iff any were recorded. Call this once, immediately before classWriter.visitEnd() (the same slot the SMAP is attached). A class with no generated methods contributes no attribute.
    • syntheticFlag

      public static int syntheticFlag(Ek9MethodKind kind)
      THE C.1 ACC_SYNTHETIC gate: the extra access bit a generated method carries iff its kind is hide-always. OR this into the base access flags at visitMethod time. Returns 0 for a null kind (user code) or any step-on-request/show-represented kind - marking those synthetic would make a "skip synthetic" debugger hide the user's own code (strategy §18.4 conclusion 1). This is the ONLY place the kind → JVM-bit mapping is made.