Class JavaExpressionOptimizer
- java.lang.Object
-
- org.checkerframework.dataflow.expression.JavaExpressionVisitor<JavaExpression,java.lang.Void>
-
- org.checkerframework.dataflow.expression.JavaExpressionConverter
-
- org.checkerframework.common.value.JavaExpressionOptimizer
-
public class JavaExpressionOptimizer extends JavaExpressionConverter
Optimize the given JavaExpression. If the supplied factory is aValueAnnotatedTypeFactory
, this implementation replaces any expression that the factory has an exact value for, and does a small (not exhaustive) amount of constant-folding as well. If the factory is some other factory, less optimization occurs.
-
-
Constructor Summary
Constructors Constructor Description JavaExpressionOptimizer(AnnotatedTypeFactory atypeFactory)
Creates a JavaExpressionOptimizer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected JavaExpression
visitFieldAccess(FieldAccess fieldAccessExpr, java.lang.Void unused)
Visit aFieldAccess
.protected JavaExpression
visitLocalVariable(LocalVariable localVarExpr, java.lang.Void unused)
Visit aLocalVariable
.protected JavaExpression
visitMethodCall(MethodCall methodCallExpr, java.lang.Void unused)
Visit aMethodCall
.-
Methods inherited from class org.checkerframework.dataflow.expression.JavaExpressionConverter
convert, convert, visitArrayAccess, visitArrayCreation, visitBinaryOperation, visitClassName, visitFormalParameter, visitThisReference, visitUnaryOperation, visitUnknown, visitValueLiteral
-
Methods inherited from class org.checkerframework.dataflow.expression.JavaExpressionVisitor
visit
-
-
-
-
Constructor Detail
-
JavaExpressionOptimizer
public JavaExpressionOptimizer(AnnotatedTypeFactory atypeFactory)
Creates a JavaExpressionOptimizer.- Parameters:
atypeFactory
- an annotated type factory
-
-
Method Detail
-
visitFieldAccess
protected JavaExpression visitFieldAccess(FieldAccess fieldAccessExpr, java.lang.Void unused)
Description copied from class:JavaExpressionVisitor
Visit aFieldAccess
.- Overrides:
visitFieldAccess
in classJavaExpressionConverter
- Parameters:
fieldAccessExpr
- the JavaExpression to visitunused
- the parameter to pass to the visit method- Returns:
- the result of visiting the
fieldAccessExpr
-
visitLocalVariable
protected JavaExpression visitLocalVariable(LocalVariable localVarExpr, java.lang.Void unused)
Description copied from class:JavaExpressionVisitor
Visit aLocalVariable
.- Overrides:
visitLocalVariable
in classJavaExpressionConverter
- Parameters:
localVarExpr
- the JavaExpression to visitunused
- the parameter to pass to the visit method- Returns:
- the result of visiting the
localVarExpr
-
visitMethodCall
protected JavaExpression visitMethodCall(MethodCall methodCallExpr, java.lang.Void unused)
Description copied from class:JavaExpressionVisitor
Visit aMethodCall
.- Overrides:
visitMethodCall
in classJavaExpressionConverter
- Parameters:
methodCallExpr
- the JavaExpression to visitunused
- the parameter to pass to the visit method- Returns:
- the result of visiting the
methodCallExpr
-
-