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

Fail to resolve nested type defined in base type written in Groovy

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 3.0.0-rc-1
    • None
    • None

    Description

      file Base.groovy:

      package groovy.bugs.groovy9243
      
      class Base {
          static class X {}
      }
      

      file Main.groovy:

      package groovy.bugs.groovy9243
      
      class Groovy9243 extends Base {
          def accessX() {
              assert new X()
          }
      }
      
      new Groovy9243().accessX()
      

      compile Main.groovy with groovyc: unable to resolve class X

      Here is a workaround:
      file Main.groovy:

      package groovy.bugs.groovy9243
      
      class Groovy9243 extends Base {
          def accessX() {
              assert new Base.X()  // qualify the type name
          }
      }
      
      new Groovy9243().accessX()
      

      Attachments

        Issue Links

          Activity

            People

              daniel_sun Daniel Sun
              daniel_sun Daniel Sun
              Votes:
              0 Vote for this issue
              Watchers:
              1 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 - 10m
                  10m