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

Key: GROOVY-1462
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Paul King
Reporter: Russel Winder
Votes: 0
Watchers: 0
Operations

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

Parsing quoted method name fails if there is no modifier

Created: 16/Aug/06 12:11 PM   Updated: 08/Feb/08 01:26 AM
Component/s: None
Affects Version/s: None
Fix Version/s: 1.5.2

Time Tracking:
Not Specified

Environment: Ubuntu 6.06 LTS Dapper Drake, JDK 1.5.0_05, Groovy Revision 3983


 Description  « Hide
The script:

class stringMethodName {
Integer 'flob' ( ) {
}
}

fails with the message:

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, stringMethodName.groovy: 2: unexpected token: Integer @ line 2, column 3.
Integer 'flob' ( ) {
^

1 error

If any combination of modifiers is put before the Integer, for example:

class stringMethodName {
public Integer 'flob' ( ) {
}
}

then compilation is successful.



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Andres Almiray - 27/Nov/07 04:56 PM
The following blow too
class StringMethodName {
  Integer 'flob'() {}
  def 'foo'() {} // blows
  private boolean 'fooBoolean'() { false }
  public int 'fooInt'() { 1 }
  public def 'fooDef'() {}
}

Seems like quoted method names only work for those methods that
a) have an access modifier
b) return a non-primitive, non-def value


Paul King - 10/Jan/08 07:31 AM
Groovy should behave more consistently across these cases now - just be warned that you can still only have legal Java identifier names between the quotes.

It would be interesting to have a way of handling method name mangling, e.g. so 'my method' went to 'my$method' or '$$my$space$method' in the Java bytecode.


Paul King - 08/Feb/08 01:26 AM
close off release 1.5.4