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

コンパイラで、クロージャから静的クラス変数を参照できない.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Duplicate
    • 3.0.4, 2.5.12
    • 4.0.0-alpha-1, 3.0.5, 2.5.13
    • Compiler
    • None
    • groovy-3.0.4, jdk-14.0.1

    Description

      /*
      ERROR:Groovyc: While compiling XXX: BUG!
      exception in phase 'class generation' in source unit 'Test.groovy'
      Trying to access private field [Test1#foo] from inner class
       */
      class Test1 {
      //    boolean foo // OK
          static boolean foo // Ng
      }
      class Test2 extends Test1 {
          def bar() {
              Closure baz = {
                  assert foo // Compilation error
              }
          }
      }
      

      Attachments

        Activity

          People

            emilles Eric Milles
            awk4j Kunio Himei
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: