On Fri, 19 Apr 2024 20:24:38 GMT, Chen Liang <[email protected]> wrote:

>> I replaced reflection with using an accessor
>> @azuev-java please review
>
> src/java.desktop/share/classes/sun/swing/SwingAccessor.java line 331:
> 
>> 329:         var access = accessibleJTreeNodeCreateAccessor;
>> 330:         if (access == null) {
>> 331:             ensureClassInitialized(JTree.class);
> 
> This probably doesn't work as JTree class initialization does not seem to 
> trigger AccessibleJTree class initialization. The other one for 
> AccessibleJTreeNode is dubious too, maybe it just happens that all accesses 
> are correctly made only after the related classes are initialized.

This line calls the ```ensureClassInitialized()``` method, which performs a 
full initialization of the class... It calls: 
```MethodHandles.lookup().ensureInitialized()```, which, as stated in the 
documentation , performs a full initialization.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18867#discussion_r1574478565

Reply via email to