Because the compiler team at Oracle didn't bother implementing type inference for the second situation, but did it for the first situation (where the type can be inferred from the variable the expression is assigned to).
Java 8 comes with large improvements in terms of type inference, so I wouldn't be surprised if it compiled with the Java 8 compiler.