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

Name mangling has outstripped the abilities of lonesome '$$'

    Details

      Description

      I think if I set my mind to it I could construct a lot more examples than this, but any number of collisions are too many. Is there any other character which could be utilized during mangling? It looks like this situation may improve in the future, as somewhat discussed here:

      http://blogs.sun.com/jrose/entry/symbolic_freedom_in_the_vm

      Regardless, I think it would be worth figuring out something better which works on java 5. There's simply no way so many different things can be encoded with dollar signs and have it all come out clean in the wash.

      class A_+
      class A_ { class plus }
      

      This will give you a probably random choice of A_+ and A#plus in your A_$$plus.class file.

      scala> val a = new A_
      a: A_ = A_@33d88c1f
      
      scala> new a.plus
      java.lang.NoSuchMethodError: A_$$plus.<init>(LA_;)V
      	at .<init>(<console>:6)
      

      See also SI-1994, where dragos says "This has to do with the mangling scheme for class protected members, which needs to be changed."

        Issue Links

          Activity

          Hide
          Iulian Dragos added a comment -

          Please reassign, I am not going to work on this, even though I might have had something to say about it as some point. There's simply no way I can keep on fixing bugs that are unrelated to either the optimizer or specialization while writing my thesis.

          Show
          Iulian Dragos added a comment - Please reassign, I am not going to work on this, even though I might have had something to say about it as some point. There's simply no way I can keep on fixing bugs that are unrelated to either the optimizer or specialization while writing my thesis.
          Hide
          Paul Phillips added a comment -

          I can totally respect that. Focus on your thesis. I wanted to get a handle on this one anyway.

          Show
          Paul Phillips added a comment - I can totally respect that. Focus on your thesis. I wanted to get a handle on this one anyway.
          Hide
          Simon Ochsenreither added a comment -

          This works for me in Scala 2.9.0.r24145-b20110130020134:

          scala> class A_+
          defined class A_$$plus
          
          scala> class A_ { class plus }
          defined class A_
          
          scala> val a = new A_
          a: A_ = A_@35235feb
          
          scala> new a.plus
          res1: a.plus = A_$$plus@66176ccc
          
          Show
          Simon Ochsenreither added a comment - This works for me in Scala 2.9.0.r24145-b20110130020134: scala> class A_+ defined class A_$$plus scala> class A_ { class plus } defined class A_ scala> val a = new A_ a: A_ = A_@35235feb scala> new a.plus res1: a.plus = A_$$plus@66176ccc
          Hide
          Paul Phillips added a comment -

          This is not fixed. Please don't close my tickets.

          Show
          Paul Phillips added a comment - This is not fixed. Please don't close my tickets.

            People

            • Assignee:
              Unassigned
              Reporter:
              Paul Phillips
              TracCC:
              Erik Engbrecht, Paul Phillips, Simon Ochsenreither
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:

                Development