mirror of
https://github.com/corda/corda.git
synced 2025-01-03 19:54:13 +00:00
throw NoSuchMethodError in resolveMethod if method not found
This commit is contained in:
parent
0615b8a09f
commit
ba5105c374
@ -5477,15 +5477,11 @@ callContinuation(MyThread* t, object continuation, object result,
|
||||
|
||||
if (rewindMethod(t) == 0) {
|
||||
PROTECT(t, nextContinuation);
|
||||
|
||||
const char* const className = "avian/Continuations";
|
||||
const char* const methodName = "rewind";
|
||||
const char* const methodSpec
|
||||
= "(Ljava/lang/Runnable;Lavian/Callback;Ljava/lang/Object;"
|
||||
"Ljava/lang/Throwable;)V";
|
||||
|
||||
object method = resolveMethod
|
||||
(t, className, methodName, methodSpec);
|
||||
(t, "avian/Continuations", "rewind",
|
||||
"(Ljava/lang/Runnable;Lavian/Callback;Ljava/lang/Object;"
|
||||
"Ljava/lang/Throwable;)V");
|
||||
|
||||
if (method) {
|
||||
rewindMethod(t) = method;
|
||||
@ -5496,11 +5492,6 @@ callContinuation(MyThread* t, object continuation, object result,
|
||||
action = Throw;
|
||||
}
|
||||
} else {
|
||||
object message = makeString
|
||||
(t, "%s %s not found in %s",
|
||||
methodName, methodSpec, className);
|
||||
|
||||
t->exception = makeNoSuchMethodError(t, message);
|
||||
action = Throw;
|
||||
}
|
||||
}
|
||||
@ -5558,21 +5549,13 @@ callWithCurrentContinuation(MyThread* t, object receiver)
|
||||
{ PROTECT(t, receiver);
|
||||
|
||||
if (receiveMethod(t) == 0) {
|
||||
const char* const className = "avian/CallbackReceiver";
|
||||
const char* const methodName = "receive";
|
||||
const char* const methodSpec = "(Lavian/Callback;)Ljava/lang/Object;";
|
||||
|
||||
object m = resolveMethod(t, className, methodName, methodSpec);
|
||||
object m = resolveMethod
|
||||
(t, "avian/CallbackReceiver", "receive",
|
||||
"(Lavian/Callback;)Ljava/lang/Object;");
|
||||
|
||||
if (m) {
|
||||
receiveMethod(t) = m;
|
||||
} else {
|
||||
object message = makeString
|
||||
(t, "%s %s not found in %s", methodName, methodSpec, className);
|
||||
t->exception = makeNoSuchMethodError(t, message);
|
||||
}
|
||||
|
||||
if (LIKELY(t->exception == 0)) {
|
||||
object continuationClass = arrayBody
|
||||
(t, t->m->types, Machine::ContinuationType);
|
||||
|
||||
@ -5614,21 +5597,14 @@ dynamicWind(MyThread* t, object before, object thunk, object after)
|
||||
PROTECT(t, after);
|
||||
|
||||
if (windMethod(t) == 0) {
|
||||
const char* const className = "avian/Continuations";
|
||||
const char* const methodName = "wind";
|
||||
const char* const methodSpec
|
||||
= "(Ljava/lang/Runnable;Ljava/util/concurrent/Callable;"
|
||||
"Ljava/lang/Runnable;)Lavian/Continuations$UnwindResult;";
|
||||
|
||||
object method = resolveMethod(t, className, methodName, methodSpec);
|
||||
object method = resolveMethod
|
||||
(t, "avian/Continuations", "wind",
|
||||
"(Ljava/lang/Runnable;Ljava/util/concurrent/Callable;"
|
||||
"Ljava/lang/Runnable;)Lavian/Continuations$UnwindResult;");
|
||||
|
||||
if (method) {
|
||||
windMethod(t) = method;
|
||||
compile(t, ::codeAllocator(t), 0, method);
|
||||
} else {
|
||||
object message = makeString
|
||||
(t, "%s %s not found in %s", methodName, methodSpec, className);
|
||||
t->exception = makeNoSuchMethodError(t, message);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2521,8 +2521,17 @@ resolveMethod(Thread* t, const char* className, const char* methodName,
|
||||
object spec = makeByteArray(t, methodSpec);
|
||||
object reference = makeReference(t, class_, name, spec);
|
||||
|
||||
return findMethodInClass(t, class_, referenceName(t, reference),
|
||||
referenceSpec(t, reference));
|
||||
object method = findMethodInClass(t, class_, referenceName(t, reference),
|
||||
referenceSpec(t, reference));
|
||||
|
||||
if (t->exception == 0 and method == 0) {
|
||||
object message = makeString
|
||||
(t, "%s %s not found in %s", methodName, methodSpec, className);
|
||||
|
||||
t->exception = makeNoSuchMethodError(t, message);
|
||||
} else {
|
||||
return method;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user