langtools/test/tools/javac/defaultMethods/private/Private06.java
changeset 29293 1583c6dd6df7
equal deleted inserted replaced
29292:c10d63c667cd 29293:1583c6dd6df7
       
     1 /* @test   /nodynamiccopyright/
       
     2  * @bug    8071453
       
     3  * @author sadayapalam
       
     4  * @summary Test that a lone private interface method cannot supply the SAM.
       
     5  * @compile/fail/ref=Private06.out -XDrawDiagnostics Private06.java
       
     6  */
       
     7 
       
     8 public class Private06 {
       
     9     @FunctionalInterface
       
    10     interface NAFI {
       
    11         private void foo() {
       
    12         }
       
    13     }
       
    14 
       
    15     @FunctionalInterface
       
    16     interface FI {
       
    17         void foo(NAFI nafi);
       
    18     }
       
    19 
       
    20     public static void main(String [] args) {
       
    21         Private06.NAFI nafi = () -> {};
       
    22         Private06.FI fi = Private06.NAFI::foo; // OK.
       
    23     }
       
    24 }
       
    25 
       
    26 class Private06_01 {
       
    27     public static void main(String [] args) {
       
    28         Private06.FI fi = Private06.NAFI::foo; // NOT OK.
       
    29     }
       
    30 }