Representation of java.lang.invoke.MethodType instances.
| 36 | * Representation of java.lang.invoke.MethodType instances. |
| 37 | */ |
| 38 | public class MethodType implements ReferenceLiteral { |
| 39 | |
| 40 | private final List<Type> paramTypes; |
| 41 | |
| 42 | private final Type returnType; |
| 43 | |
| 44 | private MethodType(List<Type> paramTypes, Type returnType) { |
| 45 | this.paramTypes = List.copyOf(paramTypes); |
| 46 | this.returnType = returnType; |
| 47 | } |
| 48 | |
| 49 | public static MethodType get(List<Type> paramTypes, Type returnType) { |
| 50 | return new MethodType(paramTypes, returnType); |
| 51 | } |
| 52 | |
| 53 | public List<Type> getParamTypes() { |
| 54 | return paramTypes; |
| 55 | } |
| 56 | |
| 57 | public Type getReturnType() { |
| 58 | return returnType; |
| 59 | } |
| 60 | |
| 61 | @Override |
| 62 | public ClassType getType() { |
| 63 | return World.get().getTypeSystem().getClassType(METHOD_TYPE); |
| 64 | } |
| 65 | |
| 66 | @Override |
| 67 | public <T> T accept(ExpVisitor<T> visitor) { |
| 68 | return visitor.visit(this); |
| 69 | } |
| 70 | |
| 71 | @Override |
| 72 | public boolean equals(Object o) { |
| 73 | if (this == o) { |
| 74 | return true; |
| 75 | } |
| 76 | if (o == null || getClass() != o.getClass()) { |
| 77 | return false; |
| 78 | } |
| 79 | MethodType that = (MethodType) o; |
| 80 | return paramTypes.equals(that.paramTypes) && |
| 81 | returnType.equals(that.returnType); |
| 82 | } |
| 83 | |
| 84 | @Override |
| 85 | public int hashCode() { |
| 86 | return Hashes.hash(paramTypes, returnType); |
| 87 | } |
| 88 | |
| 89 | @Override |
| 90 | public String toString() { |
| 91 | return "MethodType: " + toDescriptor(paramTypes, returnType); |
| 92 | } |
| 93 | } |
nothing calls this directly
no outgoing calls
no test coverage detected