Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Duplicate
-
Affects Version/s: 1.7-beta-2
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
Description
For me, this INCORRECTLY compiles:
interface I { String s }
Execution in 1.7beta2 groovyconsole gives:
groovy> interface I { groovy> String s groovy> } groovy> println I.s null
I smell a bug...
For Java, the rule is: "Every field in the body of an interface must have an initialization expression,..."
(http://java.sun.com/docs/books/jls/second_edition/html/interfaces.doc.html)
Issue Links
- is related to
-
GROOVY-3830
java.lang.IncompatibleClassChangeError thrown with Interface containing variable
-
I reduced the priority to "minor", because this is no bug that is causing any problems. I am even tempted to change this into an improvement. Even though we want to be near Java, we don't have to follow all rules. We don't require final local variables for inner classes and don't make full generics checks. We do not even have static type based method preselection.
So for me the first question is why we absolutely have to do this check. Can you answer this?