-
Notifications
You must be signed in to change notification settings - Fork 21
Java 1.8.0_131 breaks some super
calls inside 2.12 lambdas
#10290
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
Comments
Update 131 release notes: http://www.oracle.com/technetwork/java/javase/8u131-relnotes-3565278.html, and the full fix list is at http://www.oracle.com/technetwork/java/javase/2col/8u131-bugfixes-3565760.html. surprisingly, I see nothing relevant in either place (nor did Miles) |
community build is all green, so it seems this won't cause widespread breakage. whew |
Minimized: trait A {
def f() = println("A")
}
class B extends A {
class C {
def c() = B.super[A].f()
}
}
object Test {
def main(args : Array[String]) : Unit = {
val b = new B()
new b.C().c()
}
} |
It seems that check was added here: http://hg.openjdk.java.net/jdk8u/jdk8u/hotspot/rev/0b85ccd62409#l11.66 |
We have
I wonder why this worked before: |
Indeed, on the older JVMs, a slightly modified version leads to an
|
So in a way that's good news: the code we generate was wrong and would only not crash in the most trivial cases (on old JVMs). The difference on 1.8.0_131 is only for those trivial cases (now they crash as well). |
Also to note: it's a regression in 2.12, 2.11 correctly uses the
|
Consider class B extends T { class C { B.super[T].f }} After flatten, that call is ` B$C.this.$outer().super[T].f()`. In 2.11, mixin translates this to `A$class.f(B$C.this.$outer())`. In 2.12, the tree is passed unchanged to the backend. In `genApply` we assumed that in `Apply(Select(Super(qual, ... )))`, `qual` is a `This` tree, so we just emitted `ALOAD_0`, which caused the `$outer()` call to get lost. Now we invoke `genLoad(qual)`. Fixes scala/bug#10290.
Consider class B extends T { class C { B.super[T].f }} After flatten, that call is ` B$C.this.$outer().super[T].f()`. In 2.11, mixin translates this to `A$class.f(B$C.this.$outer())`. In 2.12, the tree is passed unchanged to the backend. In `genApply` we assumed that in `Apply(Select(Super(qual, ... )))`, `qual` is a `This` tree, so we just emitted `ALOAD_0`, which caused the `$outer()` call to get lost. Now we invoke `genLoad(qual)`. Fixes scala/bug#10290.
Consider class B extends T { class C { B.super[T].f }} After flatten, that call is ` B$C.this.$outer().super[T].f()`. In 2.11, mixin translates this to `A$class.f(B$C.this.$outer())`. In 2.12, the tree is passed unchanged to the backend. In `genApply` we assumed that in `Apply(Select(Super(qual, ... )))`, `qual` is a `This` tree, so we just emitted `ALOAD_0`, which caused the `$outer()` call to get lost. Now we invoke `genLoad(qual)`. Fixes scala/bug#10290.
I'm still seeing this on 2.13.x ... is the forward port of the fix still pending? |
Yes, it's here: scala/scala#5997 |
as reported by @milessabin, and reproduced by myself and @dwijnand,
test/files/run/t4300.scala
(#4300) andtest/files/run/t8803.scala
(#8803) are failing now on Java 8 Update 131 with e.g.java.lang.IllegalAccessError: Receiver class Test$$anon$1 must be the current class or a subtype of interface A
I haven't isolated the exact circumstances, but both tests involve
super
within lambdasThe text was updated successfully, but these errors were encountered: