test/tools/javac/T8059921/ForbidAccessToFieldUsingSuperTest.java

Mon, 24 Nov 2014 14:55:38 -0800

author
vromero
date
Mon, 24 Nov 2014 14:55:38 -0800
changeset 2610
f4df97bf5392
permissions
-rw-r--r--

8059921: Missing compile error in Java 8 mode for Interface.super.field access
Reviewed-by: mcimadamore, jlahoda

     1 /*
     2  * @test /nodynamiccopyright/
     3  * @bug 8059921
     4  * @summary Missing compile error in Java 8 mode for Interface.super.field access
     5  * @compile/fail/ref=ForbidAccessToFieldUsingSuperTest.out -XDrawDiagnostics ForbidAccessToFieldUsingSuperTest.java
     6  */
     8 public class ForbidAccessToFieldUsingSuperTest {
     9     class C {
    10         int m() { return 0; }
    11     }
    13     interface T {
    14         int f = 0;
    15         C c = null;
    16         default int mm() {
    17             return 0;
    18         }
    19     }
    21     interface T1 extends T {}
    23     class X implements T1 {
    24         int i = T1.super.f;        //fail
    25         int j = T1.super.c.m();    //fail
    27         void foo(Runnable r) {
    28             foo(T1.super::mm);     //should'n fail
    29         }
    30     }
    31 }

mercurial