blob: 7939b41fa73a0577b8de4545839a3887bc75c59b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
package org.checkerframework.dataflow.cfg.node;
import java.util.Collection;
import java.util.Collections;
import org.checkerframework.dataflow.util.HashCodeUtils;
import org.checkerframework.javacutil.InternalUtils;
import com.sun.source.tree.ParameterizedTypeTree;
import com.sun.source.tree.Tree;
/**
* A node for a parameterized type occurring in an expression:
*
* <pre>
* <em>type<arg1, arg2></em>
* </pre>
*
* Parameterized types don't represent any computation to be done
* at runtime, so we might choose to represent them differently by
* modifying the {@link Node}s in which parameterized types can occur, such
* as {@link ObjectCreationNode}s.
*
* @author Stefan Heule
* @author Charlie Garrett
*
*/
public class ParameterizedTypeNode extends Node {
protected Tree tree;
public ParameterizedTypeNode(Tree t) {
super(InternalUtils.typeOf(t));
assert t instanceof ParameterizedTypeTree;
tree = t;
}
@Override
public Tree getTree() {
return tree;
}
@Override
public <R, P> R accept(NodeVisitor<R, P> visitor, P p) {
return visitor.visitParameterizedType(this, p);
}
@Override
public String toString() {
return getTree().toString();
}
@Override
public boolean equals(Object obj) {
if (obj == null || !(obj instanceof ParameterizedTypeNode)) {
return false;
}
ParameterizedTypeNode other = (ParameterizedTypeNode) obj;
return getTree().equals(other.getTree());
}
@Override
public int hashCode() {
return HashCodeUtils.hash(getTree());
}
@Override
public Collection<Node> getOperands() {
return Collections.emptyList();
}
}
|