Class ConstantsClassGenerator

java.lang.Object
org.ek9lang.compiler.backend.jvm.ConstantsClassGenerator

public final class ConstantsClassGenerator extends Object
Generates a per-module _Constants JVM class from constant IRConstructs.

Aggregates all constant IRConstructs for a single module into one class with: - Public static fields for each constant - A <clinit> that initializes all constants via Type._of(literalValue) - A private no-arg constructor to prevent instantiation

This is the JVM-specific backend for constant code generation, called by CodeGenerationConstants (Phase 15). LLVM backend would have its own equivalent.

  • Constructor Details

    • ConstantsClassGenerator

      public ConstantsClassGenerator(FileHandling fileHandling)
  • Method Details

    • generate

      public void generate(String moduleName, List<IRConstruct> constants, File outputDirectory)
      Generate the _Constants.class file for a module.
      Parameters:
      moduleName - the EK9 module name (e.g., "my.app")
      constants - all constant IRConstructs for this module
      outputDirectory - the base output directory for generated class files