You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Daniel Hammer (JIRA)" <ji...@apache.org> on 2018/08/29 08:25:00 UTC
[jira] [Created] (GROOVY-8770) CompileStatic ignores missing return
statement
Daniel Hammer created GROOVY-8770:
-------------------------------------
Summary: CompileStatic ignores missing return statement
Key: GROOVY-8770
URL: https://issues.apache.org/jira/browse/GROOVY-8770
Project: Groovy
Issue Type: Bug
Components: Static compilation
Affects Versions: 2.4.15
Reporter: Daniel Hammer
The following simplified example compiles and executes, foo() returning {{false}} and bar() returning {{null}}.
{code:java}
@CompileStatic
class Pojo {
boolean foo() {
}
Object bar() {
}
}
{code}
With {{@CompileStatic}} enabled I would've expected sensible feedback from the compiler, example:
{quote}error: missing return statement
{quote}
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.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)