Record Class CoverageModuleDetails

java.lang.Object
java.lang.Record
org.ek9lang.compiler.ir.data.CoverageModuleDetails
Record Components:
moduleId - Unique identifier for this module (hash-based)
moduleName - Fully qualified module name
sourceHash - Hash of source content for staleness detection
probeCount - Total number of probes in this module
probes - Detailed information for each probe
functions - Coverage information for each function

public record CoverageModuleDetails(long moduleId, String moduleName, long sourceHash, int probeCount, List<CoverageProbeDetails> probes, List<CoverageFunctionDetails> functions) extends Record
Represents complete coverage metadata for a compiled module.

This metadata is generated during IR generation when coverage is enabled. It provides all the information needed to:

  • Initialize coverage counters at runtime
  • Map probe IDs to source locations for reporting
  • Calculate line, branch, and function coverage
  • Generate coverage reports in various formats

The metadata is serialized to .ek9covmeta.json for use by the coverage reporter after test execution.

  • Constructor Details

    • CoverageModuleDetails

      public CoverageModuleDetails(long moduleId, String moduleName, long sourceHash, int probeCount, List<CoverageProbeDetails> probes, List<CoverageFunctionDetails> functions)
      Creates an instance of a CoverageModuleDetails record class.
      Parameters:
      moduleId - the value for the moduleId record component
      moduleName - the value for the moduleName record component
      sourceHash - the value for the sourceHash record component
      probeCount - the value for the probeCount record component
      probes - the value for the probes record component
      functions - the value for the functions record component
  • Method Details

    • of

      public static CoverageModuleDetails of(long moduleId, String moduleName, long sourceHash, List<CoverageProbeDetails> probes, List<CoverageFunctionDetails> functions)
      Create module details with computed probe count.
    • getProbe

      public CoverageProbeDetails getProbe(int probeId)
      Get a probe by its ID.
      Parameters:
      probeId - The probe ID to look up
      Returns:
      The probe details or null if not found
    • getFunction

      public CoverageFunctionDetails getFunction(int functionId)
      Get a function by its ID.
      Parameters:
      functionId - The function ID to look up
      Returns:
      The function details or null if not found
    • hasProbes

      public boolean hasProbes()
      Check if this module has any coverage probes.
    • functionCount

      public int functionCount()
      Get the total number of functions in this module.
    • toString

      @Nonnull public 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      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.
    • moduleId

      public long moduleId()
      Returns the value of the moduleId record component.
      Returns:
      the value of the moduleId record component
    • moduleName

      public String moduleName()
      Returns the value of the moduleName record component.
      Returns:
      the value of the moduleName record component
    • sourceHash

      public long sourceHash()
      Returns the value of the sourceHash record component.
      Returns:
      the value of the sourceHash record component
    • probeCount

      public int probeCount()
      Returns the value of the probeCount record component.
      Returns:
      the value of the probeCount record component
    • probes

      public List<CoverageProbeDetails> probes()
      Returns the value of the probes record component.
      Returns:
      the value of the probes record component
    • functions

      public List<CoverageFunctionDetails> functions()
      Returns the value of the functions record component.
      Returns:
      the value of the functions record component