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

cannot access public static attributes called "Class"

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.0-JSR-3
    • 1.0-JSR-4
    • None
    • None
    • tested on Linux

    Description

      Given the class

      class SomeClass {
      // this is the inaccessible static attribute called "Class"
      public static Object Class = null;
      }

      if we try to access the "Class" static attribute from a Groovy script, it won't work.

      An actual example is the com.hp.hpl.jena.vocabulary.OWL class in the jena.sf.net project.

      Here's the test script also attached to this issue:

      import com.hp.hpl.jena.vocabulary.*

      println OWL.class
      println OWL.Class
      println OWL."Class"
      println OWL.@Class

      ... here's the output:
      class com.hp.hpl.jena.vocabulary.OWL
      class java.lang.Class
      class java.lang.Class
      Caught: groovy.lang.MissingFieldException: No such field: Class for class: java.lang.Class

      The expected behaviour would be calling OWL.Class and getting the value of the attribute.

      Attachments

        1. testowl.groovy
          0.1 kB
          Adrian Petru Dimulescu

        Issue Links

          Activity

            People

              phkim Kim, Pilho
              dimulescu Adrian Petru Dimulescu
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: