Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-4683 static import collection task
  3. GROOVY-4287

CLONE - import of static nested classes in external groovy files is broken

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.7.3
    • 2.5.6, 3.0.0-beta-1
    • Compiler
    • None

    Description

      Splitting off problematic but critical case of resolving static nested and inner classes in external groovy files from GROOVY-4267. Copying Roshan's example from that issue:

      Test.groovy
      import static Outer.*
      // import static Outer.Inner // also fails
      // import Outer.Inner        // also fails
      
      assert Inner.class.name != null
      
      Outer.groovy
      class Outer {
          static class Inner {}
      }
      

      Output:

      Caught: groovy.lang.MissingPropertyException: No such property: Inner for class: Test
              at Test.run(Test.groovy:4)
      

      Error message is slightly different for non-static import:

      org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
      Test.groovy: 2: unable to resolve class Outer.Inner
       @ line 2, column 1.
         import Outer.Inner
         ^
      1 error
      

      Attachments

        Issue Links

          Activity

            People

              daniel_sun Daniel Sun
              paulk Paul King
              Votes:
              5 Vote for this issue
              Watchers:
              4 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 - 0.5h
                  0.5h