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

Fail to resolve non-static inner class outside of outer class

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.0.0-alpha-4
    • 3.0.0-beta-1
    • None
    • None

    Description

      
      public class Computer {
          public class Cpu {
              int coreNumber
      
              public Cpu(int coreNumber) {
                  this.coreNumber = coreNumber
              }
          }
          public static newInstance() {
              return new Computer().new Cpu(4)
          }
      }
      
      assert 4 == new Computer().new Cpu(4).coreNumber // unable to resolve class Cpu 
      // assert 4 == Computer.newInstance().coreNumber // resolve class Cpu successfully
      

      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 - 2h 20m
                  2h 20m