CeylonList, CeylonMap, etc should offer additional constructors for dealing with null
I suppose we need, for example, CeylonList.withNullElements()
Moving to 1.2.3
Random thoughts:
I might prefer the opposite: make the programmer assert non-nullness by using a special constructor. But I guess it's too late to consider that.
Conceptually (but not a serious suggestion), it seems that Java T should map to Ceylon T¿, with ¿ indicating that the special interop null rules should apply. Of course, the benefit would be limited unless assigning List<T¿> to List<T> were disallowed, which would be inconvenient.
Currently, the wrappers expose a type hole that looks like the code below (imagine nextItem being in CeylonIterator):
T nextItem<T>(JIterator<T> it) => it.next();
value l = JArrayList<String>();
l.add(null);
Object s = nextItem(l.iterator());
print((s of Anything) is Null); // true
It might be nice for the wrappers to perform null checks, since the compiler can't, since the compiler doesn't know whether or not nulls are legal in functions that look like nextItem.
The problem is that this would cost us a reified check to determine if Element is nullable unless we relied on the constructor that was used. But, doing that would result in unwanted null checks for CeylonList<String?>(...).