Issue Details (XML | Word | Printable)

Key: GROOVY-1874
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Alexandru Popescu
Reporter: Robert Stroud
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
groovy

Problem compiling static initialiser

Created: 03/May/07 02:57 PM   Updated: 30/Nov/07 08:36 PM
Component/s: command line processing
Affects Version/s: 1.1-beta-1
Fix Version/s: 1.1-beta-2

Time Tracking:
Not Specified

File Attachments: 1. File Test.groovy (0.1 kB)


Testcase included: yes


 Description  « Hide
The Groovy compiler gives a compile error for a static initialiser, unless the { appears on the same line as static...

In other words,

static {
// do something
}

compiles, but

static
{
// do something else
}

gives a compile error.

For example, the attached file gives a compile error:

$ groovy Test.groovy
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, Test.groovy: 3: unexpected token: static @ line 3, column 3.
static
^

1 error



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Alexandru Popescu added a comment - 08/May/07 05:41 PM
Fixed in r6298.