why does this throw an exception?
messageSource.getMessage('UserService.msg.forgot.unknown', ["test@mail.com"], null)
unless I do this…
def Object[] args = ["test@mail.com"]
messageSource.getMessage('UserService.msg.forgot.unknown', args, null)
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Because [“test@mail.com”] evaluates to an ArrayList, not an array:
OTOH your declaration creates an array of Objects:
and the method you’re calling needs an array. You can create an array using
as:The Groovy creators made a point of making higher-level data structures like lists idiomatic, while arrays are present for interoperability with Java.
In his interview in Coders at Work Guy Steele talks about choices made in designing a language:
It certainly looks like Groovy made lists more concise, with the side effect that arrays became more verbose.