The Philosophy of Nothing

Paul Benedict pbenedict at apache.org
Mon Nov 30 21:08:35 PST 2009


Some questions about Nothing that the spec may want to address:

1) How can the compiler absolutely prove that "statements or expressions 
cannot complete normally"? I imagine that can only be done if a "throw" 
is literally found in the method body. Can't method calls prevent the 
inference?

2) Outside of the whole closure conversation, can java.lang.Nothing be 
used? And is there value in it? For example:
class Test {
   public Nothing throw_it() {
     throw new AssertionError();
   }
}

3) In regards to byte-code manipulation, what would happen at runtime if 
a class transformer takes the body of method that cannot return normally 
("returns" java.lang.Nothing) and actually returns? The opposite case 
must be considered too. Would a JVM error be thrown?

Paul


More information about the closures-dev mailing list