test/tools/javac/lambda/FunctionalInterfaceAnno.java

Tue, 12 Mar 2013 16:02:43 +0000

author
mcimadamore
date
Tue, 12 Mar 2013 16:02:43 +0000
changeset 1628
5ddecb91d843
parent 0
959103a6100f
permissions
-rw-r--r--

8009545: Graph inference: dependencies between inference variables should be set during incorporation
Summary: Move all transitivity checks into the incorporation round
Reviewed-by: jjg

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 }

mercurial