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

Hash code for Symbol changes across JVM invocations

    Details

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

      x86_64 Linux - Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_26

      Description

      The hashCode for instances of Symbol changes across JVM invocations (similar to behavior of None in SI-4752). Here is what I see:

      $ scala
      Welcome to Scala version 2.9.1.final (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_26).
      Type in expressions to have them evaluated.
      Type :help for more information.
      
      scala> 'mysymbol.hashCode
      res0: Int = 1606987090
      
      scala> 'mysymbol.hashCode
      res1: Int = 1606987090
      
      
      $ scala
      Welcome to Scala version 2.9.1.final (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_26).
      Type in expressions to have them evaluated.
      Type :help for more information.
      
      scala> 'mysymbol.hashCode
      res0: Int = 1340276317
      
      scala> 'mysymbol.hashCode
      res1: Int = 1340276317
      

        Activity

        Hide
        Commit Message Bot added a comment -

        (extempore in r25791) Consistent hashCode for Symbol.

        Use the string's hashcode so it is stable across jvm restarts.
        Closes SI-5056, no review.

        Show
        Commit Message Bot added a comment - (extempore in r25791 ) Consistent hashCode for Symbol. Use the string's hashcode so it is stable across jvm restarts. Closes SI-5056 , no review.

          People

          • Assignee:
            Paul Phillips
            Reporter:
            Mike Mintz
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development