Class TemplateProbeGenerator

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

public final class TemplateProbeGenerator extends Object
Strand 2: Compiler-Aware Injection. Compiles working qaExample templates through PRE_IR_CHECKS, harvests the resolved symbol table from CompilableProgram, then generates probe source files that call or reference those real symbols — sometimes correctly, sometimes with controlled mutations.

The key insight: the compiler's own CompilableProgram IS our symbol registry. No parallel tracking needed — we ask the compiler what exists.

  • Field Details

    • BUILT_IN_TYPES

      static final Set<String> BUILT_IN_TYPES
  • Constructor Details

  • Method Details

    • setStatistics

      public void setStatistics(FuzzStatistics stats)
      Set the statistics collector for liveness tracking.
    • generate

      public TemplateProbeGenerator.ProbeResult generate(Random random)
      Generate a probe: pick a random template, generate correct or near-correct calls. All templates are usable — those without callable symbols get a fallback probe exercising built-in type operations in the template's module context.
      Returns:
      ProbeResult with sources and template ID, or null if no templates at all
    • templateCount

      public int templateCount()
      How many templates were harvested (all are now usable via fallback probes).
    • cleanupModule

      static void cleanupModule(CompilableSource cs, SharedThreadContext<CompilableProgram> sharedContext)
    • isInstantiableGenus

      static boolean isInstantiableGenus(SymbolGenus genus)
    • harvestType

      static HarvestedType harvestType(AggregateSymbol aggregate)
    • harvestMethod

      static HarvestedMethod harvestMethod(MethodSymbol method)
    • harvestFunction

      static HarvestedFunction harvestFunction(MethodSymbol method)
    • findCallableConstructor

      static HarvestedMethod findCallableConstructor(HarvestedType type, Map<String,String> constructedTypes, Random random)
    • canProvideAllParams

      static boolean canProvideAllParams(List<String> paramTypes, Map<String,String> constructedTypes)
    • generateArgs

      static String generateArgs(List<String> paramTypes, Map<String,String> constructedTypes, Random random)
    • generateLiteral

      static String generateLiteral(String typeName, Random random)
    • extractModuleName

      static String extractModuleName(String source)
    • extractQaId

      static String extractQaId(String filename)
      Extract QA ID from a filename like "qaExamples/classesAndOOP/QA0093_define_class.ek9". Returns "QA0093" or the full filename if no QA ID pattern is found.
    • getTemplates

      List<HarvestedTemplate> getTemplates()
      Access to loaded templates for Strand 3 mutation access.