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

references to ".class" do not work if full qualified class name is used - will always evaluate to "java.lang.Class.class"

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 1.0-beta-9
    • None
    • None
    • CVS HEAD

    Description

      ----- SNIP -----
      import java.util.ArrayList
      import java.util.Hashtable

      cls=java.util.ArrayList.class

      println(cls)

      if ( java.util.ArrayList.class == java.util.Hashtable.class ) {
      println "test1:not good"
      } else {
      println "test1:good"
      }

      if ( ArrayList.class == Hashtable.class ) {
      println "test2:not good"
      } else {
      println "test2:good"
      }
      ----- SNIP -----

      Output:
      class java.lang.Class
      test1:not good
      test2:good

      All ".class" references evaluate to "java.lang.Class.class" if not imported.

      Attachments

        Activity

          People

            blackdrag Jochen Theodorou
            jakob Jakob Frank
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: