src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/LoadProc.java
author darcy
Mon, 18 Dec 2017 18:51:40 -0800
changeset 48343 d4329843abf4
parent 47216 71c04702a3d5
child 50776 cf0898a6441e
permissions -rw-r--r--
8173382: Add -source 11 and -target 11 to javac 8193291: Add SourceVersion.RELEASE_11 Reviewed-by: jjg, erikj, psandoz
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
40596
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
     1
/*
43646
017aba6e9260 8028544: Add SourceVersion.RELEASE_10
darcy
parents: 40596
diff changeset
     2
 * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
40596
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
     4
 *
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    10
 *
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    15
 * accompanied this code).
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    16
 *
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    20
 *
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    23
 * questions.
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    24
 */
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    25
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    26
package com.sun.tools.jdeprscan;
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    27
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    28
import java.lang.annotation.IncompleteAnnotationException;
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    29
import java.util.ArrayList;
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    30
import java.util.List;
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    31
import java.util.Set;
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    32
import java.util.stream.Collectors;
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    33
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    34
import javax.annotation.processing.AbstractProcessor;
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    35
import javax.annotation.processing.Messager;
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    36
import javax.annotation.processing.ProcessingEnvironment;
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    37
import javax.annotation.processing.RoundEnvironment;
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    38
import javax.annotation.processing.SupportedAnnotationTypes;
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    39
import javax.annotation.processing.SupportedSourceVersion;
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    40
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    41
import javax.lang.model.element.Element;
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    42
import javax.lang.model.element.ElementKind;
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    43
import javax.lang.model.element.ExecutableElement;
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    44
import javax.lang.model.element.TypeElement;
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    45
import javax.lang.model.type.ArrayType;
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    46
import javax.lang.model.type.DeclaredType;
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    47
import javax.lang.model.type.ExecutableType;
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    48
import javax.lang.model.type.TypeMirror;
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    49
import javax.lang.model.util.Elements;
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    50
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    51
import javax.tools.Diagnostic;
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    52
48343
d4329843abf4 8173382: Add -source 11 and -target 11 to javac
darcy
parents: 47216
diff changeset
    53
import static javax.lang.model.SourceVersion.RELEASE_11;
40596
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    54
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    55
/**
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    56
 * Annotation processor for the Deprecation Scanner tool.
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    57
 * Examines APIs for deprecated elements and records information
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    58
 *
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    59
 */
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    60
@SupportedAnnotationTypes("java.lang.Deprecated")
48343
d4329843abf4 8173382: Add -source 11 and -target 11 to javac
darcy
parents: 47216
diff changeset
    61
