langtools/test/tools/javac/diags/examples/CantAnnotateScoping1.java
author jjg
Tue, 15 Oct 2013 15:57:13 -0700
changeset 21041 99f5e5e97425
parent 15385 langtools/test/tools/javac/diags/examples/CantAnnotateStaticClass.java@ee1eebe7e210
permissions -rw-r--r--
8026564: import changes from type-annotations forest Reviewed-by: jjg Contributed-by: wdietl@gmail.com, steve.sides@oracle.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
15385
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents:
diff changeset
     1
/*
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents:
diff changeset
     2
 * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents:
diff changeset
     4
 *
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents:
diff changeset
     7
 * published by the Free Software Foundation.
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents:
diff changeset
     8
 *
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents:
diff changeset
    13
 * accompanied this code).
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents:
diff changeset
    14
 *
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents:
diff changeset
    18
 *
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents:
diff changeset
    21
 * questions.
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents:
diff changeset
    22
 */
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents:
diff changeset
    23
21041
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents: 15385
diff changeset
    24
// key: compiler.err.cant.type.annotate.scoping.1
15385
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents:
diff changeset
    25
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents:
diff changeset
    26
import java.lang.annotation.*;
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents:
diff changeset
    27
21041
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents: 15385
diff changeset
    28
class CantAnnotateNestedType {
15385
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents:
diff changeset
    29
    @Target(ElementType.TYPE_USE)
21041
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents: 15385
diff changeset
    30
    @interface TA {}
15385
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents:
diff changeset
    31
21041
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents: 15385
diff changeset
    32
    interface Outer {
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents: 15385
diff changeset
    33
        interface Inner {}
15385
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents:
diff changeset
    34
    }
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents:
diff changeset
    35
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents:
diff changeset
    36
    // Error:
21041
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents: 15385
diff changeset
    37
    @TA Outer.Inner f;
15385
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents:
diff changeset
    38
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents:
diff changeset
    39
    // OK:
21041
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents: 15385
diff changeset
    40
    @TA Outer g;
15385
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents:
diff changeset
    41
}