Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
As discussed here:
http://groovy.329449.n5.nabble.com/CompileStatic-breaking-vararg-call-resolution-td5718966.html
There seem to be at least two bug-like symptoms when using @CompileStatic, for resolving Constructors and for resolving methods.
```
import groovy.transform.CompileStatic
@CompileStatic
public class Starter {
public static void main(String[] args)
public Starter(Class<?>... classes)
{System.out.println("Classes");}public Starter(String... strings)
{System.out.println("Strings");}static def foo(Class... cs)
{ "Classes" }static def foo(String... ss)
{ "Strings" }}
```
When run like this, prints "Strings", should print "Classes" as it does without @CompileStatic.
When commenting out the call to foo, Should print "Classes", "Classes", instead currently does not compile:
```
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
/tmp/Starter.groovy: 8: [Static type checking] - Cannot call Starter#foo(java.lang.String[]) with arguments [java.lang.Class <java.util.List>, java.lang.Class <java.util.Map>]
@ line 8, column 9.
foo (List.class, Map.class)
```