Package com.tonic.analysis.source.ast.transform
Passes that reshape a recovered AST into idiomatic source and undo what the compiler desugared.
-
Interface Summary Interface Description ASTTransform Interface for AST-level transformations that improve decompiled output quality. -
Class Summary Class Description ArrayInitializerReconstructor Folds the verbose array-build idiom javac emits for an array literal back into a literal:ComparisonChainToSwitch Folds a dispatch written as a nested chain of constant equality guards back into aswitch:ControlFlowSimplifier Simplifies control flow in AST to reduce nesting depth and improve readability.DeadStoreEliminator Eliminates dead stores where a variable's initial value is never read.DeadVariableEliminator Removes unused variable declarations from the AST.DeclarationHoister Moves variable declarations closer to their first use.ForLoopCounterFolder Folds a loop counter's hoisted declaration back into thefor-init:PatternInstanceOfDesugar Desugars pattern-matchinginstanceof(Java 16) for the source-to-bytecode front end.PatternInstanceOfReconstructor Reconstructs pattern-matchinginstanceof(Java 16) from the classic bytecode idiom.PatternSwitchDesugar Desugars a Java 21 pattern-matching switch expression into theSwitchBootstraps.typeSwitchinvokedynamic and an integer dispatch switch.PatternSwitchReconstructor Reconstructs a pattern-matching switch (Java 21,SwitchBootstraps.typeSwitch) from the$pc$dispatch loop that control-flow recovery falls back to.RedundantAssignmentEliminator Removes a redundant re-assignmentx = Vthat repeats an earlier identicalx = Vin the same block, when nothing between writesxandVis side-effect free.ScopeEscapeHoister Repairs declarations whose variable escapes its block.SideEffectDetector Determines whether an expression (or any sub-expression) has side effects.SingleUseInliner Inlines single-use temporary variables into their usage site.StringSwitchDesugar Rewrites aswitchoverStringlabels into the two-switch dispatch the JVM can execute.SwitchExpressionDesugar Desugars switch expressions (Java 14) for the source-to-bytecode front end - the inverse ofSwitchExpressionReconstructor.SwitchExpressionReconstructor Reconstructs switch expressions (Java 14) from the classic statement form javac lowers them to.VarargsReconstructor Reconstructs varargs calls by collapsing an explicit trailing array argument back into individual arguments.WhileToForCanonicalizer Canonicalizes a countedwhileback into afor: