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

method signature for == operator overload

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Won't Fix
    • 1.0-beta-4
    • 1.0-beta-6
    • None
    • None
    • Mac OS X, java 1.4.2

    Description

      It is unclear and inconsistent of what the method signature should be for overloading the == operator. Here is a mailing list posting regarding this issue:

      > For example, this does not work:
      >
      > class A {
      > String b = "hi"
      > equals(A a)

      { > println "hello from equals()" > return (b == a.b) > }

      > }
      >
      > a1 = new A()
      > a2 = new A()
      >
      > println a1 == a2

      Okay, I'm an idiot. That does parse as expected. The problem is
      with the equals method signature:
      boolean equals( a )

      will work. I tried several other combinations and only this one
      worked.
      So, it probably is a bug, and you should go ahead and report it.

      Thanks,
      Chris.

      Attachments

        Activity

          People

            spullara Sam Pullara
            johnstump John Stump
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: