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

Boolean constants don't support ".class" like Numbers do.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.0-beta-5
    • 1.0-JSR-1
    • parser
    • None

    Description

      Using the groovysh, one can use the ".class" or ".getClass()" methods on numbers and Strings like so

      >println "String".class
      >go
      class java.lang.String

      >println 1.0.class
      >go
      class java.lang.BigDecimal

      but not boolean's
      >println true.class
      groovysh script: 1: could not use 'true' at 1:9: literal connot directly follow another expression
      println true.class
      ^

      This strikes me as inconsistent especially since
      >b = true
      >println b.class
      >go
      class java.lang.Boolean

      works.

      Attachments

        Activity

          People

            blackdrag Jochen Theodorou
            erikhusby Erik Husby
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: