<AWT Dev> RFR: 8257853: Remove dependencies on JNF's JNI utility functions in AWT and 2D code [v7]

Sergey Bylokhov serb at openjdk.java.net
Fri Dec 18 21:59:58 UTC 2020


On Fri, 18 Dec 2020 21:52:01 GMT, Phil Race <prr at 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


More information about the awt-dev mailing list