changeset 3416:11ed38d8765b

8047407: Add test for JDK-8037385 Reviewed-by: mcimadamore
author dlsmith
date Fri, 20 Jun 2014 11:42:16 -0600
parents 9b187f24c709
children 173f27d6e81f
files test/tools/javac/defaultMethods/static/StaticInvoke.java test/tools/javac/defaultMethods/static/StaticInvoke6.out test/tools/javac/defaultMethods/static/StaticInvoke7.out
diffstat 3 files changed, 21 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/defaultMethods/static/StaticInvoke.java	Fri Jun 20 11:42:16 2014 -0600
@@ -0,0 +1,15 @@
+/* @test /nodynamiccopyright/
+ * @bug 8037385
+ * @summary Must not allow static interface method invocation in legacy code
+ * @compile -source 8 -Xlint:-options StaticInvoke.java
+ * @compile/fail/ref=StaticInvoke7.out -source 7 -Xlint:-options -XDrawDiagnostics StaticInvoke.java
+ * @compile/fail/ref=StaticInvoke6.out -source 6 -Xlint:-options -XDrawDiagnostics StaticInvoke.java
+ */
+import java.util.stream.Stream;
+
+class StaticInvoke {
+    void test() {
+        Stream.empty();
+        java.util.stream.Stream.empty();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/defaultMethods/static/StaticInvoke6.out	Fri Jun 20 11:42:16 2014 -0600
@@ -0,0 +1,3 @@
+StaticInvoke.java:12:15: compiler.err.static.intf.method.invoke.not.supported.in.source: 1.6
+StaticInvoke.java:13:32: compiler.err.static.intf.method.invoke.not.supported.in.source: 1.6
+2 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/defaultMethods/static/StaticInvoke7.out	Fri Jun 20 11:42:16 2014 -0600
@@ -0,0 +1,3 @@
+StaticInvoke.java:12:15: compiler.err.static.intf.method.invoke.not.supported.in.source: 1.7
+StaticInvoke.java:13:32: compiler.err.static.intf.method.invoke.not.supported.in.source: 1.7
+2 errors