On Fri, 18 Dec 2020 21:52:01 GMT, Phil Race <p...@openjdk.org> wrote:
>> We should take care of native exceptions, and probably use more objective-c >> than the macro. > >> We should take care of native exceptions, and probably use more objective-c >> than the macro. > > We will take care of native exceptions - the ENTER/EXIT macros which have yet > to be updated will handle these if they occur. > This part of the changes is about JNI up-calls. > > There seems to be a pattern where we replace `JNFCallObjectMethod()` with a > > pair of `CallObjectMethod()` immediately followed by `CHECK_EXCEPTION()` > > There are places where currently in this fix, this pattern is missing the > > `CHECK_EXCEPTION()` > > Can we replace `JNFCallObjectMethod()` by a single function call (or macro) > > that wraps both `CallObjectMethod()` and `CHECK_EXCEPTION()` into one? > > This would make this change more robust and make it easier to review it. > > Its is a reasonable idea and I thought about it but on the whole I'd prefer > not to do it and insted fix missing cases. > Tthere are cases where we are using these macros directly in a native method > and then returning to Java. > In those case I want to propagate the exception and this suggestion would > make that difficult if not impossible. I guess it should work already in the JNF case? The java exception should be wrapped by the NSException in the JNFCallObjectMethod/etc and unwrapped in the JNF_COCOA_ENTER before exists to the java method? > So I believe we may end up more (theoretically) robust with my changes than > we were before. > Perhaps they weren't a result of a JNF* call but still it seems improved. I am not sure about that. ------------- PR: https://git.openjdk.java.net/jdk/pull/1679