langtools/test/tools/javac/annotations/typeAnnotations/classfile/Scopes.java
author jjg
Tue, 15 Oct 2013 15:57:13 -0700
changeset 21041 99f5e5e97425
child 30730 d3ce7619db2c
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:
21041
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
     1
/*
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
     2
 * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
     4
 *
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
     7
 * published by the Free Software Foundation.
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
     8
 *
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    13
 * accompanied this code).
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    14
 *
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    18
 *
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    21
 * questions.
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    22
 */
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    23
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    24
import java.lang.annotation.*;
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    25
import java.io.*;
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    26
import java.net.URL;
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    27
import java.util.List;
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    28
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    29
import com.sun.tools.classfile.*;
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    30
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    31
/*
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    32
 * @test
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    33
 * @bug 6843077 8006775
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    34
 * @summary Qualified inner type annotation accessible to the class.
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    35
 */
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    36
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    37
@Scopes.UniqueInner
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    38
public class Scopes<T extends @Scopes.UniqueInner Object> extends ClassfileTestHelper{
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    39
    public static void main(String[] args) throws Exception {
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    40
        new Scopes().run();
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    41
    }
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    42
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    43
    public void run() throws Exception {
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    44
        expected_tinvisibles = 1;
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    45
        expected_invisibles = 1;
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    46
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    47
        ClassFile cf = getClassFile("Scopes.class");
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    48
        test(cf);
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    49
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    50
        countAnnotations();
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    51
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    52
        if (errors > 0)
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    53
            throw new Exception(errors + " errors found");
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    54
        System.out.println("PASSED");
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    55
    }
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    56
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    57
    @Target({ElementType.TYPE_USE})
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    58
    @interface UniqueInner { };
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    59
}