in core/src/main/java/com/jetbrains/sa/jdi/ReferenceTypeImpl.java [89:123]
MethodImpl getMethodMirror(sun.jvm.hotspot.oops.Method ref) {
// SA creates new Method objects when they are referenced which means
// that the incoming object might not be the same object as on our
// even though it is the same method. So do an address compare by
// calling equals rather than just reference compare.
for (MethodImpl method : methods()) {
if (ref.equals(method.ref())) {
return method;
}
}
Klass methodHolder = CompatibilityHelper.INSTANCE.getMethodHolder(ref);
if (methodHolder.equals(CompatibilityHelper.INSTANCE.getMethodHandleKlass())) {
// invoke methods are generated as needed, so make mirrors as needed
List<MethodImpl> mis;
if (methodInvokesCache == null) {
mis = new ArrayList<MethodImpl>();
methodInvokesCache = new SoftReference<List<MethodImpl>>(mis);
} else {
mis = methodInvokesCache.get();
}
for (MethodImpl method : mis) {
if (ref.equals(method.ref())) {
return method;
}
}
MethodImpl method = MethodImpl.createMethodImpl(this, ref);
mis.add(method);
return method;
}
throw new IllegalArgumentException("Invalid method: "
+ methodHolder.getName().asString() + " "
+ ref.getName().asString() + " "
+ ref.getSignature().asString());
}