Class JavaExpressionOptimizer
java.lang.Object
org.checkerframework.dataflow.expression.JavaExpressionVisitor<JavaExpression,Void>
org.checkerframework.dataflow.expression.JavaExpressionConverter
org.checkerframework.common.value.JavaExpressionOptimizer
Optimize the given JavaExpression. If the supplied factory is a
ValueAnnotatedTypeFactory
, 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
ConstructorDescriptionCreates a JavaExpressionOptimizer. -
Method Summary
Modifier and TypeMethodDescriptionprotected JavaExpression
visitFieldAccess
(FieldAccess fieldAccessExpr, Void unused) Visit aFieldAccess
.protected JavaExpression
visitLocalVariable
(LocalVariable localVarExpr, Void unused) Visit aLocalVariable
.protected JavaExpression
visitMethodCall
(MethodCall methodCallExpr, 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 Details
-
JavaExpressionOptimizer
Creates a JavaExpressionOptimizer.- Parameters:
factory
- an annotated type factory
-
-
Method Details
-
visitFieldAccess
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
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
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
-