Scala Programming Language
  1. Scala Programming Language
  2. SI-4807

Case class and Proxy equals behaviour in Scala 2.9 is incorrect

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: Scala 2.9.0
    • Fix Version/s: Scala 2.9.2, Scala 2.10.0
    • Component/s: Misc Library
    • Labels:
      None
    • Environment:

      Scala 2.9

      Description

      In Scala 2.9 a case class is not equal to itself (even the same instance) if it inherits from Proxy. In Scala 2.8 this is not the case.

      The discussion here describes it:
      http://stackoverflow.com/questions/6667654/case-classes-and-proxy-behaviour-in-scala-2-9

      This is causing us huge trouble as we have to:

      • rewrite any of our case classes that inherit (even indirectly) from Proxy
      • not use any library case classes that have Proxy in their inheritance tree

      It has made using case classes a unsafe thing to do unless you are sure nothing they inherit from has Proxy, or will ever have Proxy, in its inheritance tree. What's worse is that this problem is causing our code to fail at runtime in very unexpected ways. If this behaviour is by design the least I would expect is some compiler warnings.

      Thanks

        Activity

        Hide
        Paul Phillips added a comment -

        Definitely not by design. Overall issue looks like it has tricky aspects, but it's never correct that something isn't equal to itself.

        Show
        Paul Phillips added a comment - Definitely not by design. Overall issue looks like it has tricky aspects, but it's never correct that something isn't equal to itself.
        Hide
        Commit Message Bot added a comment -

        (extempore in r25642) Helping Proxy equal itself.

        Fix for bumpy proxy equals. Closes SI-4807, no review.

        Show
        Commit Message Bot added a comment - (extempore in r25642 ) Helping Proxy equal itself. Fix for bumpy proxy equals. Closes SI-4807 , no review.
        Hide
        David Corcoran added a comment -

        Hi Paul. You fixed this a while ago but the 'Fix Version' is still None. Is that correct? Has this not be included in a release? Thanks

        Show
        David Corcoran added a comment - Hi Paul. You fixed this a while ago but the 'Fix Version' is still None. Is that correct? Has this not be included in a release? Thanks
        Hide
        Paul Phillips added a comment -

        It hasn't been in a released version yet. It should have said "unreleased 2.10" already; I backported it to 2.9.x since you brought it up, so now it will be in 2.9.3 as well.

        Show
        Paul Phillips added a comment - It hasn't been in a released version yet. It should have said "unreleased 2.10" already; I backported it to 2.9.x since you brought it up, so now it will be in 2.9.3 as well.
        Hide
        David Corcoran added a comment -

        That's great news. Thanks

        Show
        David Corcoran added a comment - That's great news. Thanks

          People

          • Assignee:
            Paul Phillips
            Reporter:
            David Corcoran
          • Votes:
            2 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development