src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/scan/CPSelector.java
author psandoz
Fri, 08 Sep 2017 10:46:46 -0700
changeset 48826 c4d9d1b08e2e
parent 47216 71c04702a3d5
permissions -rw-r--r--
8186209: Tool support for ConstantDynamic 8186046: Minimal ConstantDynamic support 8190972: Ensure that AOT/Graal filters out class files containing CONSTANT_Dynamic ahead of full AOT support Reviewed-by: acorn, coleenp, kvn Contributed-by: lois.foltan@oracle.com, john.r.rose@oracle.com, paul.sandoz@oracle.com
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;
48826
c4d9d1b08e2e 8186209: Tool support for ConstantDynamic
psandoz
parents: 47216
diff changeset
    29
import com.sun.tools.classfile.ConstantPool.CONSTANT_Dynamic_info;
40596
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    30
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    31
/**
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    32
 * A visitor that selects constant pool entries by type and adds
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    33
 * them to the given CPEntries object.
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    34
 */
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    35
class CPSelector implements ConstantPool.Visitor<Void,CPEntries> {
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    36
    @Override
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    37
    public Void visitClass(ConstantPool.CONSTANT_Class_info info, CPEntries p) {
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    38
        p.classes.add(info);
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    39
        return null;
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    40
    }
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    41
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    42
    @Override
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    43
    public Void visitDouble(ConstantPool.CONSTANT_Double_info info, CPEntries p) {
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    44
        return null;
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    45
    }
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    46
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    47
    @Override
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    48
    public Void visitFieldref(ConstantPool.CONSTANT_Fieldref_info info, CPEntries p) {
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    49
        p.fieldRefs.add(info);
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    50
        return null;
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    51
    }
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    52
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    53
    @Override
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    54
    public Void visitFloat(ConstantPool.CONSTANT_Float_info info, CPEntries p) {
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    55
        return null;
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    56
    }
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    57
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    58
    @Override
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    59
    public Void visitInteger(ConstantPool.CONSTANT_Integer_info info, CPEntries p) {
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    60
        return null;
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    61
    }
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    62
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    63
    @Override
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    64
    public Void visitInterfaceMethodref(ConstantPool.CONSTANT_InterfaceMethodref_info info, CPEntries p) {
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    65
        p.intfMethodRefs.add(info);
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    66
        return null;
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    67
    }
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    68
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    69
    @Override
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    70
    public Void visitInvokeDynamic(ConstantPool.CONSTANT_InvokeDynamic_info info, CPEntries p) {
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    71
        return null;
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    72
    }
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
    73
48826
c4d9d1b08e2e 8186209: Tool support for ConstantDynamic
psandoz
parents: 47216
diff changeset
    74
    public Void visitDynamicConstant(CONSTANT_Dynamic_info info, CPEntries p) {
c4d9d1b08e2e 8186209: Tool support for ConstantDynamic
psandoz
parents: 47216
diff changeset
    75
        return null;
c4d9d1b08e2e 8186209: Tool support for ConstantDynamic
psandoz
parents: 47216
diff changeset
    76
    }
c4d9d1b08e2e 8186209: Tool support for ConstantDynamic
psandoz
parents: 47216
diff changeset
    77
40596
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 visitLong(ConstantPool.CONSTANT_Long_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
42822
a84956e7ee4d 8170987: Module system implementation refresh (12/2016)
alanb
parents: 40596
diff changeset
   100
    public Void visitModule(ConstantPool.CONSTANT_Module_info info, CPEntries p) {
a84956e7ee4d 8170987: Module system implementation refresh (12/2016)
alanb
parents: 40596
diff changeset
   101
        return null;
a84956e7ee4d 8170987: Module system implementation refresh (12/2016)
alanb
parents: 40596
diff changeset
   102
    }
a84956e7ee4d 8170987: Module system implementation refresh (12/2016)
alanb
parents: 40596
diff changeset
   103
a84956e7ee4d 8170987: Module system implementation refresh (12/2016)
alanb
parents: 40596
diff changeset
   104
    @Override
a84956e7ee4d 8170987: Module system implementation refresh (12/2016)
alanb
parents: 40596
diff changeset
   105
    public Void visitNameAndType(ConstantPool.CONSTANT_NameAndType_info info, CPEntries p) {
a84956e7ee4d 8170987: Module system implementation refresh (12/2016)
alanb
parents: 40596
diff changeset
   106
        return null;
a84956e7ee4d 8170987: Module system implementation refresh (12/2016)
alanb
parents: 40596
diff changeset
   107
    }
a84956e7ee4d 8170987: Module system implementation refresh (12/2016)
alanb
parents: 40596
diff changeset
   108
a84956e7ee4d 8170987: Module system implementation refresh (12/2016)
alanb
parents: 40596
diff changeset
   109
    @Override
a84956e7ee4d 8170987: Module system implementation refresh (12/2016)
alanb
parents: 40596
diff changeset
   110
    public Void visitPackage(ConstantPool.CONSTANT_Package_info info, CPEntries p) {
a84956e7ee4d 8170987: Module system implementation refresh (12/2016)
alanb
parents: 40596
diff changeset
   111
        return null;
a84956e7ee4d 8170987: Module system implementation refresh (12/2016)
alanb
parents: 40596
diff changeset
   112
    }
a84956e7ee4d 8170987: Module system implementation refresh (12/2016)
alanb
parents: 40596
diff changeset
   113
a84956e7ee4d 8170987: Module system implementation refresh (12/2016)
alanb
parents: 40596
diff changeset
   114
    @Override
40596
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   115
    public Void visitString(ConstantPool.CONSTANT_String_info info, CPEntries p) {
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   116
        return null;
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   117
    }
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   118
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   119
    @Override
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   120
    public Void visitUtf8(ConstantPool.CONSTANT_Utf8_info info, CPEntries p) {
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   121
        return null;
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   122
    }
43b19b36e8e6 8145464: implement deprecation static analysis tool
smarks
parents:
diff changeset
   123
}