groovy

Unexpected newline error in method declaration

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 1.0-JSR-6
  • Component/s: parser-antlr
  • Labels:
    None
  • Environment:
    Groovy Version: 1.0-RC-01-SNAPSHOT JVM: 1.5.0_06-b05
  • Number of attachments :
    0

Description

class Something {
static void something()
throws IllegalArgumentException { }
}
>>unexpected token: <newline> @ line 2, column 24.

At the moment, 'throws' must be on the first line of the method declaration to avoid the error.

Activity

Hide
blackdrag blackdrag added a comment -

that one is really hard to reproduce, because the newline may not be copied correctly. You should attach a file

Show
blackdrag blackdrag added a comment - that one is really hard to reproduce, because the newline may not be copied correctly. You should attach a file
Hide
Edward Povazan added a comment -

Interesting. A little while ago, I thought I would look into it myself, but couldn't reproduce it, so I assumed you had fixed it, just not updated the issue yet. There was nothing magical about it - if I hit enter, and then continued to write 'throws ...' I had compile errors.
Is it possible this was fixed by some side effect of another fix?

Show
Edward Povazan added a comment - Interesting. A little while ago, I thought I would look into it myself, but couldn't reproduce it, so I assumed you had fixed it, just not updated the issue yet. There was nothing magical about it - if I hit enter, and then continued to write 'throws ...' I had compile errors. Is it possible this was fixed by some side effect of another fix?
Hide
blackdrag blackdrag added a comment -

Sounds like it was in the Eclipse plugin. I don't think it is fixed... or maybe? would be a strange side effect. I made some changes to the grammar affecting newlines... ahhh.. yes I remember! In fact there was a bug in the grammar about the throws in a new line. That is fixed now... Ok, so I think I can close it then

Show
blackdrag blackdrag added a comment - Sounds like it was in the Eclipse plugin. I don't think it is fixed... or maybe? would be a strange side effect. I made some changes to the grammar affecting newlines... ahhh.. yes I remember! In fact there was a bug in the grammar about the throws in a new line. That is fixed now... Ok, so I think I can close it then

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: