Package org.codehaus.groovy.transform.sc.transformers

# Class CastExpressionOptimizer

java.lang.Object
org.codehaus.groovy.transform.sc.transformers.CastExpressionOptimizer

public class CastExpressionOptimizer extends Object
Simplifies casts and coercions that the static compiler can safely emit directly.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `CastExpressionOptimizer(StaticCompilationTransformer staticCompilationTransformer)`
  Creates a cast optimizer backed by the owning static compilation transformer.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Expression`
  `transformCastExpression(CastExpression cast)`
  Rewrites a cast expression when the cast or coercion can be simplified.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### CastExpressionOptimizer

    public CastExpressionOptimizer(StaticCompilationTransformer staticCompilationTransformer)
    Creates a cast optimizer backed by the owning static compilation transformer.
    Parameters:
      `staticCompilationTransformer` - the shared transformer context

- ## Method Details

  - ### transformCastExpression

    public Expression transformCastExpression(CastExpression cast)
    Rewrites a cast expression when the cast or coercion can be simplified.
    Parameters:
      `cast` - the cast expression to transform
    Returns:
      the optimized expression