Enum Class CoverageProbeType

java.lang.Object
java.lang.Enum<CoverageProbeType>
org.ek9lang.compiler.ir.CoverageProbeType
All Implemented Interfaces:
Serializable, Comparable<CoverageProbeType>, Constable

public enum CoverageProbeType extends Enum<CoverageProbeType>
Enumeration of coverage probe types placed at control flow points.

Coverage probes are inserted during IR generation when coverage is enabled. Each probe type represents a specific control flow construct that needs to be tracked for code coverage analysis.

EK9's coverage follows an edge-based approach: probes are placed at control flow decision points rather than at every statement. This minimizes the number of probes while maintaining full branch coverage capability.

Note: BLOCK (merge point) and FUNCTION_EXIT probes are intentionally omitted:

  • BLOCK probes are redundant - explicit branch tracking (BRANCH_TRUE/FALSE, SWITCH_CASE, LOOP_BODY) already identifies which paths were taken
  • FUNCTION_EXIT probes are redundant - EK9 has no return statement, so functions have exactly one exit point (end of function body)
  • Enum Constant Details

    • FUNCTION_ENTRY

      public static final CoverageProbeType FUNCTION_ENTRY
      Probe at the entry point of a function/method. Every callable construct gets a FUNCTION_ENTRY probe to track whether the function was ever invoked.
    • BRANCH_TRUE

      public static final CoverageProbeType BRANCH_TRUE
      Probe on the true branch of a conditional (if, while condition is true). Tracks execution of the true path in conditional control flow.
    • BRANCH_FALSE

      public static final CoverageProbeType BRANCH_FALSE
      Probe on the false branch of a conditional (else, while condition is false). Tracks execution of the false path in conditional control flow.
    • SWITCH_CASE

      public static final CoverageProbeType SWITCH_CASE
      Probe at each switch case target. Each case in a switch statement gets its own probe to track which cases were executed.
    • CATCH_BLOCK

      public static final CoverageProbeType CATCH_BLOCK
      Probe at exception handler entry (catch block). Tracks whether exception handlers were exercised during testing.
    • LOOP_BODY

      public static final CoverageProbeType LOOP_BODY
      Probe at loop body entry. Tracks whether loop bodies were executed (distinguishes between loops that ran zero times vs one or more times).
    • FINALLY_BLOCK

      public static final CoverageProbeType FINALLY_BLOCK
      Probe at explicit finally block entry. Tracks whether user-written finally blocks were executed.

      Note: Synthetic finally blocks (from try-with-resources without explicit finally) are NOT tracked because the close() method's FUNCTION_ENTRY probe already proves cleanup happened.

  • Method Details

    • values

      public static CoverageProbeType[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static CoverageProbeType valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null