test/tools/javac/annotations/repeatingAnnotations/RepeatingTargetNotAllowed.java

Wed, 23 Jan 2013 13:27:24 -0800

author
jjg
date
Wed, 23 Jan 2013 13:27:24 -0800
changeset 1521
71f35e4b93a5
parent 1492
df694c775e8a
child 2525
2eb010b6cb22
permissions
-rw-r--r--

8006775: JSR 308: Compiler changes in JDK8
Reviewed-by: jjg
Contributed-by: mernst@cs.washington.edu, wmdietl@cs.washington.edu, mpapi@csail.mit.edu, mahmood@notnoop.com

jfranck@1445 1 /*
jjg@1492 2 * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
jfranck@1445 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
jfranck@1445 4 *
jfranck@1445 5 * This code is free software; you can redistribute it and/or modify it
jfranck@1445 6 * under the terms of the GNU General Public License version 2 only, as
jfranck@1445 7 * published by the Free Software Foundation.
jfranck@1445 8 *
jfranck@1445 9 * This code is distributed in the hope that it will be useful, but WITHOUT
jfranck@1445 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
jfranck@1445 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
jfranck@1445 12 * version 2 for more details (a copy is included in the LICENSE file that
jfranck@1445 13 * accompanied this code).
jfranck@1445 14 *
jfranck@1445 15 * You should have received a copy of the GNU General Public License version
jfranck@1445 16 * 2 along with this work; if not, write to the Free Software Foundation,
jfranck@1445 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
jfranck@1445 18 *
jfranck@1445 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
jfranck@1445 20 * or visit www.oracle.com if you need additional information or have any
jfranck@1445 21 * questions.
jfranck@1445 22 */
jfranck@1445 23
jfranck@1445 24 /**
jfranck@1445 25 * @test
jfranck@1445 26 * @summary Container annotation is not checked for semantic correctness
jfranck@1445 27 * @bug 8001114
jfranck@1445 28 *
jfranck@1445 29 * @compile/fail/ref=RepeatingTargetNotAllowed.out -XDrawDiagnostics RepeatingTargetNotAllowed.java
jfranck@1445 30 */
jfranck@1445 31
jfranck@1445 32 import java.lang.annotation.*;
jfranck@1445 33
jjg@1492 34 @Repeatable(Foos.class)
jfranck@1445 35 @interface Foo {}
jfranck@1445 36
jfranck@1445 37 @Target(ElementType.ANNOTATION_TYPE)
jfranck@1445 38 @interface Foos {
jfranck@1445 39 Foo[] value();
jfranck@1445 40 }
jfranck@1445 41
jfranck@1445 42 public class RepeatingTargetNotAllowed {
jfranck@1445 43 @Foo @Foo int f = 0;
jfranck@1445 44 }

mercurial