Uploaded image for project: 'Scala Programming Language'
  1. Scala Programming Language
  2. SI-4884

getClass.getName doesn't return a real java.lang.String with correct replace and replaceAll behaviour

    Details

    • Type: Bug
    • Status: CLOSED
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: Scala 2.9.0-1
    • Fix Version/s: None
    • Component/s: Library (Misc)
    • Labels:
      None
    • Environment:

      Windows 7 Home Premium 32 bit SP1
      Scala version 2.9.1.RC1 (Java HotSpot(TM) Client VM, Java 1.7.0)

      Description

      getClass.getName doesn't return a real java.lang.String because replace and replaceAll don't work properly

      scala> class A {
           |  val b = new B
           |  class B {
           |  val c = new C
           |  class C {
           |  }
           |  }
           |  }
      defined class A
       
      scala> val a = new A
      a: A = A@19e0bcf
       
      scala> val c = a.b.c
      c: a.b.C = A$B$C@90dbc4
       
      scala> c.getClass.getName.replace("$","#")
      res60: java.lang.String = #line92.#read##iw##iw#A#B#C
       
      scala> c.getClass.getName.replaceAll("[$]","#")
      res61: java.lang.String = #line92.#read##iw##iw#A#B#C
      

      Expected behaviour:

      scala> "A$B$C".replace("$","#")
      res0: java.lang.String = A#B#C
       
      scala> "A$B$C".replaceAll("[$]","#")
      res1: java.lang.String = A#B#C
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                extempore Paul Phillips
                Reporter:
                davescala DaveScala
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: