The compiler does only a very trivial static analysis and that's by design. Static analysis can get smarter over time and you surely don't want the code to stop compiling when you switch to an older compiler version.
Another reason is keeping the compiler fast. Smart analysis is important for optimizations, but its' costly. Optimizations are not the job of javac (they happen at runtime), so javac doesn't bother.
It doesn't even recognize trivial cases like
int f(boolean b) {
if (b) {
return 1;
} else if (!b) {
return 0;
}
}
The rules are specified in the JLS Chapter Definite Assignment.