A curiosity that I've just noticed, rather than a problem.
I'm not allowed to write
public boolean x() {
return null;
}
or this:
public boolean x() {
if (DEBUG) {
return true;
} else {
return null;
}
}
but I am allowed to write
public boolean x() {
return DEBUG ? true : null;
}
Why is this? (It appears to throw an NPE if the "else" branch is taken.)