Class NonDescriptiveNames

java.lang.Object
org.ek9lang.compiler.support.NonDescriptiveNames

public final class NonDescriptiveNames extends Object
THE single source of the variable names E11031 (NON_DESCRIPTIVE_VARIABLE_NAME) bans - and of everything published about them. Nothing else may write the list out: the phase-5 check, SyntheticParameterNames, the editors' RefusedNames, the CLI/AI help text and the site all read it from here.

Documents cannot call Java, so they carry a TOKEN instead and the one place that loads them expands it: BANNED_NAMES_TOKEN (the names, in prose) and ALTERNATIVES_TOKEN (one "name -> use instead" line per group) - in the rich error messages (RichErrorMessageLoader), the Q&A answers (Ek9QaFileLoader) and the site pages (SiteGeneratorMain, which also renders forAI.json's bannedIdentifiers and the HTML tables from groups()). Before 2026-10-05 the list was hand-copied into a dozen places and they had drifted - a site table missed two of the six groups.

Single-character names are ALWAYS allowed (generic type parameters T/K/V, math x/y/z, loop i/j/k).

  • Field Details

    • BANNED_NAMES_TOKEN

      public static final String BANNED_NAMES_TOKEN
      Expanded to the banned names written as prose: temp, tmp, ..., arg (and arg0, arg1, ...).
      See Also:
    • ALTERNATIVES_TOKEN

      public static final String ALTERNATIVES_TOKEN
      Expanded to one line per group: - temp, tmp -> temporaryUser, calculationResult.
      See Also:
  • Method Details

    • groups

      public static List<NonDescriptiveNames.Group> groups()
      Every group, in the order they are published.
    • names

      public static Set<String> names()
      The banned names themselves (lower case) - a positional name appears once, standing for itself and itself followed by digits.
    • isNonDescriptive

      public static boolean isNonDescriptive(String name)
      True when E11031 would reject name (case-insensitive; single characters are always allowed).
    • asProse

      public static String asProse()
      The banned names as prose: temp, tmp, flag, ..., buf, arg (and arg0, arg1, ...).
    • expand

      public static String expand(String text)
      text with BANNED_NAMES_TOKEN and ALTERNATIVES_TOKEN expanded - for every loader of a document that publishes the list.