Re: RFR: 8267385: Create NSAccessibilityElement implementation for JavaComponentAccessibility [v8]

2021-08-01 Thread Sergey Bylokhov
On Wed, 21 Jul 2021 17:25:48 GMT, Artem Semenov 
 wrote:

>> src/java.desktop/macosx/classes/sun/lwawt/macosx/CAccessibility.java line 
>> 556:
>> 
>>> 554: ((JList) parent).setSelectedIndex(i);
>>> 555: return;
>>> 556: }
>> 
>> Looks like the a11y interface miss "setSelectedIndex" method? The code above 
>> will not work for the custom component which uses the "AccessibleJListChild" 
>> a11y object?
>
> Unfortunately, the current a11y interface does not allow this action.
> As for the custom AccessibleJListChild, I prepared a [sample 
> project](https://github.com/savoptik/AccessibilityJListItemA11yExample) in 
> which I implemented a custom child. The experiment showed that there are no 
> negative consequences. The custom child works as intended.

In the example, you use a JList class, and the checks in the code above works, 
but if some other "AccessibleJList" class will be used then it will not work, 
right? This is the reason why implementations of a11y classes usually use 
specific interfaces like "AccessibleJList".

>> src/java.desktop/macosx/native/libawt_lwawt/awt/JavaComponentAccessibility.m 
>> line 50:
>> 
>>> 48: #define JAVA_AX_ALL_CHILDREN (-1)
>>> 49: #define JAVA_AX_SELECTED_CHILDREN (-2)
>>> 50: #define JAVA_AX_VISIBLE_CHILDREN (-3)
>> 
>> Why not mark them as @native in the CAccessibility  and use constants 
>> generated by the javac?
>
> Done

But the code above still exits or it is a github glitch?

>> src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/TableAccessibility.m 
>> line 155:
>> 
>>> 153: - (NSArray *)accessibilitySelectedChildren
>>> 154: {
>>> 155: return [self accessibilitySelectedRows];
>> 
>> Does it mean that the children of the table are rows and columns and not 
>> "cells".? How it will work if only one cell is selected?
>
> As @ azuev-java canceled below this is not functional regression.
> However, cell navigation will be implemented later in 
> [JDK-8271071](https://bugs.openjdk.java.net/browse/JDK-8271071).

ok

-

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


Re: RFR: 8267385: Create NSAccessibilityElement implementation for JavaComponentAccessibility [v8]

2021-08-01 Thread Sergey Bylokhov
On Wed, 21 Jul 2021 13:16:46 GMT, Artem Semenov 
 wrote:

>> The comment states that it is not necessary to call ExceptionCheck, but it 
>> will be done before by the CHECK_EXCEPTION. The macro also will log it when 
>> necessary.
>
> Done

I suggest doing the opposite, leave the CHECK_EXCEPTION and remove the chech 
and the logging. The CHECK_EXCEPTION  is better since it can be configured via 
properties, and it will chech itself on what thread the current code is 
executed.

-

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


Re: RFR: 8269130: Replace usages of Collection.toArray() with Collection.toArray(T[]) to avoid redundant array copying

2021-08-01 Thread Sergey Bylokhov
On Mon, 14 Jun 2021 17:00:29 GMT, Andrey Turbanov 
 wrote:

> I found few places, where code initially perform `Object[] 
> Colleciton.toArray()` call and then manually copy array into another array 
> with required type.
> This PR cleanups such places to more shorter call `T[] 
> Collection.toArray(T[])`.

Changes in the desktop module looks fine.

-

Marked as reviewed by serb (Reviewer).

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


RFR: 8271456: Avoid looking up standard charsets in "java.desktop" module

2021-08-01 Thread Sergey Bylokhov
This is a request to clean up a desktop module as was done in JDK-8233884 for 
"java.base" module.

In many places standard charsets are looked up via their names, for example:
absolutePath.getBytes("UTF-8");

This could be done more efficiently(x20 time faster) with use of 
java.nio.charset.StandardCharsets:
absolutePath.getBytes(StandardCharsets.UTF_8);

The later variant also makes the code cleaner, as it is known not to throw 
UnsupportedEncodingException in contrary to the former variant.

Tested by the desktop headless/headful tests on linux/windows.

-

Commit messages:
 - Initial fix for JDK-8271456

Changes: https://git.openjdk.java.net/jdk/pull/4951/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk=4951=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8271456
  Stats: 641 lines in 28 files changed: 276 ins; 237 del; 128 mod
  Patch: https://git.openjdk.java.net/jdk/pull/4951.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/4951/head:pull/4951

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