> Using trickery I can make a List<Nothing> with nulls in it, and then write >>> return thisHackedList.get(0), which means in practice that Nothing needs >>> type checking (i.e. that would lead to a ClassCastException or similar, >>> even if .get(0) returns null). >>> >> Is this just theorizing? I'd love to see that code. >> > What code? It's trivial: > > List<Nothing> list = new ArrayList<Nothing>(); > list.add(null); //Barring compiler magic, this will compile and run > without error. > Real code: val list: List[Nothing] = null :: Nil //Oh wait ... that doesn't compile, because null is not of type Nothing.
> Nothing y = null; // Compiler magic required to make this invalid. > That's as much as Integer foo = new Object(); needs "compiler magic". > See the other recent debate. >> > 'the other recent debate'? - this forum has lots of threads. This thread > has lots of posts. You're going to have to be more specific. > The debate about people pulling a "Java is the most popular thing ever, therefore everything it does is right" response as soon as they run out of arguments. -- You received this message because you are subscribed to the Google Groups "Java Posse" group. To view this discussion on the web visit https://groups.google.com/d/msg/javaposse/-/SrgkvwYyi-oJ. To post to this group, send email to javaposse@googlegroups.com. To unsubscribe from this group, send email to javaposse+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/javaposse?hl=en.