History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: GROOVY-2571
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Unassigned
Reporter: Tord Alenljung
Votes: 0
Watchers: 2
Operations

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

Omitted parentheses for method starting with capital letter causes compile time exception

Created: 04/Feb/08 02:48 AM   Updated: 01/May/08 04:56 PM
Component/s: syntax
Affects Version/s: 1.5.2, 1.5.3, 1.5.4
Fix Version/s: 1.5.7, 1.6-beta-2

Time Tracking:
Not Specified


 Description  « Hide
Parentheses cannot be omitted for methods starting with capital letter. MultipleCompilationErrorsException is raised during compilation. I would guess that the bug was introduced with 1.5.2, but I haven't checked it out. It has worked before anyway.

Example:

def AMethod(s) {
    println s
}
def anotherMethod(s) {
    println s
}
AMethod('groovy1') //Ok
anotherMethod 'groovy2' //Ok
AMethod 'groovy3' //compile time exception

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, Script18: 9: unexpected token: groovy3 @ line 9, column 9.
1 error

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, Script18: 9: unexpected token: groovy3 @ line 9, column 9.
1 error



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Jochen Theodorou - 04/Feb/08 03:45 PM
I doubt it is introduced in 1.5.2 I think this issue was already in 1.0

Tord Alenljung - 05/Feb/08 01:56 AM
I just tried it in 1.5.1, and it worked fine. It definitely worked in 1.0.

Paul King - 05/Feb/08 07:32 AM
In groovy 1.0 through 1.5.1, what you have works but something like this fails:
// instead of AMethod 'groovy3'
def baz = 'groovy3'
AMethod baz

It fails because it is being treated as a method definition.

I think Groovy 1.5.2+ is also treating this additional case as a method definition (an incomplete one I guess).