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

Static Member Access Error by ClassName

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0-JSR-2, 1.0-JSR-3, 1.0-JSR-4
    • 1.0-JSR-5
    • None
    • None

    Description

      The attached test file "IsClassTestCase.groovy" works fine on JSR-01 or
      JSR-02 or JSR-03 or CVS HEAD (JSR-04-SNAPSHOT).

      The attached test file "IsClassTestMain.groovy" works fine on JSR-01,
      but it fails on JSR-02 or JSR-03 or CVS HEAD (JSR-04-SNAPSHOT).

      The generated error message is:
      C:\test> groovy IsClassTestMain.groovy
      IsClassTestMain.groovy: 6: StaticSomeClass is declared in a dynamic context, but
      you tried to access it from a static context.
      @ line 6, column 18.
      println( StaticSomeClass instanceof java.lang.Class ) // does not work in main() since JSR-02
      ^

      1 Error

      Attachments

        1. IsClassTestMain2.groovy
          0.9 kB
          Kim, Pilho
        2. IsClassTestMain.groovy
          0.5 kB
          Kim, Pilho
        3. IsClassTestCase.groovy
          0.4 kB
          Kim, Pilho

        Activity

          People

            blackdrag Jochen Theodorou
            phkim Kim, Pilho
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: