<AWT Dev> RFR: 8260616: Removing remaining JNF dependencies in the java.desktop module [v3]

Sergey Bylokhov serb at openjdk.java.net
Tue Feb 2 22:11:48 UTC 2021

On Mon, 1 Feb 2021 23:47:06 GMT, Phil Race <prr at openjdk.org> wrote:

>> src/java.desktop/macosx/native/libawt_lwawt/awt/CTextPipe.m line 611:
>>> 609:         const jchar *unichars = (*env)->GetStringChars(env, str, NULL);
>>> 610:         if (unichars == NULL) {
>>> 611:             return;
>> Do not we need to throw an exception here? Otherwise, GetStringChars error will be ignored?
> Look a few lines further up at my reply 3 days ago Gerard about this.

I read it and not sure that it is fine to ignore this error, why not throw an exception and signal the CTextPipe_doDrawString that an error occurred like InvalidPipeException or something(Sometimes we wrap other exception like OOM into the InvalidPipeException and this seems similar case)?

>> src/java.desktop/macosx/native/libawt_lwawt/awt/JavaComponentAccessibility.m line 967:
>>> 965: static NSNumber* JavaNumberToNSNumber(JNIEnv *env, jobject jnumber) {
>>> 966:     if (jnumber == NULL) {
>>> 967:         return nil;
>> Based on its usage it is probably should be zero on NULL number?
> Not an unreasonable idea and I considered it but :
> - It is never called with NULL. There is always a null check
> - The JNF equivalent returns nil on NULL
> BTW two of the functions in which the code appears : accessibilityMinValueAttribute and accessibilityMaxValueAttribute  (SFAIC) aren't used anywhere.

@azuev-java Looks like a cleanup opportunity?


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

More information about the awt-dev mailing list