Class DirectiveClassBytes

java.lang.Object
org.ek9lang.compiler.directives.DirectiveClassBytes

final class DirectiveClassBytes extends Object
THE shared recovery of a symbol's generated .class bytes for the back-end directive listeners (@BYTECODE, @DEBUG).

Both directives resolve a construct to an ISymbol and then need the exact bytes the back end just produced for it. The bytes are asked of the ConstructOutputSink, not the filesystem, because a caller may legitimately have chosen a sink that holds them in memory rather than writing them (see ConstructOutputSink.read). The dev-then-main lookup mirrors OutputFileAccess. Extracted from ByteCodeDirectiveListener when @DEBUG became a second consumer, so the path derivation is not re-derived.

  • Constructor Details

  • Method Details

    • read

      Optional<byte[]> read(CompilationEvent compilationEvent, ISymbol symbol)
      The bytes for a symbol's generated class, using the dev-then-main lookup — but asking the sink rather than the filesystem.
    • mainClassFile

      File mainClassFile(CompilationEvent compilationEvent, ISymbol symbol)
      The main (non-dev) class file location for a symbol — used for the "not found" diagnostic.