Class CoverageMetadataJson

java.lang.Object
org.ek9lang.compiler.ir.data.CoverageMetadataJson

public final class CoverageMetadataJson extends Object
THE serialisation of a source file's coverage metadata (IR tidy W3.9, INFRA-10) - the probes and functions a CoverageProbePlacer registered, its module-level injection counts and file readability scores - as the JSON the runtime computes coverage from. Never write this JSON anywhere else. Stateless: hold one.

The format is:

{
  "probes": [
    {"id": "0x1234...", "type": "FUNCTION_ENTRY", "line": 10, "functionId": "0xABCD..."},
    {"id": "0x5678...", "type": "BRANCH_TRUE", "line": 15, "functionId": "0xABCD..."}
  ],
  "functions": [
    {"id": "0xABCD...", "name": "myFunction", "startLine": 10, "endLine": 20, "entryProbeId": "0x1234..."}
  ]
}
  • Constructor Details

    • CoverageMetadataJson

      public CoverageMetadataJson()
  • Method Details

    • of

      public String of(List<CoverageProbeDetails> probes, List<CoverageFunctionDetails> functions, int fieldInjections, int registrations, Map<String,String> fileReadability)
      The JSON of this metadata, or null when there are no probes and no functions.
      Parameters:
      probes - every probe registered, in registration order
      functions - every function registered, in registration order
      fieldInjections - module-level count of field injections
      registrations - module-level count of register statements
      fileReadability - readability score by source file