Record Class ErrorExamples.ErrorExample

java.lang.Object
java.lang.Record
org.ek9lang.compiler.common.ErrorExamples.ErrorExample
Record Components:
path - catalogue-relative path, e.g. E07235/bad.ek9 or E11066/bad/constants1.ek9
code - the error code it belongs to (its directory)
fileName - the path within the code's directory, e.g. good_custom.ek9 or bad/dev/tests.ek9 - what a reader is told the file is called
text - the whole file
body - the EK9 source after the front matter
module - the module it defines, or null
Enclosing class:
ErrorExamples

public static record ErrorExamples.ErrorExample(String path, String code, String fileName, String text, String body, String module) extends Record
One source of the catalogue.
  • Constructor Summary

    Constructors
    Constructor
    Description
    ErrorExample(String path, String code, String fileName, String text, String body, String module)
    Creates an instance of a ErrorExample record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the value of the body record component.
    Returns the value of the code record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    The module a source should define: error.e07235.bad, error.e07235.good[.suffix] - except the bad.ek9 of a code whose subject is the module name (E01020: a reserved module).
    Returns the value of the fileName record component.
    final int
    Returns a hash code value for this object.
    boolean
    True for a file of the code's failing example (bad.ek9, or a file under bad/).
    boolean
    True for the golden output of a test-runner example's run (bad.out).
    boolean
    True when the module it defines is the one the catalogue names it: exactly expectedModule() for a single file; that, or a module below it (error.e11016.bad.billing), for a file of a directory example, whose files may define several modules.
    boolean
    True when shown() is less than the whole source: a // elide: run is collapsed to one comment, so the error page links the whole (wholeSource()).
    boolean
    True for THE file of the failing example that carries the @Error directive - the one checked exactly (the other files of a directory are its companions).
    boolean
    True for a file of one of the code's fixes (good*.ek9, or a file under a good* directory).
    boolean
    True when this file is one of the files of a directory example.
    boolean
    True for an EK9 source; false for a test-runner example's companion file or golden output.
    Returns the value of the module record component.
    Returns the value of the path record component.
    The arguments of the ek9 run this source starts, when it is the main source of a test-runner example (ErrorExamples.CLI_RUN); empty for every other file.
    What a reader is shown of the whole file: the body without its @Error directive lines, WITH its #!ek9 first line (Steve, 2026-10-12) - the same for a source with front matter (FrontMatter.body(String) restores the shebang that sits before it) and one without.
    shown(String region)
    What a reader is shown of one region (the whole source when region is null): no @Error directive and no region marker, dedented (SourceRegions.extract(String, String)).
    Returns the value of the text record component.
    final String
    Returns a string representation of this record class.
    The example this file belongs to: bad, good or good_<suffix> - the file's own stem, or the directory it sits in for a file of a directory example.
    The whole source as a reader is shown it on the full-source page: its #!ek9 first line kept (EK9 requires it, so what is shown compiles), the @Error directive and the region and elide markers removed, nothing elided.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • ErrorExample

      public ErrorExample(String path, String code, String fileName, String text, String body, String module)
      Creates an instance of a ErrorExample record class.
      Parameters:
      path - the value for the path record component
      code - the value for the code record component
      fileName - the value for the fileName record component
      text - the value for the text record component
      body - the value for the body record component
      module - the value for the module record component
  • Method Details

    • unit

      public String unit()
      The example this file belongs to: bad, good or good_<suffix> - the file's own stem, or the directory it sits in for a file of a directory example.
    • isInDirectory

      public boolean isInDirectory()
      True when this file is one of the files of a directory example.
    • isBad

      public boolean isBad()
      True for a file of the code's failing example (bad.ek9, or a file under bad/).
    • isGood

      public boolean isGood()
      True for a file of one of the code's fixes (good*.ek9, or a file under a good* directory).
    • isFailing

      public boolean isFailing()
      True for THE file of the failing example that carries the @Error directive - the one checked exactly (the other files of a directory are its companions).
    • isSource

      public boolean isSource()
      True for an EK9 source; false for a test-runner example's companion file or golden output.
    • isCapture

      public boolean isCapture()
      True for the golden output of a test-runner example's run (bad.out).
    • runnerArgs

      public Optional<String> runnerArgs()
      The arguments of the ek9 run this source starts, when it is the main source of a test-runner example (ErrorExamples.CLI_RUN); empty for every other file.
    • isElided

      public boolean isElided()
      True when shown() is less than the whole source: a // elide: run is collapsed to one comment, so the error page links the whole (wholeSource()).
    • wholeSource

      public String wholeSource()
      The whole source as a reader is shown it on the full-source page: its #!ek9 first line kept (EK9 requires it, so what is shown compiles), the @Error directive and the region and elide markers removed, nothing elided.
    • shown

      public String shown()
      What a reader is shown of the whole file: the body without its @Error directive lines, WITH its #!ek9 first line (Steve, 2026-10-12) - the same for a source with front matter (FrontMatter.body(String) restores the shebang that sits before it) and one without.
    • shown

      public String shown(String region)
      What a reader is shown of one region (the whole source when region is null): no @Error directive and no region marker, dedented (SourceRegions.extract(String, String)). A REGION shows only its region, so never the #!ek9 line.
      Throws:
      IllegalArgumentException - when the region is not declared
    • expectedModule

      public String expectedModule()
      The module a source should define: error.e07235.bad, error.e07235.good[.suffix] - except the bad.ek9 of a code whose subject is the module name (E01020: a reserved module). For a file of a directory example it is the example's own module, which every module of the directory is or starts with (isCatalogueModule()).
    • isCatalogueModule

      public boolean isCatalogueModule()
      True when the module it defines is the one the catalogue names it: exactly expectedModule() for a single file; that, or a module below it (error.e11016.bad.billing), for a file of a directory example, whose files may define several modules.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • path

      public String path()
      Returns the value of the path record component.
      Returns:
      the value of the path record component
    • code

      public String code()
      Returns the value of the code record component.
      Returns:
      the value of the code record component
    • fileName

      public String fileName()
      Returns the value of the fileName record component.
      Returns:
      the value of the fileName record component
    • text

      public String text()
      Returns the value of the text record component.
      Returns:
      the value of the text record component
    • body

      public String body()
      Returns the value of the body record component.
      Returns:
      the value of the body record component
    • module

      public String module()
      Returns the value of the module record component.
      Returns:
      the value of the module record component