diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2016-05-19 16:23:23 +1000 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@typesafe.com> | 2016-05-19 08:23:23 +0200 |
commit | 41c9a17e4f211fc24a931949a0819a0474cc004a (patch) | |
tree | 314788b6edb0286f3effb982204ba918a938d6c2 /test | |
parent | 07a8b197b93a6de54c890a7ee37254decc568880 (diff) | |
download | scala-41c9a17e4f211fc24a931949a0819a0474cc004a.tar.gz scala-41c9a17e4f211fc24a931949a0819a0474cc004a.tar.bz2 scala-41c9a17e4f211fc24a931949a0819a0474cc004a.zip |
Generate static forwarders for object members in companion interface (#5131)
We used to disable generation of static forwarders when a object had a
trait as a companion, as one could not add methods with bodies to an
interface in JVM 6.
The JVM lifted this restriction to support default methods in interfaces,
so we can lift the restriction on static forwarders, too.
Fixes https://github.com/scala/scala-dev/issues/59
Diffstat (limited to 'test')
-rw-r--r-- | test/files/run/trait-static-forwarder.check | 1 | ||||
-rw-r--r-- | test/files/run/trait-static-forwarder/Test.java | 5 | ||||
-rw-r--r-- | test/files/run/trait-static-forwarder/forwarders.scala | 5 |
3 files changed, 11 insertions, 0 deletions
diff --git a/test/files/run/trait-static-forwarder.check b/test/files/run/trait-static-forwarder.check new file mode 100644 index 0000000000..d81cc0710e --- /dev/null +++ b/test/files/run/trait-static-forwarder.check @@ -0,0 +1 @@ +42 diff --git a/test/files/run/trait-static-forwarder/Test.java b/test/files/run/trait-static-forwarder/Test.java new file mode 100644 index 0000000000..89012c0162 --- /dev/null +++ b/test/files/run/trait-static-forwarder/Test.java @@ -0,0 +1,5 @@ +public final class Test { + public static void main(String... args) { + System.out.println(T.foo()); + } +} diff --git a/test/files/run/trait-static-forwarder/forwarders.scala b/test/files/run/trait-static-forwarder/forwarders.scala new file mode 100644 index 0000000000..d6ee9a081d --- /dev/null +++ b/test/files/run/trait-static-forwarder/forwarders.scala @@ -0,0 +1,5 @@ +trait T + +object T { + def foo = 42 +} |