Class PatternSwitchDesugar
- java.lang.Object
-
- com.tonic.analysis.source.ast.transform.PatternSwitchDesugar
-
- All Implemented Interfaces:
ASTTransform
public class PatternSwitchDesugar extends Object implements ASTTransform
Desugars a Java 21 pattern-matching switch expression into theSwitchBootstraps.typeSwitchinvokedynamic and an integer dispatch switch.
-
-
Constructor Summary
Constructors Constructor Description PatternSwitchDesugar()Creates a desugarer with no class pool, so record-component lookups are unavailable.PatternSwitchDesugar(ClassPool classPool)Creates a desugarer that resolves record components through a pool.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetName()booleantransform(BlockStmt block)Transforms the given block statement in place.
-
-
-
Constructor Detail
-
PatternSwitchDesugar
public PatternSwitchDesugar()
Creates a desugarer with no class pool, so record-component lookups are unavailable.
-
PatternSwitchDesugar
public PatternSwitchDesugar(ClassPool classPool)
Creates a desugarer that resolves record components through a pool.- Parameters:
classPool- the pool used to read Record attributes, or null
-
-
Method Detail
-
getName
public String getName()
- Specified by:
getNamein interfaceASTTransform- Returns:
- the name of this transform for logging/debugging
-
transform
public boolean transform(BlockStmt block)
Description copied from interface:ASTTransformTransforms the given block statement in place.- Specified by:
transformin interfaceASTTransform- Parameters:
block- the block to transform- Returns:
- true if any changes were made
-
-