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

Cannot resolve array of inner class from type in same package (no import)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.0.0-alpha-3, 2.5.0, 3.0.0, 3.0.1
    • 4.0.0-alpha-1, 3.0.5, 2.5.16
    • None
    • None

    Description

      Two files in the 'pkg' package:

      MyClass.groovy
      package pkg 
      class HasClass { static class MyClass {} }
      

       

      HasClass.groovy
      package pkg
      private static void foo(HasClass.MyClass... val) {}
      //pkg.HasClass.MyClass[] val // Also Fails
      //pkg.HasClass.MyClass val // Does not fail
      

      Results in the following error:
       

      /home/ianl/IdeaProjects/VariousGroovy/src/main/groovy/pkg/UsesClass.groovy: 3: unable to resolve class HasClass.MyClass[] 
       @ line 3, column 25.
         private static void foo(HasClass.MyClass... val) {}
                                 ^
      

      This fails only for arrays, not single references. It does not occur if the files are in the default package.

      It is also possible to work around it with a static import:
       

      HasClass.groovy
      package pkg
      import static HasClass.MyClass // Now it doesn't fail
      private static void foo(MyClass... val) {}
      

      Attachments

        Activity

          People

            emilles Eric Milles
            tofor Ian
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 40m
                40m