Sat, 22 Dec 2018 13:10:38 -0800
Added tag jdk8u202-b25 for changeset 15d8c732039b
aoqi@0 | 1 | /* |
aoqi@0 | 2 | * @test /nodynamiccopyright/ |
aoqi@0 | 3 | * @summary smoke test for functional interface annotation |
aoqi@0 | 4 | * @compile/fail/ref=FunctionalInterfaceAnno.out -XDrawDiagnostics FunctionalInterfaceAnno.java |
aoqi@0 | 5 | */ |
aoqi@0 | 6 | class FunctionalInterfaceAnno { |
aoqi@0 | 7 | @FunctionalInterface |
aoqi@0 | 8 | static class A { } //not an interface |
aoqi@0 | 9 | |
aoqi@0 | 10 | @FunctionalInterface |
aoqi@0 | 11 | static abstract class B { } //not an interface |
aoqi@0 | 12 | |
aoqi@0 | 13 | @FunctionalInterface |
aoqi@0 | 14 | enum C { } //not an interface |
aoqi@0 | 15 | |
aoqi@0 | 16 | @FunctionalInterface |
aoqi@0 | 17 | @interface D { } //not an interface |
aoqi@0 | 18 | |
aoqi@0 | 19 | @FunctionalInterface |
aoqi@0 | 20 | interface E { } //no abstracts |
aoqi@0 | 21 | |
aoqi@0 | 22 | @FunctionalInterface |
aoqi@0 | 23 | interface F { default void m() { } } //no abstracts |
aoqi@0 | 24 | |
aoqi@0 | 25 | @FunctionalInterface |
aoqi@0 | 26 | interface G { String toString(); } //no abstracts |
aoqi@0 | 27 | |
aoqi@0 | 28 | @FunctionalInterface |
aoqi@0 | 29 | interface H { void m(); void n(); } //incompatible abstracts |
aoqi@0 | 30 | |
aoqi@0 | 31 | @FunctionalInterface |
aoqi@0 | 32 | interface I { void m(); } //ok |
aoqi@0 | 33 | } |