test/langtools/tools/javac/tree/NoPrivateTypesExported.java
author erikj
Tue, 12 Sep 2017 19:03:39 +0200
changeset 47216 71c04702a3d5
parent 34916 langtools/test/tools/javac/tree/NoPrivateTypesExported.java@16043fc1d90b
child 47482 4a35a00eb001
permissions -rw-r--r--
8187443: Forest Consolidation: Move files to unified layout Reviewed-by: darcy, ihse
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
21022
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
     1
/*
30730
d3ce7619db2c 8076543: Add @modules as needed to the langtools tests
akulyakh
parents: 25690
diff changeset
     2
 * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
21022
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
     4
 *
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
     7
 * published by the Free Software Foundation.
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
     8
 *
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    13
 * accompanied this code).
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    14
 *
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    18
 *
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    21
 * questions.
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    22
 */
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    23
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    24
/*
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    25
 * @test
33424
e6bd5406e2cf 8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents: 30730
diff changeset
    26
 * @bug 8026180 8132096
21022
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    27
 * @summary Ensuring javax.lang.model.**, javax.tools.**, javax.annotation.processing.**
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    28
 *          and com.sun.source.** don't export inappropriate types.
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    29
 * @library /tools/javac/lib
30730
d3ce7619db2c 8076543: Add @modules as needed to the langtools tests
akulyakh
parents: 25690
diff changeset
    30
 * @modules java.compiler
d3ce7619db2c 8076543: Add @modules as needed to the langtools tests
akulyakh
parents: 25690
diff changeset
    31
 *          jdk.compiler
21022
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    32
 * @build JavacTestingAbstractProcessor NoPrivateTypesExported
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    33
 * @compile -processor NoPrivateTypesExported NoPrivateTypesExported.java
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    34
 */
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    35
import java.lang.annotation.Documented;
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    36
import java.util.Arrays;
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    37
import java.util.HashSet;
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    38
import java.util.List;
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    39
import java.util.Set;
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    40
import javax.annotation.processing.RoundEnvironment;
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    41
import javax.lang.model.element.AnnotationMirror;
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    42
import javax.lang.model.element.AnnotationValue;
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    43
import javax.lang.model.element.Element;
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    44
import javax.lang.model.element.ElementKind;
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    45
import javax.lang.model.element.ExecutableElement;
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    46
import javax.lang.model.element.PackageElement;
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    47
import javax.lang.model.element.TypeElement;
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    48
import javax.lang.model.element.TypeParameterElement;
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    49
import javax.lang.model.element.VariableElement;
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    50
import javax.lang.model.type.ArrayType;
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    51
import javax.lang.model.type.DeclaredType;
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    52
import javax.lang.model.type.IntersectionType;
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    53
import javax.lang.model.type.TypeMirror;
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    54
import javax.lang.model.type.TypeVariable;
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    55
import javax.lang.model.type.WildcardType;
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    56
import javax.tools.Diagnostic.Kind;
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    57
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    58
public class NoPrivateTypesExported extends JavacTestingAbstractProcessor {
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    59
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    60
    private static final String[] javaxLangModelPackages = new String[] {
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    61
        "javax.lang.model",
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    62
        "javax.lang.model.element",
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    63
        "javax.lang.model.type",
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    64
        "javax.lang.model.util",
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    65
    };
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    66
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    67
    private static final Set<String> javaxLangModelAcceptable;
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    68
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    69
    private static final String[] javaxToolsProcessingPackages = new String[] {
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    70
        "javax.annotation.processing",
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    71
        "javax.tools",
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    72
    };
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    73
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    74
    private static final Set<String> javaxToolsProcessingAcceptable;
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    75
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    76
    private static final String[] comSunSourcePackages = new String[] {
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    77
        "com.sun.source.doctree",
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    78
        "com.sun.source.tree",
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    79
        "com.sun.source.util"
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    80
    };
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    81
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    82
    private static final Set<String> comSunSourceAcceptable;
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    83
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    84
    static {
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    85
        javaxLangModelAcceptable = new HashSet<>(Arrays.asList(
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    86
            "java.io.",
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    87
            "java.lang.",
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    88
            "java.net.",
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    89
            "java.nio.",
33424
e6bd5406e2cf 8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents: 30730
diff changeset
    90
            "java.text.",
21022
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    91
            "java.util.",
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    92
            "javax.lang.model.",
34916
16043fc1d90b 8049422: Remove @jdk.Exported
alanb
parents: 33424
diff changeset
    93
            "javax.annotation.processing.SupportedSourceVersion"
21022
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    94
        ));
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    95
        Set<String> javaxToolsProcessingAcceptableTemp = new HashSet<>();
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    96
        javaxToolsProcessingAcceptableTemp.addAll(javaxLangModelAcceptable);
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    97
        javaxToolsProcessingAcceptableTemp.addAll(Arrays.asList(
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    98
                "javax.annotation.processing.",
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
    99
                "javax.tools."
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   100
        ));
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   101
        javaxToolsProcessingAcceptable = javaxToolsProcessingAcceptableTemp;
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   102
        Set<String> comSunSourceAcceptableTemp = new HashSet<>();
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   103
        comSunSourceAcceptableTemp.addAll(javaxToolsProcessingAcceptable);
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   104
        comSunSourceAcceptableTemp.addAll(Arrays.asList(
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   105
                "com.sun.source.doctree.",
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   106
                "com.sun.source.tree.",
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   107
                "com.sun.source.util."
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   108
        ));
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   109
        comSunSourceAcceptable = comSunSourceAcceptableTemp;
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   110
    }
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   111
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   112
    @Override
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   113
    public boolean process(Set<? extends TypeElement> annotations,
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   114
                           RoundEnvironment roundEnv) {
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   115
        if (roundEnv.processingOver()) {
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   116
            verifyPackage(javaxLangModelPackages, javaxLangModelAcceptable);
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   117
            verifyPackage(javaxToolsProcessingPackages, javaxToolsProcessingAcceptable);
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   118
            verifyPackage(comSunSourcePackages, comSunSourceAcceptable);
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   119
        }
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   120
        return true;
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   121
    }
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   122
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   123
    private void verifyPackage(String[] packagesToTest, Set<String> acceptable) {
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   124
        for (String packageToTest : packagesToTest) {
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   125
            PackageElement packageElement = processingEnv.getElementUtils()
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   126
                    .getPackageElement(packageToTest);
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   127
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   128
            verifyReferredTypesAcceptable(packageElement, acceptable);
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   129
        }
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   130
    }
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   131
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   132
    private void verifyReferredTypesAcceptable(Element rootElement,
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   133
                                               final Set<String> acceptable) {
25690
b1dac768ab79 8050430: Provided new utility visitors supporting SourceVersion.RELEASE_9
darcy
parents: 21022
diff changeset
   134
        new ElementScanner<Void, Void>() {
21022
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   135
            @Override public Void visitType(TypeElement e, Void p) {
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   136
                verifyTypeAcceptable(e.getSuperclass(), acceptable);
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   137
                verifyTypesAcceptable(e.getInterfaces(), acceptable);
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   138
                scan(e.getTypeParameters(), p);
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   139
                scan(e.getEnclosedElements(), p);
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   140
                verifyAnnotations(e.getAnnotationMirrors(), acceptable);
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   141
                return null;
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   142
            }
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   143
            @Override public Void visitTypeParameter(TypeParameterElement e, Void p) {
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   144
                verifyTypesAcceptable(e.getBounds(), acceptable);
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   145
                scan(e.getEnclosedElements(), p);
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   146
                verifyAnnotations(e.getAnnotationMirrors(), acceptable);
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   147
                return null;
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   148
            }
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   149
            @Override public Void visitPackage(PackageElement e, Void p) {
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   150
                scan(e.getEnclosedElements(), p);
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   151
                verifyAnnotations(e.getAnnotationMirrors(), acceptable);
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   152
                return null;
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   153
            }
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   154
            @Override public Void visitVariable(VariableElement e, Void p) {
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   155
                verifyTypeAcceptable(e.asType(), acceptable);
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   156
                scan(e.getEnclosedElements(), p);
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   157
                verifyAnnotations(e.getAnnotationMirrors(), acceptable);
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   158
                return null;
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   159
            }
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   160
            @Override
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   161
            public Void visitExecutable(ExecutableElement e, Void p) {
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   162
                scan(e.getTypeParameters(), p);
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   163
                verifyTypeAcceptable(e.getReturnType(), acceptable);
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   164
                scan(e.getParameters(), p);
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   165
                verifyTypesAcceptable(e.getThrownTypes(), acceptable);
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   166
                scan(e.getEnclosedElements(), p);
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   167
                verifyAnnotations(e.getAnnotationMirrors(), acceptable);
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   168
                return null;
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   169
            }
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   170
        }.scan(rootElement, null);
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   171
    }
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   172
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   173
    private void verifyAnnotations(Iterable<? extends AnnotationMirror> annotations,
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   174
                                   Set<String> acceptable) {
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   175
        for (AnnotationMirror mirror : annotations) {
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   176
            Element annotationElement = mirror.getAnnotationType().asElement();
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   177
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   178
            if (annotationElement.getAnnotation(Documented.class) == null) {
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   179
                note("Ignoring undocumented annotation: " + mirror.getAnnotationType());
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   180
            }
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   181
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   182
            verifyTypeAcceptable(mirror.getAnnotationType(), acceptable);
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   183
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   184
            for (AnnotationValue value : mirror.getElementValues().values()) {
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   185
                verifyAnnotationValue(value, acceptable);
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   186
            }
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   187
        }
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   188
    }
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   189
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   190
    private void verifyAnnotationValue(AnnotationValue value,
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   191
                                       final Set<String> acceptable) {
25690
b1dac768ab79 8050430: Provided new utility visitors supporting SourceVersion.RELEASE_9
darcy
parents: 21022
diff changeset
   192
        value.accept(new SimpleAnnotationValueVisitor<Void, Void>() {
21022
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   193
            @Override public Void visitType(TypeMirror t, Void p) {
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   194
                verifyTypeAcceptable(t, acceptable);
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   195
                return null;
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   196
            }
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   197
            @Override
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   198
            public Void visitEnumConstant(VariableElement c, Void p) {
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   199
                verifyReferredTypesAcceptable(c, acceptable);
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   200
                return null;
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   201
            }
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   202
            @Override public Void visitArray(List<? extends AnnotationValue> vals,
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   203
                                             Void p) {
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   204
                for (AnnotationValue val : vals) {
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   205
                    val.accept(this, p);
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   206
                }
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   207
                return null;
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   208
            }
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   209
            @Override protected Void defaultAction(Object o, Void p) {
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   210
                error("Unexpected AnnotationValue: " + o.toString());
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   211
                return super.defaultAction(o, p);
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   212
            }
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   213
        }, null);
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   214
    }
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   215
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   216
    private void verifyTypesAcceptable(Iterable<? extends TypeMirror> types,
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   217
                                       Set<String> acceptable) {
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   218
        if (types == null) return ;
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   219
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   220
        for (TypeMirror type : types) {
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   221
            verifyTypeAcceptable(type, acceptable);
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   222
        }
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   223
    }
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   224
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   225
    private void verifyTypeAcceptable(TypeMirror type, Set<String> acceptable) {
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   226
        if (type == null) return ;
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   227
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   228
        verifyAnnotations(type.getAnnotationMirrors(), acceptable);
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   229
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   230
        switch (type.getKind()) {
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   231
            case BOOLEAN: case BYTE: case CHAR: case DOUBLE: case FLOAT:
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   232
            case INT: case LONG: case SHORT: case VOID: case NONE: case NULL:
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   233
                return ;
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   234
            case DECLARED:
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   235
                DeclaredType dt = (DeclaredType) type;
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   236
                TypeElement outermostTypeElement = outermostTypeElement(dt.asElement());
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   237
                String outermostType = outermostTypeElement.getQualifiedName().toString();
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   238
                boolean isAcceptable = false;
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   239
                for (String acceptablePackage : acceptable) {
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   240
                    if (outermostType.startsWith(acceptablePackage)) {
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   241
                        isAcceptable = true;
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   242
                        break;
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   243
                    }
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   244
                }
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   245
                if (!isAcceptable) {
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   246
                    error("Type not acceptable for this API: " + dt.toString());
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   247
                }
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   248
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   249
                for (TypeMirror bound : dt.getTypeArguments()) {
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   250
                    verifyTypeAcceptable(bound, acceptable);
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   251
                }
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   252
                break;
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   253
            case ARRAY:
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   254
                verifyTypeAcceptable(((ArrayType) type).getComponentType(), acceptable);
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   255
                break;
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   256
            case INTERSECTION:
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   257
                for (TypeMirror element : ((IntersectionType) type).getBounds()) {
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   258
                    verifyTypeAcceptable(element, acceptable);
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   259
                }
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   260
                break;
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   261
            case TYPEVAR:
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   262
                verifyTypeAcceptable(((TypeVariable) type).getLowerBound(), acceptable);
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   263
                verifyTypeAcceptable(((TypeVariable) type).getUpperBound(), acceptable);
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   264
                break;
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   265
            case WILDCARD:
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   266
                verifyTypeAcceptable(((WildcardType) type).getExtendsBound(), acceptable);
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   267
                verifyTypeAcceptable(((WildcardType) type).getSuperBound(), acceptable);
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   268
                break;
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   269
            default:
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   270
                error("Type not acceptable for this API: " + type.toString());
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   271
                break;
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   272
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   273
        }
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   274
    }
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   275
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   276
    private TypeElement outermostTypeElement(Element el) {
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   277
        while (el.getEnclosingElement().getKind() != ElementKind.PACKAGE) {
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   278
            el = el.getEnclosingElement();
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   279
        }
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   280
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   281
        return (TypeElement) el;
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   282
    }
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   283
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   284
    private void error(String text) {
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   285
        processingEnv.getMessager().printMessage(Kind.ERROR, text);
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   286
    }
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   287
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   288
    private void note(String text) {
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   289
        processingEnv.getMessager().printMessage(Kind.NOTE, text);
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   290
    }
08da1099cba7 8026180: com.sun.source.tree.NewArrayTree refers to com.sun.tools.javac.util.List
jlahoda
parents:
diff changeset
   291
}