public class Optimizer
extends java.lang.Object
This class is an interface to JEB's AST optimization engine.
The JEB decompiler engine applies tens of optimizations on to a method syntax tree before generating the final Java code; this class lets users access some of these optimization methods programmatically.
Constructor and Description |
---|
Optimizer(JebInstance instance,
Method m)
Create a new optimizer instance.
|
Modifier and Type | Method and Description |
---|---|
int |
removeUnreferencedLabels()
This method looks for unreferenced Java labels, and removes them.
|
int |
removeUselessGotos()
This method looks for useless goto statements, and removes them.
|
int |
runAllOptimizations()
Run all the optimizations that JEB applies to an AST before rendering.
|
public Optimizer(JebInstance instance, Method m)
Create a new optimizer instance. An optimizer is tied to a method and should never be used on other methods than the one used to construct it, at the risk of corrupting syntax trees.
instance
- mandatory JEB instancem
- mandatory methodpublic int runAllOptimizations()
Run all the optimizations that JEB applies to an AST before rendering.
public int removeUnreferencedLabels()
This method looks for unreferenced Java labels, and removes them.
public int removeUselessGotos()
This method looks for useless goto statements, and removes them.
AST optimizations often leave an AST with constructs such as goto label; label: ...;
This method looks for such constructs, including across blocks, and removes them.