groovy
  1. groovy
  2. GROOVY-4112

Joint compilation fails if Groovy method with array parameter is called in vararg style from Java

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.8-beta-1
    • Fix Version/s: 1.8.1, 1.7.11
    • Component/s: Compiler
    • Labels:
      None
    • Number of attachments :
      0

      Description

      Foo.groovy:

      class Foo {
        static foo(String[] args) {}
      }
      

      Bar.java:

      public class Bar {
        public static void main(String[] args) {
          Foo.foo("one", "two", "three");
        }
      }
      

      This compiles fine separately, but with joint compilation I get:

      org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
      Compile error during compilation with javac.
      Bar.java:3: foo(java.lang.String[]) in Foo cannot be applied to (java.lang.String,java.lang.String,java.lang.String)
      		Foo.foo("a", "b", "c");
      		       ^
      1 error
      

      I suppose stub generation is to blame.

        Activity

        Hide
        Paul King added a comment -

        Java stubs now have vararg looking types if the last parameter's type is an array. Any additional testing you can do would be gaeatly appreciated.

        Show
        Paul King added a comment - Java stubs now have vararg looking types if the last parameter's type is an array. Any additional testing you can do would be gaeatly appreciated.

          People

          • Assignee:
            Paul King
            Reporter:
            Peter Niederwieser
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: