1 /*
   2  * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package com.sun.tools.jdeprscan.scan;
  27 
  28 import com.sun.tools.classfile.ConstantPool;
  29 
  30 /**
  31  * A visitor that selects constant pool entries by type and adds
  32  * them to the given CPEntries object.
  33  */
  34 class CPSelector implements ConstantPool.Visitor<Void,CPEntries> {
  35     @Override
  36     public Void visitClass(ConstantPool.CONSTANT_Class_info info, CPEntries p) {
  37         p.classes.add(info);
  38         return null;
  39     }
  40 
  41     @Override
  42     public Void visitDouble(ConstantPool.CONSTANT_Double_info info, CPEntries p) {
  43         return null;
  44     }
  45 
  46     @Override
  47     public Void visitFieldref(ConstantPool.CONSTANT_Fieldref_info info, CPEntries p) {
  48         p.fieldRefs.add(info);
  49         return null;
  50     }
  51 
  52     @Override
  53     public Void visitFloat(ConstantPool.CONSTANT_Float_info info, CPEntries p) {
  54         return null;
  55     }
  56 
  57     @Override
  58     public Void visitInteger(ConstantPool.CONSTANT_Integer_info info, CPEntries p) {
  59         return null;
  60     }
  61 
  62     @Override
  63     public Void visitInterfaceMethodref(ConstantPool.CONSTANT_InterfaceMethodref_info info, CPEntries p) {
  64         p.intfMethodRefs.add(info);
  65         return null;
  66     }
  67 
  68     @Override
  69     public Void visitInvokeDynamic(ConstantPool.CONSTANT_InvokeDynamic_info info, CPEntries p) {
  70         return null;
  71     }
  72 
  73     @Override
  74     public Void visitLong(ConstantPool.CONSTANT_Long_info info, CPEntries p) {
  75         return null;
  76     }
  77 
  78     @Override
  79     public Void visitMethodref(ConstantPool.CONSTANT_Methodref_info info, CPEntries p) {
  80         p.methodRefs.add(info);
  81         return null;
  82     }
  83 
  84     @Override
  85     public Void visitMethodHandle(ConstantPool.CONSTANT_MethodHandle_info info, CPEntries p) {
  86         return null;
  87     }
  88 
  89     @Override
  90     public Void visitMethodType(ConstantPool.CONSTANT_MethodType_info info, CPEntries p) {
  91         return null;
  92     }
  93 
  94     @Override
  95     public Void visitModule(ConstantPool.CONSTANT_Module_info info, CPEntries p) {
  96         return null;
  97     }
  98 
  99     @Override
 100     public Void visitNameAndType(ConstantPool.CONSTANT_NameAndType_info info, CPEntries p) {
 101         return null;
 102     }
 103 
 104     @Override
 105     public Void visitPackage(ConstantPool.CONSTANT_Package_info info, CPEntries p) {
 106         return null;
 107     }
 108 
 109     @Override
 110     public Void visitString(ConstantPool.CONSTANT_String_info info, CPEntries p) {
 111         return null;
 112     }
 113 
 114     @Override
 115     public Void visitUtf8(ConstantPool.CONSTANT_Utf8_info info, CPEntries p) {
 116         return null;
 117     }
 118 }