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

Cannot call private member of containing class in @CS

    XMLWordPrintableJSON

Details

    Description

      class C {
      
          private C() {}
          private privateMethod() {}
      
          def anonymousUsage() {
              new Runnable() {
                  @groovy.transform.CompileStatic
                  @Override
                  void run() {
                      privateMethod()
                      new C()
                  }
              }
          }
      }

      Expected: code is compiled without errors.
      Actual: 2  errors:
      Cannot call private method C#privateMethod from class C$1
      Cannot call private constructor for C from class C$1

      Note that Java compiles the same code just fine.

      Attachments

        Issue Links

          Activity

            People

              emilles Eric Milles
              daniilo Daniil Ovchinnikov
              Votes:
              0 Vote for this issue
              Watchers:
              2 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 - 0.5h
                  0.5h