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

Key: GROOVY-1087
Type: Bug Bug
Status: Open Open
Priority: Minor Minor
Assignee: Unassigned
Reporter: Dierk Koenig
Votes: 0
Watchers: 0
Operations

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

when ctor takes a single Closure parameter, parentheses cannot be omitted

Created: 11/Oct/05 04:33 AM   Updated: 27/Nov/07 12:25 AM
Component/s: syntax
Affects Version/s: 1.0-JSR-3
Fix Version/s: None

Time Tracking:
Not Specified

File Attachments: 1. File ClosureInConstructorTest.groovy (0.7 kb)


Testcase included: yes


 Description  « Hide
t = new Thread({println 'hi'})
t = new Thread(){println 'hi'}
works but
t = new Thread {println 'hi'}
does not
____
groovy> t = new Thread {println 'hi'}
groovy> go
CommandLine.groovy: -1: PARSER BUG: Tried to configure org.codehaus.groovy.ast.expr.ArgumentListExpression with null Nod
e. File: CommandLine.groovy @ line -1, column -1.
1 Error

 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Andres Almiray - 27/Nov/07 12:25 AM
Attached testcase, the compiler now barfs with

[java] c:\development\codehaus.org\groovy-trunk\groovy\groovy-core\build.xml:225: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, c:\development\codehaus.org\groovy-trunk\groovy\groovy-core\src\test\groovy\bugs\ClosureInConstructorTest.groovy: 16: unexpected token: { @ line 16, column 34.
[java] def bean = new BeanBug1087 { it }