On Sat, 11 Jul 2026 13:38:52 GMT, Marius Hanl <[email protected]> wrote:
>> 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
I like this new approach. We can get rid of the `ArrayListWrapper` and it will
still works as expected. Since you have created another PR, what should I do
now with mine? I can apply same changes (removing `ArrayListWrapper`) or close
this one and keep yours.
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/2167#discussion_r3564472686