mirror of
https://github.com/corda/corda.git
synced 2025-01-05 20: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) {
|
if (rewindMethod(t) == 0) {
|
||||||
PROTECT(t, nextContinuation);
|
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
|
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) {
|
if (method) {
|
||||||
rewindMethod(t) = method;
|
rewindMethod(t) = method;
|
||||||
@ -5496,11 +5492,6 @@ callContinuation(MyThread* t, object continuation, object result,
|
|||||||
action = Throw;
|
action = Throw;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
object message = makeString
|
|
||||||
(t, "%s %s not found in %s",
|
|
||||||
methodName, methodSpec, className);
|
|
||||||
|
|
||||||
t->exception = makeNoSuchMethodError(t, message);
|
|
||||||
action = Throw;
|
action = Throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5558,21 +5549,13 @@ callWithCurrentContinuation(MyThread* t, object receiver)
|
|||||||
{ PROTECT(t, receiver);
|
{ PROTECT(t, receiver);
|
||||||
|
|
||||||
if (receiveMethod(t) == 0) {
|
if (receiveMethod(t) == 0) {
|
||||||
const char* const className = "avian/CallbackReceiver";
|
object m = resolveMethod
|
||||||
const char* const methodName = "receive";
|
(t, "avian/CallbackReceiver", "receive",
|
||||||
const char* const methodSpec = "(Lavian/Callback;)Ljava/lang/Object;";
|
"(Lavian/Callback;)Ljava/lang/Object;");
|
||||||
|
|
||||||
object m = resolveMethod(t, className, methodName, methodSpec);
|
|
||||||
|
|
||||||
if (m) {
|
if (m) {
|
||||||
receiveMethod(t) = 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
|
object continuationClass = arrayBody
|
||||||
(t, t->m->types, Machine::ContinuationType);
|
(t, t->m->types, Machine::ContinuationType);
|
||||||
|
|
||||||
@ -5614,21 +5597,14 @@ dynamicWind(MyThread* t, object before, object thunk, object after)
|
|||||||
PROTECT(t, after);
|
PROTECT(t, after);
|
||||||
|
|
||||||
if (windMethod(t) == 0) {
|
if (windMethod(t) == 0) {
|
||||||
const char* const className = "avian/Continuations";
|
object method = resolveMethod
|
||||||
const char* const methodName = "wind";
|
(t, "avian/Continuations", "wind",
|
||||||
const char* const methodSpec
|
"(Ljava/lang/Runnable;Ljava/util/concurrent/Callable;"
|
||||||
= "(Ljava/lang/Runnable;Ljava/util/concurrent/Callable;"
|
"Ljava/lang/Runnable;)Lavian/Continuations$UnwindResult;");
|
||||||
"Ljava/lang/Runnable;)Lavian/Continuations$UnwindResult;";
|
|
||||||
|
|
||||||
object method = resolveMethod(t, className, methodName, methodSpec);
|
|
||||||
|
|
||||||
if (method) {
|
if (method) {
|
||||||
windMethod(t) = method;
|
windMethod(t) = method;
|
||||||
compile(t, ::codeAllocator(t), 0, 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 spec = makeByteArray(t, methodSpec);
|
||||||
object reference = makeReference(t, class_, name, spec);
|
object reference = makeReference(t, class_, name, spec);
|
||||||
|
|
||||||
return findMethodInClass(t, class_, referenceName(t, reference),
|
object method = findMethodInClass(t, class_, referenceName(t, reference),
|
||||||
referenceSpec(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;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user