Fri, 22 Feb 2013 13:31:35 +0000
8008337: Write test to check for compiler error when static method in interface is called via super()
Reviewed-by: mcimadamore
Contributed-by: sonali.goel@oracle.com
test/tools/javac/lambda/StaticMethodNegTest.java | file | annotate | diff | comparison | revisions | |
test/tools/javac/lambda/StaticMethodNegTest.out | file | annotate | diff | comparison | revisions |
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/test/tools/javac/lambda/StaticMethodNegTest.java Fri Feb 22 13:31:35 2013 +0000 1.3 @@ -0,0 +1,26 @@ 1.4 +/** 1.5 + * @test /nodynamiccopyright/ 1.6 + * @bug 8008337 1.7 + * @author sogoel 1.8 + * @summary static method is called via super 1.9 + * @compile/fail/ref=StaticMethodNegTest.out -XDrawDiagnostics StaticMethodNegTest.java 1.10 + */ 1.11 + 1.12 +interface A { 1.13 + static String m() { 1.14 + return "A"; 1.15 + } 1.16 +} 1.17 + 1.18 +interface B { 1.19 + static String m() { 1.20 + return "B"; 1.21 + } 1.22 +} 1.23 + 1.24 +interface AB extends A, B { 1.25 + static String m() { 1.26 + return A.super.m(); 1.27 + } 1.28 +} 1.29 +
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/test/tools/javac/lambda/StaticMethodNegTest.out Fri Feb 22 13:31:35 2013 +0000 2.3 @@ -0,0 +1,2 @@ 2.4 +StaticMethodNegTest.java:23:12: compiler.err.not.encl.class: A 2.5 +1 error