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

Empty primitive arrays evaluate to true

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 1.7.3
    • Fix Version/s: 1.7.4, 1.8-beta-1
    • Component/s: Compiler
    • Labels:
      None

      Description

      In contrast to other empty collections, empty primitive arrays evaluate to true:

      def x = [] as int[]
      assert !x // fails!
      

      Empty non-primitive arrays behave as expected:

      def x = [] as String[]
      assert !x // passes
      

        Attachments

        1. GROOVY-4312.patch
          4 kB
          Peter Niederwieser

          Activity

            People

            • Assignee:
              guillaume Guillaume Sauthier
              Reporter:
              pniederw Peter Niederwieser
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: