/
WildcardUsage.java
62 lines (47 loc) · 1.52 KB
/
WildcardUsage.java
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
package me.tomassetti.symbolsolver.model.typesystem;
import com.github.javaparser.ast.type.WildcardType;
import me.tomassetti.symbolsolver.resolution.SymbolReference;
import me.tomassetti.symbolsolver.resolution.TypeSolver;
import me.tomassetti.symbolsolver.model.declarations.MethodDeclaration;
import java.util.Collections;
import java.util.List;
/**
* Created by federico on 23/08/15.
*/
public class WildcardUsage implements TypeUsage {
private WildcardType type;
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
WildcardUsage that = (WildcardUsage) o;
if (!type.equals(that.type)) return false;
return true;
}
@Override
public int hashCode() {
return type.hashCode();
}
public WildcardUsage(WildcardType type) {
if (type == null) {
throw new NullPointerException();
}
this.type = type;
}
@Override
public String describe() {
return type.toStringWithoutComments();
}
@Override
public SymbolReference<MethodDeclaration> solveMethod(String name, List<TypeUsage> parameterTypes, TypeSolver typeSolver) {
throw new UnsupportedOperationException();
}
@Override
public List<TypeUsage> parameters() {
return Collections.emptyList();
}
@Override
public boolean isAssignableBy(TypeUsage other, TypeSolver typeSolver) {
throw new UnsupportedOperationException();
}
}