@SupportedSourceVersion(RELEASE_11)
40596
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    62
public class LoadProc extends AbstractProcessor {
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    63
    Elements elements;
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    64
    Messager messager;
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    65
    final List<DeprData> deprList = new ArrayList<>();
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    66
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    67
    public LoadProc() {
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    68
    }
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    69
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    70
    @Override
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    71
    public void init(ProcessingEnvironment pe) {
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    72
        super.init(pe);
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    73
        elements = pe.getElementUtils();
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    74
        messager = pe.getMessager();
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    75
    }
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    76
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    77
    @Override
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    78
    public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    79
        if (roundEnv.processingOver()) {
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    80
            return false;
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    81
        }
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    82
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    83
        // Assume annotations contains only @Deprecated.
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    84
        // Note: no way to get deprecated packages, since
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    85
        // @Deprecated is ignored in package-info.java files.
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    86
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    87
        Set<? extends Element> set = roundEnv.getElementsAnnotatedWith(Deprecated.class);
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    88
        for (Element e : set) {
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    89
            ElementKind kind = e.getKind();
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    90
            Deprecated depr = e.getAnnotation(Deprecated.class);
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    91
            switch (kind) {
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    92
                case CLASS:
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    93
                case INTERFACE:
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    94
                case ENUM:
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    95
                case ANNOTATION_TYPE:
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    96
                    addType(kind, (TypeElement)e, depr);
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    97
                    break;
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    98
                case CONSTRUCTOR:
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    99
                case ENUM_CONSTANT:
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   100
                case FIELD:
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   101
                case METHOD:
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   102
                    Element encl = e.getEnclosingElement();
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   103
                    ElementKind enclKind = encl.getKind();
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   104
                    switch (enclKind) {
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   105
                        case CLASS:
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   106
                        case INTERFACE:
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   107
                        case ENUM:
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   108
                        case ANNOTATION_TYPE:
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   109
                            String detail = getDetail(e);
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   110
                            addMember(kind, (TypeElement)encl, detail, depr);
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   111
                            break;
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   112
                        default:
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   113
                            messager.printMessage(Diagnostic.Kind.WARNING,
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   114
                                "element " + e +
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   115
                                " within unknown enclosing element " + encl +
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   116
                                " of kind " + enclKind, e);
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   117
                            break;
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   118
                    }
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   119
                    break;
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   120
                default:
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   121
                    messager.printMessage(Diagnostic.Kind.WARNING,
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   122
                        "unknown element " + e +
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   123
                        " of kind " + kind +
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   124
                        " within " + e.getEnclosingElement(), e);
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   125
                    break;
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   126
            }
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   127
        }
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   128
        return true;
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   129
    }
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   130
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   131
    public List<DeprData> getDeprecations() {
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   132
        return deprList;
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   133
    }
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   134
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   135
    String getDetail(Element e) {
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   136
        if (e.getKind().isField()) {
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   137
            return e.getSimpleName().toString();
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   138
        } else {
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   139
            // method or constructor
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   140
            ExecutableElement ee = (ExecutableElement) e;
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   141
            String ret;
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   142
            ret = desc(ee.getReturnType());
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   143
            List<? extends TypeMirror> parameterTypes = ((ExecutableType)ee.asType()).getParameterTypes();
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   144
            String parms = parameterTypes.stream()
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   145
                                .map(this::desc)
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   146
                                .collect(Collectors.joining());
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   147
            return ee.getSimpleName().toString() + "(" + parms + ")" + ret;
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   148
        }
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   149
    }
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   150
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   151
    String desc(TypeMirror tm) {
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   152
        switch (tm.getKind()) {
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   153
            case BOOLEAN:
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   154
                return "Z";
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   155
            case BYTE:
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   156
                return "B";
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   157
            case SHORT:
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   158
                return "S";
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   159
            case CHAR:
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   160
                return "C";
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   161
            case INT:
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   162
                return "I";
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   163
            case LONG:
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   164
                return "J";
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   165
            case FLOAT:
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   166
                return "F";
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   167
            case DOUBLE:
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   168
                return "D";
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   169
            case VOID:
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   170
                return "V";
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   171
            case DECLARED:
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   172
                String s =
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   173
                    ((TypeElement)((DeclaredType)tm).asElement()).getQualifiedName().toString();
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   174
                s = s.replace('.', '/');
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   175
                return "L" + s + ";";
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   176
            case ARRAY:
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   177
                return "[" + desc(((ArrayType)tm).getComponentType());
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   178
            default:
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   179
                return tm.getKind().toString();
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   180
        }
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   181
    }
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   182
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   183
    void addType(ElementKind kind, TypeElement type, Deprecated dep) {
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   184
        addData(kind, type, "", dep);
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   185
    }
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   186
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   187
    void addMember(ElementKind kind, TypeElement type, String nameSig, Deprecated dep) {
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   188
        addData(kind, type, nameSig, dep);
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   189
    }
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   190
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   191
    void addData(ElementKind kind, TypeElement type, String nameSig, Deprecated dep) {
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   192
        String typeName = elements.getBinaryName(type).toString().replace('.', '/');
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   193
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   194
        String since = "";
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   195
        try {
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   196
            since = dep.since();
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   197
        } catch (IncompleteAnnotationException ignore) { }
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   198
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   199
        boolean forRemoval = false;
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   200
        try {
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   201
            forRemoval = dep.forRemoval();
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   202
        } catch (IncompleteAnnotationException ignore) { }
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   203
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   204
        deprList.add(new DeprData(kind, type, typeName, nameSig, since, forRemoval));
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   205
    }
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   206
}