Grails

Calling a method with typed params including Class doesn't work

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Cannot Reproduce
  • Affects Version/s: 1.0.1
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Environment:
    I believe this affected grails 1.0RC1 too. It didn't affect grails 0.6. Note the groovy language differed between these releases.
  • Testcase included:
    yes

Description

See the testcase. If you've got a taglib closure and say you want to call a convenience method in the taglib that is not a tag. That convenience method is not a closure, just a regular instance method. And lets say in Java style you decided to type the parameters to this convenience method to make it clear what the type is. And lets say one of the parameters is of type Class. If you try to call the method, you'll get an error saying that, basically, no method was found matching the signature. If you untype the parameter declaration for the method, or don't use Class (other types seem to work), it'll work. It'll also work if the method is static.

This is an odd bug, and I suspect (though don't know) the behavior occurs for Controllers too.

I worked around this by removing the type info from the parameter declaration. Despite it being easy, it took me quite a long time to find the problem.

Activity

Hide
Burt Beckwith added a comment -

works in 1.2.1

Show
Burt Beckwith added a comment - works in 1.2.1

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: