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

failures when resolving collection properties with the IBM jdk

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Not A Problem
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:
      Linux, Groovy 1.6.5 1.6.8 1.7.1

      Description

      There are some inconstancies in how Groovy works on the Sun and IBM jdk in regards to accessing properties on the collection object versus the properties of the contents of a collection.

      Consider the following groovy script

      List<String> list = new ArrayList<String>();
      list.add("hello");
      list.add("world");
      print list.size

      On the Sun jdk this will output '2' as the result for list.size, on the IBM jdk it will fail with the following error

      groovy.lang.MissingPropertyException: Exception evaluating property 'size' for java.util.ArrayList, Reason: groovy.lang.MissingPropertyException: No such property: size for class: java.lang.String
      at ConsoleScript8.run(ConsoleScript8:4)

      Changing the value to list.size() does make it work on both JDKs

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              mwringe Matt Wringe
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: