Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
scabug opened this issue Dec 16, 2009 · 10 comments
Open

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

scabug opened this issue Dec 16, 2009 · 10 comments

Comments

@scabug
Copy link

scabug commented Dec 16, 2009

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 #1994, where dragos says "This has to do with the mangling scheme for class protected members, which needs to be changed."

@scabug
Copy link
Author

scabug commented Dec 16, 2009

Imported From: https://issues.scala-lang.org/browse/SI-2806?orig=1
Reporter: @paulp
See #1994

@scabug

This comment has been minimized.

@scabug

This comment has been minimized.

@scabug
Copy link
Author

scabug commented Feb 13, 2011

@soc said (edited by @milessabin on Jun 22, 2016 2:34:48 PM UTC):
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

@scabug

This comment has been minimized.

@scabug

This comment has been minimized.

@scabug

This comment has been minimized.

@scabug

This comment has been minimized.

@scabug

This comment has been minimized.

@SethTisue
Copy link
Member

recent discussion in this area, in the Dotty repo: scala/scala3#5936

it seems rather unlikely that Scala 2 will see any further change in this area, unless it comes in 2.14 as part of an overall scalac/dotc alignment effort

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants