summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2013-09-09 10:06:00 +0200
committerJason Zaugg <jzaugg@gmail.com>2013-09-10 01:34:00 +0200
commitbf0f9da50983941b8575ffae284d9c90de886020 (patch)
treeb7464c8f529f0be94600a0b72c824607301cfb33 /test
parent7fa0e60c47a05f335ab890ef182769699263b3ce (diff)
downloadscala-bf0f9da50983941b8575ffae284d9c90de886020.tar.gz
scala-bf0f9da50983941b8575ffae284d9c90de886020.tar.bz2
scala-bf0f9da50983941b8575ffae284d9c90de886020.zip
SI-7825 Consider DEFAULTMETHOD when refchecking concreteness
A class should not be required to implement a Java default method. This commit uses `isDeferredNotDefault` in place of `isDeferred` when finding unimplemented methods. The test itself does not depend on Java 8 as we use scalac's Java source parser to set things up.
Diffstat (limited to 'test')
-rw-r--r--test/files/run/t7825.scala34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/files/run/t7825.scala b/test/files/run/t7825.scala
new file mode 100644
index 0000000000..65ca06fdfc
--- /dev/null
+++ b/test/files/run/t7825.scala
@@ -0,0 +1,34 @@
+import scala.tools.partest._
+
+object Test extends CompilerTest {
+ import global._
+
+ override lazy val units: List[CompilationUnit] = {
+ // We can test this on JDK6.
+ javaCompilationUnits(global)(defaultMethodSource) ++ compilationUnits(global)(scalaExtendsDefault)
+ }
+
+ private def defaultMethodSource = """
+public interface Iterator<E> {
+ boolean hasNext();
+ E next();
+ default void remove() {
+ throw new UnsupportedOperationException("remove");
+ }
+}
+ """
+
+ private def scalaExtendsDefault = """
+object Test {
+ object X extends Iterator[String] {
+ def hasNext = true
+ def next = "!"
+ }
+}
+ """
+
+ // We're only checking we that the Scala compilation unit passes refchecks
+ // No further checks are needed here.
+ def check(source: String, unit: global.CompilationUnit): Unit = {
+ }
+}