On Sun, 12 Jul 2026 17:43:33 GMT, Petr Štechmüller <[email protected]> wrote:

>> ProxyBuilder is used by the FXML loader to instantiate classes whose 
>> constructors are annotated with `@NamedArg`. When such a class also exposes 
>> a read-only `Map` property (e.g. getProperties() — the same pattern used by 
>> `javafx.scene.Node`), setting child elements under that property in FXML 
>> caused incorrect behaviour or a runtime error.
>> 
>> **Root cause:** _getReadOnlyProperty()_ always returned an 
>> `ArrayListWrapper` regardless of the actual **getter** return type. When the 
>> getter returns a `Map`, an `ArrayListWrapper` is the wrong container and the 
>> entries are never transferred to the real map on the object.
>> 
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Petr Štechmüller has updated the pull request incrementally with two 
> additional commits since the last revision:
> 
>  - Code cleanup
>  - Enable disabled test

modules/javafx.fxml/src/test/java/test/com/sun/javafx/fxml/builder/ClassWithPlainSetAndScalarArg.java
 line 63:

> 61:         return childList;
> 62:     }
> 63: }

missing newline

modules/javafx.fxml/src/test/java/test/com/sun/javafx/fxml/builder/ProxyBuilderTest.java
 line 365:

> 363:         assertEquals("expectedValue", result.child,
> 364:                 "ProxyBuilder must unwrap the first temporary ArrayList 
> element "
> 365:                         + "and pass it as the scalar @NamedArg 
> constructor argument");

minor: some funky indentation.

also, we probably should avoid concatenation in tests - these run million times 
over and over, consuming electricity ;-)  a shorter distinct message might 
suffice.

modules/javafx.fxml/src/test/resources/test/javafx/fxml/hash_set_scalar_arg.fxml
 line 41:

> 39:         <String fx:value="hello"/>
> 40:     </child>
> 41: </ClassWithPlainSetAndScalarArg>

missing newline

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

PR Review Comment: https://git.openjdk.org/jfx/pull/2167#discussion_r3573574935
PR Review Comment: https://git.openjdk.org/jfx/pull/2167#discussion_r3573591811
PR Review Comment: https://git.openjdk.org/jfx/pull/2167#discussion_r3573596099

Reply via email to