On Thu, 14 Jan 2021 21:41:21 GMT, Phil Race <p...@openjdk.org> wrote:

>> Most of the changes here are simply
>> JNF_COCOA_ENTER -> JNI_COCOA_ENTER
>> JNF_COCOA_EXIT -> JNI_COCOA_EXIT
>> 
>> These new macros are defined in JNIUtilities.h and handle the auto release 
>> and on exit catch any NSException.
>> Unlike the JNF code, JNI exceptions don't have to be extracted from the 
>> NSException.
>> 
>> So calls to JNFException are also removed and in most cases they are just 
>> directly using one of the JNU_*
>> defined exceptions since we are in a native nethod and can return control 
>> directly to Java.
>> 
>> JNIUtilities has just two macros for cases where we need to accompany it 
>> with an NSException because
>> we aren't in the immediate body of a JNI method.
>> 
>> JNIUtilities also has a macro JNI_COCOA_EXIT_WITH_ACTION
>> This is used by a macro in QuartzSurfaceData.m to re-implement a 
>> pre-existing macro
>> JNF_COCOA_RENDERER_EXIT as JNI_COCOA_RENDERER_EXIT.
>> This is used in a few places to ensure that we call FinishSurface on the 
>> Quartz surface.
>> 
>> This already passed all our automated tests, although I'm re-running since I 
>> needed to merge to the
>> current repo state.
>
> Phil Race has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   8259651: [macOS] Replace JNF_COCOA_ENTER/EXIT macros

src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.m line 1680:

> 1678:             [nsWindow setFrame:screenRect display:YES];
> 1679:         } else {
> 1680:             [NSException raise:@"Java Exception" reason:@"Failed to 
> enter full screen." userInfo:nil];

Since this code is lexically inside a block executed on the AppKit thread it 
makes no sense to raise a Java Exception.

src/java.desktop/macosx/native/libawt_lwawt/awt/QuartzSurfaceData.m line 57:

> 55:     } \
> 56:     [NSException raise:@"Java Exception" reason:@"Java 
> OutOfMemoryException" userInfo:nil]
> 57: 

This macro is needed only in this file.

-------------

PR: https://git.openjdk.java.net/jdk/pull/2056

Reply via email to