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

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

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.0.0-alpha-4
    • Fix Version/s: 3.0.0-beta-1
    • Component/s: None
    • Labels:
      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

              • Assignee:
                daniel_sun Daniel Sun
                Reporter:
                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 - 20m
                  20m