On Sat, 11 Jul 2026 13:27:10 GMT, Marius Hanl <[email protected]> wrote:
>> I replaced `ArrayListWrapper` with a plain `ArrayList` and everything still
>> works and is green.
>
> trying out `ClassWithPlainCollectionAndScalarArg` with a `Set` like this:
>
>
> public class ClassWithPlainCollectionAndScalarArg {
>
> public final String child;
> private final Set<String> childList = new HashSet<>();
>
> public ClassWithPlainCollectionAndScalarArg(@NamedArg("child") String
> child) {
> this.child = child;
> }
>
> public Set<String> getChild() {
> return childList;
> }
> }
>
>
> the test fail again because this is not handled by `ArrayListWrapper`.
>
> Which makes we wonder, should we instead do the following in `ProxyBuilder`
> (L518-524):
>
>
> if (Collection.class.isAssignableFrom(val.getClass())) { // instead
> of ArrayListWrapper.class.equals(val.getClass())
> Collection<?> col = (Collection<?>) val;
> return col.iterator().next();
> }
>
>
> and return a normal `ArrayList` instead of the wrapper (L206-218):
>
>
> if (ObservableArray.class.isAssignableFrom(retType)) {
> return new ArrayList<>(); // instead of ArrayListWrapper
> }
>
> if (Map.class.isAssignableFrom(retType)) {
> return new LinkedHashMap<>();
> }
> if (Set.class.isAssignableFrom(retType)) {
> return new LinkedHashSet<>();
> }
> if (Collection.class.isAssignableFrom(retType)) {
> return new ArrayList<>(); // instead of ArrayListWrapper
> }
>
>
> all tests are green, no `ArrayListWrapper` needed and the `HashSet` case is
> also fixed.
I created https://github.com/openjdk/jfx/pull/2209 with the changes I described
here so you can check the diff.
This is the commit with the changes:
https://github.com/openjdk/jfx/pull/2209/changes/c1f95fa29de540e10c143d101ac21e586a008a10
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/2167#discussion_r3564267064