Class MagicLiteralExemptions

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

final class MagicLiteralExemptions extends Object
THE contexts in which a literal is never a magic literal, for both magic-literal checks (E11064, a number in a comparison, and E11065, a repeated String): the fix itself (a constant declaration), a pre/post-condition (require, assert), a constrain declaration, and a NAMED argument - the label documents the value and the compiler checks it against the declared parameter (E06240/E06250), so it cannot lie.

A check with further exemptions of its own (E11065 also exempts list, dict and range literals and string concatenation) asks isExemptNode(ParseTree) and adds them, so what the two share is one list and what differs is one visible difference (F10, 2026-10-20: it was two copies that had drifted). A constructor call is not an exemption (D4) - label it.

  • Method Summary

    Modifier and Type
    Method
    Description
    (package private) static boolean
    isExemptNode(org.antlr.v4.runtime.tree.ParseTree node)
    True if a literal that has this node among its ancestors is exempt from every magic-literal check.
    (package private) static boolean
    isNamedArgument(org.antlr.v4.runtime.tree.ParseTree node)
    A named argument (an expressionParam with an identifier): the label conveys the intent.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • isExemptNode

      static boolean isExemptNode(org.antlr.v4.runtime.tree.ParseTree node)
      True if a literal that has this node among its ancestors is exempt from every magic-literal check.
    • isNamedArgument

      static boolean isNamedArgument(org.antlr.v4.runtime.tree.ParseTree node)
      A named argument (an expressionParam with an identifier): the label conveys the intent.