Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-5989 Inner Class Issues
  3. GROOVY-6301

Static inner classes not visible to child classes

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.1.6, 2.2.0-beta-1, 2.1.7, 2.2.0
    • 2.4.0-beta-3
    • class generator
    • None

    Description

      Classes that extend another class with static inner classes are unable to see the inner classes without including the parent class name as part of the class reference.

      Example:

      class X {
          static class Y {}
      }
      
      class Z extends X {
          Z() {
              Y y = new Y();
          }
      }
      

      The compiler fails to compile "Z" saying it cannot resolve class "Y"; however, it will accept "X.Y y = new X.Y()".

      The child class should not have to reference the parent class directly to get to its inner classes, should it?

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              nmccloud Kenneth Gendron
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: