Class MethodKindClassifier

java.lang.Object
org.ek9lang.compiler.backend.jvm.MethodKindClassifier

final class MethodKindClassifier extends Object
Derives an Ek9MethodKind for a compiler-generated method emitted through the IR funnel (generateGeneralMethodFromIR / generateGeneralConstructorFromIR in AsmStructureCreator). The dedicated emission paths (c_init, i_init, _main) and the generator-invented, symbol-less methods (the singleton, bridges, _Constants, _Application, ek9/Main, …) know their kind directly and do NOT use this class - see docs/strategic/EK9_DEBUGGER_STRATEGY.md §18.2/§18.4.

THE SAFETY RULE. A null return means "no attribute entry" ⇒ the method is treated as user code and is fully visible/steppable in the debugger. Only a hide-always kind causes ACC_SYNTHETIC to be emitted (C.1), which a "skip synthetic" debugger uses to HIDE the frame. Therefore this classifier only ever returns a hide-always kind when it is CERTAIN the method is compiler plumbing (a construct-level scenario, a robust symbol flag, or a reserved name). When in any doubt it falls through to null (visible) or a step-on-request/ show-represented kind (also visible) - never to a hide-always guess. Mis-hiding user code is a correctness bug; leaving plumbing visible is only a cosmetic one.

v1 simplifications (documented, safe - each errs toward visibility): the <dispatcher> advisory hint is not emitted (dispatcher entry methods stay null = user code); constrained types emit CONSTRAINED_GUARD for every generated member rather than splitting off the hide-always CONSTRAINED_FORWARDER (all such members are generated, so showing them is safe and arguably preferable for "why did this Panic"). Both are step-on-request refinements, not correctness gaps.

  • Constructor Details

    • MethodKindClassifier

      MethodKindClassifier()
  • Method Details

    • classifyMethod

      Ek9MethodKind classifyMethod(IRConstruct construct, OperationInstr operation)
      Classify a general (non-ctor, non-c_init/i_init/_main) funnel method. Returns null for a user method (no entry). The caller must only invoke this for methods that carry a body - an abstract declaration has no Code attribute and gets no entry regardless.
    • classifyConstructor

      Ek9MethodKind classifyConstructor(IRConstruct construct, OperationInstr operation)
      Classify a general constructor funnel emission. Returns null for a user-declared constructor (no entry, visible).
    • isScenario2Wrapper

      boolean isScenario2Wrapper(IRConstruct construct)
      A Scenario-2 wrapper: a parameterised type whose GENERIC template is externally implemented (a built-in generic like List/Optional/Dict parameterised with a user type). Its members are generated delegations to the extern Java impl - see AsmStructureCreator.isScenario2WrapperDelegateField(IRConstruct, String).