178 return lookup.findGetter(resolvedOwner, name, invocationType.returnType());
179 case STATIC_GETTER:
180 return lookup.findStaticGetter(resolvedOwner, name, invocationType.returnType());
181 case SETTER:
182 return lookup.findSetter(resolvedOwner, name, invocationType.parameterType(1));
183 case STATIC_SETTER:
184 return lookup.findStaticSetter(resolvedOwner, name, invocationType.parameterType(0));
185 default:
186 throw new IllegalStateException(kind.name());
187 }
188 }
189
190 /**
191 * Returns {@code true} if this {@linkplain DirectMethodHandleDescImpl} is
192 * equal to another {@linkplain DirectMethodHandleDescImpl}. Equality is
193 * determined by the two descriptors having equal kind, owner, name, and type
194 * descriptor.
195 * @param o a {@code DirectMethodHandleDescImpl} to compare to this
196 * {@code DirectMethodHandleDescImpl}
197 * @return {@code true} if the specified {@code DirectMethodHandleDescImpl} is
198 * equals to this {@code DirectMethodHandleDescImpl}.
199 */
200 @Override
201 public boolean equals(Object o) {
202 if (this == o) return true;
203 if (o == null || getClass() != o.getClass()) return false;
204 DirectMethodHandleDescImpl desc = (DirectMethodHandleDescImpl) o;
205 return kind == desc.kind &&
206 Objects.equals(owner, desc.owner) &&
207 Objects.equals(name, desc.name) &&
208 Objects.equals(invocationType, desc.invocationType);
209 }
210
211 @Override
212 public int hashCode() {
213 return Objects.hash(kind, owner, name, invocationType);
214 }
215
216 @Override
217 public String toString() {
218 return String.format("MethodHandleDesc[%s/%s::%s%s]", kind, owner.displayName(), name, invocationType.displayDescriptor());
|
178 return lookup.findGetter(resolvedOwner, name, invocationType.returnType());
179 case STATIC_GETTER:
180 return lookup.findStaticGetter(resolvedOwner, name, invocationType.returnType());
181 case SETTER:
182 return lookup.findSetter(resolvedOwner, name, invocationType.parameterType(1));
183 case STATIC_SETTER:
184 return lookup.findStaticSetter(resolvedOwner, name, invocationType.parameterType(0));
185 default:
186 throw new IllegalStateException(kind.name());
187 }
188 }
189
190 /**
191 * Returns {@code true} if this {@linkplain DirectMethodHandleDescImpl} is
192 * equal to another {@linkplain DirectMethodHandleDescImpl}. Equality is
193 * determined by the two descriptors having equal kind, owner, name, and type
194 * descriptor.
195 * @param o a {@code DirectMethodHandleDescImpl} to compare to this
196 * {@code DirectMethodHandleDescImpl}
197 * @return {@code true} if the specified {@code DirectMethodHandleDescImpl} is
198 * equal to this {@code DirectMethodHandleDescImpl}.
199 */
200 @Override
201 public boolean equals(Object o) {
202 if (this == o) return true;
203 if (o == null || getClass() != o.getClass()) return false;
204 DirectMethodHandleDescImpl desc = (DirectMethodHandleDescImpl) o;
205 return kind == desc.kind &&
206 Objects.equals(owner, desc.owner) &&
207 Objects.equals(name, desc.name) &&
208 Objects.equals(invocationType, desc.invocationType);
209 }
210
211 @Override
212 public int hashCode() {
213 return Objects.hash(kind, owner, name, invocationType);
214 }
215
216 @Override
217 public String toString() {
218 return String.format("MethodHandleDesc[%s/%s::%s%s]", kind, owner.displayName(), name, invocationType.displayDescriptor());
|