Class CompileClassifier

java.lang.Object
org.ek9lang.compiler.fuzz.CompileClassifier

final class CompileClassifier extends Object
Handles the compile-check-classify pipeline for fuzz-generated sources. Manages ANTLR parse gate, in-process compilation through PRE_IR_CHECKS, error code extraction, and crash classification. Used by all 5 strands in FuzzRunner.
  • Constructor Details

    • CompileClassifier

      CompileClassifier(Path crashDir, FuzzReporter reporter)
      Create a new compile classifier.
      Parameters:
      crashDir - directory to save crash-triggering source files
      reporter - the fuzz reporter for saving crash files
  • Method Details

    • compileAndRecord

      CompileClassifier.CompileResult compileAndRecord(List<CompilableSource> compilableSources, List<NamedSource> namedSources, SharedThreadContext<CompilableProgram> sharedContext, FileHandling fileHandling, CompilerReporter compilerReporter, FuzzStatistics stats, Set<String> constructs, Set<String> controlFlow)
      Compile the sources and record results into the statistics collector. Delegates to the full overload with a null templateId and "S1" strand.
    • compileAndRecord

      CompileClassifier.CompileResult compileAndRecord(List<CompilableSource> compilableSources, List<NamedSource> namedSources, SharedThreadContext<CompilableProgram> sharedContext, FileHandling fileHandling, CompilerReporter compilerReporter, FuzzStatistics stats, Set<String> constructs, Set<String> controlFlow, String templateId, String strandId)
      Compile the sources through PACKAGING_POST_PROCESSING and record outcomes. On success, extracts error codes and duplicate variable info. On crash, classifies as known limitation or real bug and saves crash files.
      Parameters:
      compilableSources - the compilable sources to compile
      namedSources - the original named sources (for crash file saving)
      sharedContext - the per-worker shared compiler context
      fileHandling - the per-worker file handling instance
      compilerReporter - the per-worker compiler reporter
      stats - the shared statistics collector
      constructs - construct tags for crash attribution
      controlFlow - control flow tags for crash attribution
      templateId - optional template identifier for crash attribution
      strandId - the strand identifier for per-strand phase tracking
      Returns:
      compile result with duplicate infos and deepest phase reached
    • extractErrorCodes

      Set<String> extractErrorCodes(List<CompilableSource> compilableSources)
      Extract all error codes from the compiled sources' error listeners.
    • quickParse

      Quick ANTLR parse gate: returns a ParseResult with the parse outcome and error listener. Used to avoid sending unparseable sources through the full compilation pipeline. Callers should call CompileClassifier.ParseResult.harvestErrorCodes(FuzzStatistics) to capture any parse-phase error codes before discarding the result.
    • buildCompilableSources

      List<CompilableSource> buildCompilableSources(List<NamedSource> namedSources)
      Build compilable sources from the named source list. Sources marked as dev in the NamedSource are set as dev CompilableSources.
    • hasDevSources

      static boolean hasDevSources(List<NamedSource> namedSources)
      Check if any named source in the list is marked as dev.
    • isKnownLimitation

      static boolean isKnownLimitation(Throwable ex)
      Check if an exception is a known compiler limitation rather than a real bug. Known limitations include unimplemented features that throw IllegalArgumentException with "not implemented" in the message.