groovy

Problem compiling static initialiser

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.1-beta-1
  • Fix Version/s: 1.1-beta-2
  • Labels:
    None
  • Testcase included:
    yes
  • Number of attachments :
    1

Description

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

Activity

Hide
Alexandru Popescu added a comment -

Fixed in r6298.

Show
Alexandru Popescu added a comment - Fixed in r6298.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: