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.ek9orE11066/bad/constants1.ek9code- the error code it belongs to (its directory)fileName- the path within the code's directory, e.g.good_custom.ek9orbad/dev/tests.ek9- what a reader is told the file is calledtext- the whole filebody- the EK9 source after the front mattermodule- the module it defines, ornull
- Enclosing class:
ErrorExamples
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbody()Returns the value of thebodyrecord component.code()Returns the value of thecoderecord component.final booleanIndicates whether some other object is "equal to" this one.The module a source should define:error.e07235.bad,error.e07235.good[.suffix]- except thebad.ek9of a code whose subject is the module name (E01020: a reserved module).fileName()Returns the value of thefileNamerecord component.final inthashCode()Returns a hash code value for this object.booleanisBad()True for a file of the code's failing example (bad.ek9, or a file underbad/).booleanTrue for the golden output of a test-runner example's run (bad.out).booleanTrue when the module it defines is the one the catalogue names it: exactlyexpectedModule()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.booleanisElided()True whenshown()is less than the whole source: a// elide:run is collapsed to one comment, so the error page links the whole (wholeSource()).booleanTrue for THE file of the failing example that carries the@Errordirective - the one checked exactly (the other files of a directory are its companions).booleanisGood()True for a file of one of the code's fixes (good*.ek9, or a file under agood*directory).booleanTrue when this file is one of the files of a directory example.booleanisSource()True for an EK9 source; false for a test-runner example's companion file or golden output.module()Returns the value of themodulerecord component.path()Returns the value of thepathrecord component.The arguments of theek9run this source starts, when it is the main source of a test-runner example (ErrorExamples.CLI_RUN); empty for every other file.shown()What a reader is shown of the whole file: the body without its@Errordirective lines, WITH its#!ek9first 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.What a reader is shown of one region (the whole source whenregionis null): no@Errordirective and no region marker, dedented (SourceRegions.extract(String, String)).text()Returns the value of thetextrecord component.final StringtoString()Returns a string representation of this record class.unit()The example this file belongs to:bad,goodorgood_<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#!ek9first line kept (EK9 requires it, so what is shown compiles), the@Errordirective and the region and elide markers removed, nothing elided.
-
Constructor Details
-
ErrorExample
public ErrorExample(String path, String code, String fileName, String text, String body, String module) Creates an instance of aErrorExamplerecord class.- Parameters:
path- the value for thepathrecord componentcode- the value for thecoderecord componentfileName- the value for thefileNamerecord componenttext- the value for thetextrecord componentbody- the value for thebodyrecord componentmodule- the value for themodulerecord component
-
-
Method Details
-
unit
The example this file belongs to:bad,goodorgood_<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 underbad/). -
isGood
public boolean isGood()True for a file of one of the code's fixes (good*.ek9, or a file under agood*directory). -
isFailing
public boolean isFailing()True for THE file of the failing example that carries the@Errordirective - 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
The arguments of theek9run 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 whenshown()is less than the whole source: a// elide:run is collapsed to one comment, so the error page links the whole (wholeSource()). -
wholeSource
The whole source as a reader is shown it on the full-source page: its#!ek9first line kept (EK9 requires it, so what is shown compiles), the@Errordirective and the region and elide markers removed, nothing elided. -
shown
What a reader is shown of the whole file: the body without its@Errordirective lines, WITH its#!ek9first 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
What a reader is shown of one region (the whole source whenregionis null): no@Errordirective and no region marker, dedented (SourceRegions.extract(String, String)). A REGION shows only its region, so never the#!ek9line.- Throws:
IllegalArgumentException- when the region is not declared
-
expectedModule
The module a source should define:error.e07235.bad,error.e07235.good[.suffix]- except thebad.ek9of 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: exactlyexpectedModule()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
-
hashCode
-
equals
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 withObjects::equals(Object,Object). -
path
-
code
-
fileName
-
text
-
body
-
module
-