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

Bad class generation when trying to instantiate an inner class within a static method

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • None
    • None
    • None

    Description

      The first constructor call is OK. The second constructor call is thought to be in a static context and the argument is replaced with it's class.

      class Foo {
        class Bar { }
        static void main(args) {
          new Bar(new Foo()) // OK, matches Foo$Bar(Foo)
          new Foo().with {
            new Bar(this) // GRE: trying to match Foo$Bar(java.lang.Class)
          }
        }
      }
      

      It isn't specific to with. You could use any, every, etc.

      Attachments

        Activity

          People

            emilles Eric Milles
            paulk Paul King
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: