diff options
author | Grzegorz Kossakowski <grzegorz.kossakowski@gmail.com> | 2014-09-18 09:26:31 +0200 |
---|---|---|
committer | Grzegorz Kossakowski <grzegorz.kossakowski@gmail.com> | 2014-09-18 09:26:31 +0200 |
commit | 8e1efc3549c081b0305df26e6963b49174b1f402 (patch) | |
tree | aa1abcd2f128c54a6d56eeed3da96348e8350f5a /test/files | |
parent | 2c23a5e70288c4b00c8c06c6ae5b6e65eede6ac0 (diff) | |
parent | 17a1abbff6816d0693bb98869cd26c25f695cffa (diff) | |
download | scala-8e1efc3549c081b0305df26e6963b49174b1f402.tar.gz scala-8e1efc3549c081b0305df26e6963b49174b1f402.tar.bz2 scala-8e1efc3549c081b0305df26e6963b49174b1f402.zip |
Merge pull request #3989 from retronym/ticket/8852
SI-8852 Support joint compilation of Java interfaces w. statics
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/run/t8852a.scala | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/test/files/run/t8852a.scala b/test/files/run/t8852a.scala new file mode 100644 index 0000000000..cbff8ab75b --- /dev/null +++ b/test/files/run/t8852a.scala @@ -0,0 +1,34 @@ +import scala.tools.partest._ + +// Test that static methods in Java interfaces (new in Java 8) +// are callable from jointly compiler Scala code. +object Test extends CompilerTest { + import global._ + + override lazy val units: List[CompilationUnit] = { + // This test itself does not depend on JDK8. + javaCompilationUnits(global)(staticMethodInInterface) ++ + compilationUnits(global)(scalaClient) + } + + private def staticMethodInInterface = """ +public interface Interface { + public static int staticMethod() { + return 42; + } +} + + """ + + private def scalaClient = """ +object Test { + val x: Int = Interface.staticMethod() +} + +class C extends Interface // expect no errors about unimplemented members. + + """ + + // We're only checking we can compile it. + def check(source: String, unit: global.CompilationUnit): Unit = () +} |