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

Eliminate ambiguities while parsing non-static class creator

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 4.0.0-beta-1, 3.0.9
    • None
    • None

    Description

                  public class Computer {
                      public class Cpu {
                          int coreNumber
                          public Cpu(int coreNumber) {
                              this.coreNumber = coreNumber
                          }
                      }
                  }
      
                  def coreNumber = new Computer().new Cpu(4).coreNumber // `new` will be parsed as a method name, but it's wrong
                  assert 4 == coreNumber
      

      Attachments

        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: