langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/scan/CPSelector.java
author smarks
Thu, 25 Aug 2016 17:58:39 -0700
changeset 40596 43b19b36e8e6
child 42822 a84956e7ee4d
permissions -rw-r--r--
8145464: implement deprecation static analysis tool Reviewed-by: psandoz, darcy
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
40596
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
     1
/*
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
     2
 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
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.scan;
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 com.sun.tools.classfile.ConstantPool;
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    29
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    30
/**
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    31
 * A visitor that selects constant pool entries by type and adds
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    32
 * them to the given CPEntries object.
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    33
 */
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    34
class CPSelector implements ConstantPool.Visitor<Void,CPEntries> {
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    35
    @Override
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    36
    public Void visitClass(ConstantPool.CONSTANT_Class_info info, CPEntries p) {
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    37
        p.classes.add(info);
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    38
        return null;
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    39
    }
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    40
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    41
    @Override
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    42
    public Void visitDouble(ConstantPool.CONSTANT_Double_info info, CPEntries p) {
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    43
        return null;
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    44
    }
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    45
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    46
    @Override
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    47
    public Void visitFieldref(ConstantPool.CONSTANT_Fieldref_info info, CPEntries p) {
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    48
        p.fieldRefs.add(info);
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    49
        return null;
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    50
    }
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    51
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    52
    @Override
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    53
    public Void visitFloat(ConstantPool.CONSTANT_Float_info info, CPEntries p) {
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    54
        return null;
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    55
    }
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    56
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    57
    @Override
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    58
    public Void visitInteger(ConstantPool.CONSTANT_Integer_info info, CPEntries p) {
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    59
        return null;
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    60
    }
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    61
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    62
    @Override
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    63
    public Void visitInterfaceMethodref(ConstantPool.CONSTANT_InterfaceMethodref_info info, CPEntries p) {
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    64
        p.intfMethodRefs.add(info);
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    65
        return null;
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    66
    }
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    67
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    68
    @Override
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    69
    public Void visitInvokeDynamic(ConstantPool.CONSTANT_InvokeDynamic_info info, CPEntries p) {
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    70
        return null;
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    71
    }
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    72
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    73
    @Override
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    74
    public Void visitLong(ConstantPool.CONSTANT_Long_info info, CPEntries p) {
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    75
        return null;
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    76
    }
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    77
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    78
    @Override
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    79
    public Void visitNameAndType(ConstantPool.CONSTANT_NameAndType_info info, CPEntries p) {
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    80
        return null;
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
    @Override
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    84
    public Void visitMethodref(ConstantPool.CONSTANT_Methodref_info info, CPEntries p) {
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    85
        p.methodRefs.add(info);
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    86
        return null;
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    87
    }
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    88
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    89
    @Override
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    90
    public Void visitMethodHandle(ConstantPool.CONSTANT_MethodHandle_info info, CPEntries p) {
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    91
        return null;
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    92
    }
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    93
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    94
    @Override
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    95
    public Void visitMethodType(ConstantPool.CONSTANT_MethodType_info info, CPEntries p) {
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    96
        return null;
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    97
    }
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    98
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    99
    @Override
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   100
    public Void visitString(ConstantPool.CONSTANT_String_info info, CPEntries p) {
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   101
        return null;
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   102
    }
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   103
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   104
    @Override
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   105
    public Void visitUtf8(ConstantPool.CONSTANT_Utf8_info info, CPEntries p) {
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   106
        return null;
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   107
    }
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   108
}