Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.6.3
-
None
-
None
Description
If you define a java method with an interface typed varargs parameter and call this method with at least two different subclasses from groovy, you get an IllegalArgumentException.
Here is the interface:
Ifc.java
public interface Ifc {}
the two classes:
ClsA.java
public class ClsA implements Ifc{}
ClsB.java
public class ClsB implements Ifc{}
the method with varargs:
public class TestJava { public static void meth(Ifc...ifcs){ System.out.println(ifcs.length); } }
the call:
TestJava.meth(new ClsA(),new ClsB())
Works from java but throws an IllegalArgumentException from groovy.
Interestingly, if Ifc is a class, everything works as expected.