Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-916

Confusing error message when creating inner class without outer instance

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Won't Fix
    • 1.0-JSR-2
    • 1.0-JSR-2
    • None
    • None

    Description

      With the following in X.java:
      public class X {
      public class Y

      { int z; }

      }
      and the following in mytest.groovy:
      def x = new X.Y()
      I get:
      Caught: groovy.lang.GroovyRuntimeException: failed to invoke constructor: public X$Y(X) with arguments: [] reaso
      n: java.lang.IllegalArgumentException: wrong number of arguments

      The code is incorrect, either Y should be static or we should use an instance of X in the new(). But the error message could be better.

      This is http://jira.codehaus.org/browse/GROOVY-910 with a more appropriate title.

      Attachments

        Activity

          People

            blackdrag Jochen Theodorou
            mcspanky Martin C. Martin
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: