Issue Details (XML | Word | Printable)

Key: GROOVY-1807
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Jochen Theodorou
Reporter: Emmanuel
Votes: 1
Watchers: 1
Operations

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

Groovy fails to call varargs method signatures when an empty arg list is supplied

Created: 29/Mar/07 07:11 PM   Updated: 01/Jul/07 05:38 PM
Component/s: syntax
Affects Version/s: 1.0
Fix Version/s: 1.1-beta-2

Time Tracking:
Not Specified

Environment: JDK 5.0 Apple Inc


 Description  « Hide
//Java code
public class FacesMessages implements Serializable
{
   //vargars signature
   public void add(String messageTemplate, Object... params)
   {
      ...
   }
...
}

//From an other class
//This piece of code fails in Groovy, work in Java
   void invalid()
   {
      facesMessages.add("Please try again")
   }


 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Paul King added a comment - 20/Jun/07 06:57 PM - edited
I have another example using Guice. The Guice class has the following methods:
public static Injector createInjector(Module... modules) { /* compiled code */ }    
public static Injector createInjector(java.lang.Iterable<Module> iterable) { /* compiled code */ }
...

I have to call Guice.createInjector([]) or Guice.createInjector({} as Module) but in Java I can call Guice.createInjector().


Jochen Theodorou added a comment - 01/Jul/07 05:38 PM
there are two special paths in MetaClassHelper for method calls, one is for methods with no arguments and one is for methods with 1 null argument. It seems both had bugs and I fixed them. As for the original issue... I was unable to reproduce it. facesMessages.add("Please try again") is not called with one of the paths I corrected, it is no method call without arguments, and the argument is not null.

I close this bug for now, if it is still a problem please reopen it with a testcase, because I won't be able to reproduce the problem without it