test/tools/javac/lambda/FunctionalInterfaceAnno.java

changeset 1497
7aa2025bbb7b
parent 0
959103a6100f
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/test/tools/javac/lambda/FunctionalInterfaceAnno.java	Wed Jan 16 16:30:11 2013 +0000
     1.3 @@ -0,0 +1,33 @@
     1.4 +/*
     1.5 + * @test /nodynamiccopyright/
     1.6 + * @summary smoke test for functional interface annotation
     1.7 + * @compile/fail/ref=FunctionalInterfaceAnno.out -XDrawDiagnostics FunctionalInterfaceAnno.java
     1.8 + */
     1.9 +class FunctionalInterfaceAnno {
    1.10 +    @FunctionalInterface
    1.11 +    static class A { } //not an interface
    1.12 +
    1.13 +    @FunctionalInterface
    1.14 +    static abstract class B { } //not an interface
    1.15 +
    1.16 +    @FunctionalInterface
    1.17 +    enum C { } //not an interface
    1.18 +
    1.19 +    @FunctionalInterface
    1.20 +    @interface D { } //not an interface
    1.21 +
    1.22 +    @FunctionalInterface
    1.23 +    interface E { } //no abstracts
    1.24 +
    1.25 +    @FunctionalInterface
    1.26 +    interface F { default void m() { } } //no abstracts
    1.27 +
    1.28 +    @FunctionalInterface
    1.29 +    interface G { String toString(); } //no abstracts
    1.30 +
    1.31 +    @FunctionalInterface
    1.32 +    interface H { void m(); void n(); } //incompatible abstracts
    1.33 +
    1.34 +    @FunctionalInterface
    1.35 +    interface I { void m(); } //ok
    1.36 +}

mercurial