1 /*
 2  * @test /nodynamiccopyright/
 3  * @bug 8279901
 4  * @summary Javac should verify/ensure that a Functional interface implements neither IdentityObject nor ValueObject
 5  * @compile/fail/ref=FunctionalInterfaceTest.out -XDrawDiagnostics -XDdev FunctionalInterfaceTest.java
 6  */
 7 
 8 public class FunctionalInterfaceTest {
 9 
10     @FunctionalInterface
11     interface I extends IdentityObject  { // Error
12         void m();
13     }
14 
15     @FunctionalInterface
16     interface J extends I  {} // Error.
17 
18     @FunctionalInterface
19     interface K extends ValueObject  { // Error
20         void m();
21     }
22 
23     interface L extends IdentityObject {
24         void m();
25     }
26 
27     interface M extends ValueObject {
28         void m();
29     }
30 
31     void foo() {
32         var t = (L) () -> {}; // Error
33         var u = (M) () -> {}; // Error
34     }
35 }