Details

    • Type: Sub-task Sub-task
    • Status: Open Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: groovy-runtime
    • Labels:
      None
    • Environment:
      mac 10.5.2 java.1.5 Groovy Version: 1.1-rc-2 JVM: 1.5.0_13-119
    • Number of attachments :
      0

      Description

      class CP implements Comparable
      {
      int number

      int compareTo(obj)

      { println 'compareTo called' return number - obj.number }

      boolean equals(obj)

      { println 'equals called' return obj.number = number }

      }

      // script
      def cp1 = new CP(number:1)
      def cp2 = new CP(number:2)
      cp1==cp2

      // results
      if CP implements Comparable, compareTo is called, if not, equals is called

      // using grails with above as follows has ominous implications

      I have a setup similar to as follows:
      TopLevelDomainClass

      { SortedSet subLevels static hasMany= [subLevels:SubLevelDomainClass] }

      SubLevelDomainClass implements Comparable
      {
      int number
      int compareTo(obj)

      { return this.number - obj.number }

      }

      sublevel1==sublevel2 calls the compareTo function for evaluation

        Activity

        blackdrag blackdrag made changes -
        Field Original Value New Value
        Issue Type Bug [ 1 ] Sub-task [ 7 ]
        Parent GROOVY-2756 [ 66231 ]
        Hide
        Alberto Brandolini added a comment -

        I am on a Mac too, and I run into the same issue, when I changed my classes to implement the Comparable interface.

        I suspect the OS isn't to be blamed, since this bug looks a lot like
        http://jira.codehaus.org/browse/GROOVY-2334

        I'll do some checks on a different OS anyway.

        Show
        Alberto Brandolini added a comment - I am on a Mac too, and I run into the same issue, when I changed my classes to implement the Comparable interface. I suspect the OS isn't to be blamed, since this bug looks a lot like http://jira.codehaus.org/browse/GROOVY-2334 I'll do some checks on a different OS anyway.
        blackdrag blackdrag made changes -
        Component/s groovy-runtime [ 16250 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Brian White
          • Votes:
            5 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

            • Created:
              Updated: