groovy

Can't Use a Closure with Method Reordering

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Not A Bug
  • Affects Version/s: 1.6-beta-1
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Testcase included:
    yes
  • Number of attachments :
    0

Description

Based on GROOVY-3006 (http://jira.codehaus.org/browse/GROOVY-3006), I'd expect this to work:

void custom(Map args, Object base, Object[] varargs, def body) {
println args.dump()
println base.dump()
println varargs.dump()
body()
}

custom(Integer.class, 1, 2, 3, 4, 5, foo:"Bar", baz:42) {
println "Ran the body!"
}

However, this explodes with the following error:

groovy.lang.MissingMethodException: No signature of method: Script2.custom() is applicable for argument types: (java.util.LinkedHashMap, java.lang.Class, java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.Integer, Script2$_run_closure1) values: {[foo:Bar, baz:42], class java.lang.Integer, 1, 2, 3, 4, 5, Script2$_run_closure1@c5200a}

Changing the signature to "void custom(Map args, Object base, Object[] varargs, Closure body)" doesn't help, either.

Activity

Hide
Robert Fischer added a comment -
Show
Robert Fischer added a comment - See GROOVY-30006 and http://groovy.codehaus.org/Extended+Guide+to+Method+Signatures
Hide
Robert Fischer added a comment -
Show
Robert Fischer added a comment - GROOVY-3006

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: