summaryrefslogtreecommitdiff
path: root/test/files/run/t10059/Test.scala
diff options
context:
space:
mode:
authorLukas Rytz <lukas.rytz@gmail.com>2016-11-16 11:25:20 +0100
committerLukas Rytz <lukas.rytz@gmail.com>2016-11-16 11:31:20 +0100
commitcc3bd35d024524f697907dd7a68fde22420407eb (patch)
treeacf68bc529426765ca2beb2379a7447257c53815 /test/files/run/t10059/Test.scala
parent10c609e750a7089055b126e6231e5ddb2f2e8623 (diff)
downloadscala-cc3bd35d024524f697907dd7a68fde22420407eb.tar.gz
scala-cc3bd35d024524f697907dd7a68fde22420407eb.tar.bz2
scala-cc3bd35d024524f697907dd7a68fde22420407eb.zip
SI-10059 reset the `DEFERRED` flag for Java varargs forwarders
When an abstract method is annotated `@varargs`, make sure that the generated synthetic Java varargs method does not have the `DEFERRED` flag (`ACC_ABSTRACT` in bytecode). The flag lead to an NPE in the code generator, because the ASM framework leaves certain fields `null` for abstract methods (`localVariables` in this case). Interestingly this did not crash in 2.11.x: the reason is that the test whether to emit a method body or not has changed in the 2.12 backend (in c8e6050). val isAbstractMethod = [..] methSymbol.isDeferred [..] // 2.11 val isAbstractMethod = rhs == EmptyTree // 2.12 So in 2.11, the varargs forwarder method was actually left abstract in bytecode, leading to an `AbstractMethodError: T.m([I)I` at run-time.
Diffstat (limited to 'test/files/run/t10059/Test.scala')
-rw-r--r--test/files/run/t10059/Test.scala9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/files/run/t10059/Test.scala b/test/files/run/t10059/Test.scala
new file mode 100644
index 0000000000..7bbb623e74
--- /dev/null
+++ b/test/files/run/t10059/Test.scala
@@ -0,0 +1,9 @@
+abstract class T {
+ @annotation.varargs def m(l: Int*): Int
+}
+class C extends T {
+ override def m(l: Int*): Int = 1
+}
+object Test extends App {
+ assert(A.foo(new C) == 1)
+}