On Sat, 11 Jul 2026 13:18:39 GMT, Marius Hanl <[email protected]> wrote:
>> Maybe something we could check in a follow up?
>> If I understand the author correctly, it is not 100% clear if this is needed
>> or not
>
> 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.
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/2167#discussion_r3564249819