Class BytecodeProgram

java.lang.Object
org.eolang.jeo.representation.bytecode.BytecodeProgram

public final class BytecodeProgram extends Object
Bytecode program.
Since:
0.6
  • Constructor Details

    • BytecodeProgram

      public BytecodeProgram(String pckg)
      Constructor.
      Parameters:
      pckg - Package.
    • BytecodeProgram

      public BytecodeProgram(BytecodeClass... classes)
      Constructor.
      Parameters:
      classes - Classes.
    • BytecodeProgram

      public BytecodeProgram(String pckg, BytecodeClass... classes)
      Constructor.
      Parameters:
      pckg - Package.
      classes - Classes.
    • BytecodeProgram

      public BytecodeProgram(String pckg, List<BytecodeClass> classes)
      Constructor.
      Parameters:
      pckg - Package.
      classes - Classes.
  • Method Details

    • xml

      public com.jcabi.xml.XML xml()
      Converts bytecode into XML.
      Returns:
      XML representation of bytecode.
    • bytecode

      public Bytecode bytecode()
      Generate bytecode.

      In this method we intentionally use the Thread.currentThread().getContextClassLoader() for the class loader of the CheckClassAdapter.verify(ClassReader, ClassLoader, boolean, PrintWriter) instead of default implementation. This is because the default class loader doesn't know about classes compiled on the previous maven step. You can read more about the problem here: PluginStartup.init() ()}

      Returns:
      Bytecode.
    • bytecode

      public Bytecode bytecode(boolean verify)
      Traverse XML and build bytecode class.
      Parameters:
      verify - Verify bytecode.
      Returns:
      Bytecode.
    • top

      public BytecodeClass top()
      Get top class.
      Returns:
      Top class.
    • replaceTopClass

      public BytecodeProgram replaceTopClass(BytecodeClass clazz)
      Copy program with replaced top class.
      Parameters:
      clazz - Class to replace.
      Returns:
      Program with replaced top class.
    • withoutTopClass

      public BytecodeProgram withoutTopClass()
      Copy program without top class.
      Returns:
      Program without top class.
    • directives

      public DirectivesProgram directives(String code)
      Convert to directives.
      Parameters:
      code - Program listing.
      Returns:
      Directives program.
    • directives

      public DirectivesProgram directives(String code, boolean counting)
      Convert to directives.
      Parameters:
      code - Program listing.
      counting - Opcodes counting.
      Returns:
      Directives program.