jawa.transforms module

Transforms are simple Instruction modifiers that can be called on each Instruction by the disassemble() function.

jawa.transforms.expand_constants(ins: jawa.util.bytecode.Instruction, *, cf) → jawa.util.bytecode.Instruction[source]

Replace CONSTANT_INDEX operands with the literal Constant object from the constant pool.

Parameters:
  • ins – Instruction to potentially modify.
  • cf – The ClassFile instance used to resolve Constants.
Returns:

Potentially modified instruction.

jawa.transforms.simple_swap(ins: jawa.util.bytecode.Instruction) → jawa.util.bytecode.Instruction[source]

Replaces one instruction with another based on the transform rules in the bytecode definitions. This can help simplify your code as it reduces the overall number of instructions. For example, aload_0 will become aload 0.

Parameters:ins – Instruction to potentially modify.
Returns:Potentially modified instruction.