Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.7.3
-
Fix Version/s: 1.7.4, 1.8-beta-1
-
Component/s: Compiler
-
Labels:None
-
Number of attachments :
Description
The following code compiles in 1.7.2, but not in 1.7.3:
private enum EnumWithToString { VALUE String toString() { "I'm a value" } }
groovyc output:
unexpected token: VALUE @ line 337, column 3.
VALUE
^
1 error
The compile error goes away when adding a semicolon after "VALUE".
Activity
Paul King
made changes -
| Field | Original Value | New Value |
|---|---|---|
| Attachment | groovy4268_enum_regression.patch [ 49878 ] |
Roshan Dawrani
made changes -
| Comment |
[ I am still testing the patch, but there is a point I wanted to raise in the meanwhile.
Grammar change made in r19830 (which is now being patched) enabled the use of annotations on the enum constants, but those annotations are absolutely ignored beyond grammar at this point of time. So, it is now possible to give code like below and it happily gets compiled as compiler doesn't do anything on XXX, YYY except allowing them as source tokens: {code} enum Enum { @XXX(YYY) A } {code} My question is whether this partial introduction of annotations on enum constants on purpose or accidental. ] |
Paul King
made changes -
| Status | Open [ 1 ] | Resolved [ 5 ] |
| Assignee | Paul King [ paulk ] | |
| Fix Version/s | 1.8-beta-1 [ 16013 ] | |
| Fix Version/s | 1.7.4 [ 16563 ] | |
| Resolution | Fixed [ 1 ] |
Paul King
made changes -
| Status | Resolved [ 5 ] | Closed [ 6 ] |