Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Information Provided
-
2.4.15
-
None
Description
The following simplified example compiles and executes, foo() returning false and bar() returning null.
@CompileStatic class Pojo { boolean foo() { } Object bar() { } }
With @CompileStatic enabled I would've expected sensible feedback from the compiler, example:
error: missing return statement
This symptom was discovered in a much larger method, where one branch was missing a return statement.
I'm suggesting adding some sensible feedback in this type of scenario, in-order to support developers relying on @CompileStatic for sanity checking. This would adhere to the principle of least astonishment, as locating this type of logical error can be time-consuming.