-
Notifications
You must be signed in to change notification settings - Fork 21
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
Incorrect bytecode generated for StringOps.minBy/maxBy #6554
Comments
Imported From: https://issues.scala-lang.org/browse/SI-6554?orig=1 |
Ramnivas Laddad (ramnivas) said: |
@adriaanm said: the only workaround i can think of is to exclude the methods with generic signatures that trip up aspectj from your pointcuts it's not technically a regression, and not a blocker (since it has a workaround), so not something we should fix in RC mode unfortunately, it would break binary compatibility, so we'll have to defer until 2.11.x |
@gkossakowski said: |
@gkossakowski said: trait Foo[A] {
def minBy[B](b: B): A = ???
}
class Bar extends Foo[Int] The generic signature of It's interesting to observe what happens when we manually move implementation to trait Foo[A] {
def minBy[B](b: B): A
}
class Bar extends Foo[Int] {
def minBy[B](b: B): Int = ???
} In that case we get two |
@gkossakowski said: I have a hard time understanding how Moreover, I learnt about Foo.scala:5: warning: compiler bug: created generic signature for method minBy in Bar that does not conform to its erasure
signature: <B:Ljava/lang/Object;>(TB;)I
original type: [B](b: Object)Int
normalized type: [B](b: Object)Int
erasure type: (b: Object)Object
if this is reproducible, please report bug at http://issues.scala-lang.org/
class Bar extends Foo[Int] {
^
[Now checking: jvm]
one warning found |
@gkossakowski said:
I think generating additional bridges is the way to go but we'll have to be careful about breaking existing code. I'm guessing we would need to introduce the logic behind a switch and try it out on various projects to asses how likely it is we are breaking existing code. This is 2.12 material. |
Ramnivas Laddad (ramnivas) said: It appears that any fix for this will take at least two releases--one to introduce a fix behind a flag and then make that flag default. If this doesn't get any kind of fix in 2.11, it will be at least another couple of years before there is a final fix. Given how long this has stayed open (and the original #4214 that was reported three years back) with no definitive approach in sight and backwards compatibility argument only getting stronger with (hopefully) increased Scala adoption, come 2.12, I fear it may not have any better chance of getting fixed. |
@retronym said: |
@retronym said: More details: |
(This is against 2.10.0-RC1, but JIRA doesn't offer that choice)
It looks like #4214 is resurrected.
While trying to weave in an AspectJ aspect, I got a VerifyError. Upon closer examination, it looks like the bytecode generated for StringOps.minBy (and StringOps.maxBy) is incorrect. Here is a simple Java program that shows the issue (a small variation of one reported in #4214).
The text was updated successfully, but these errors were encountered: