ningyougang commented on code in PR #140:
URL:
https://github.com/apache/openwhisk-runtime-java/pull/140#discussion_r939487201
##########
core/java8actionloop/lib/src/Launcher.java:
##########
@@ -59,18 +59,22 @@ private static void initMain(String[] args) throws
Exception {
}
mainClass = Class.forName(mainClassName);
- Method m = mainClass.getMethod(mainMethodName, new Class[] {
JsonObject.class });
- m.setAccessible(true);
- int modifiers = m.getModifiers();
- if (m.getReturnType() != JsonObject.class ||
!Modifier.isStatic(modifiers) || !Modifier.isPublic(modifiers)) {
+ Method[] methods = mainClass.getDeclaredMethods();
+ Boolean existMain = false;
+ for(Method method: methods) {
+ if (method.getName().equals(mainMethodName)) {
+ existMain = true;
+ break;
+ }
+ }
+ if (!existMain) {
throw new NoSuchMethodException(mainMethodName);
}
- mainMethod = m;
Review Comment:
Because need to support array result, cannot instantiate mainMethod in
`/init` step, should move this relative logic to `/run` logic due to input
param/out result can be `JsonObject or JsonArray`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]