public interface AliasHandler
TypeAnalyzer
.
Users may register alias handlers (and other kinds of supported
handlers) to the TypeAnalyzer
used to analyze Java source code.
When the analyzer detects an alias point, it calls back those alias
handlers after proper types are assigned to both the left-hand side and
the right-hand side of the assignment.
Alias handlers are allowed to modify the alias AST node, either by modifying its children in the AST, or by replacing the whole alias node with another expression or statement. This is because the handler is called after the subtree rooted at the alias node is completely visited by the analyzer. However, modifying any node out of this subtree (e.g., changing the parent of this alias node to another one) may cause unexpected effect.
Alias points in Java include assignment from an array field to a local variable, calling a method with an array field (so that it may be changed with another name within the method), returning an array field from a method, etc.
Modifier and Type | Method and Description |
---|---|
void |
handle(org.eclipse.jdt.core.dom.Assignment node,
TypeAnalyzerState state)
Handle an assignment.
|
void |
handle(org.eclipse.jdt.core.dom.ClassInstanceCreation node,
TypeAnalyzerState state)
Handle a class instance creation (with the new operator).
|
void |
handle(org.eclipse.jdt.core.dom.MethodInvocation node,
TypeAnalyzerState state)
Handle a method invocation.
|
void |
handle(org.eclipse.jdt.core.dom.ReturnStatement node,
TypeAnalyzerState state)
Handle a return statement.
|
void |
handle(org.eclipse.jdt.core.dom.VariableDeclarationFragment node,
TypeAnalyzerState state)
Handle a variable declaration fragment.
|
void handle(org.eclipse.jdt.core.dom.Assignment node, TypeAnalyzerState state)
node
- The node to be handled.state
- The current state of the type analyzer.void handle(org.eclipse.jdt.core.dom.ClassInstanceCreation node, TypeAnalyzerState state)
node
- The node to be handled.state
- The current state of the type analyzer.void handle(org.eclipse.jdt.core.dom.MethodInvocation node, TypeAnalyzerState state)
node
- The node to be handled.state
- The current state of the type analyzer.void handle(org.eclipse.jdt.core.dom.ReturnStatement node, TypeAnalyzerState state)
node
- The node to be handled.state
- The current state of the type analyzer.void handle(org.eclipse.jdt.core.dom.VariableDeclarationFragment node, TypeAnalyzerState state)
node
- The node to be handled.state
- The current state of the type analyzer.