< prev index next >

src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/PoolConstant.java

Print this page




  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.javac.jvm;
  27 
  28 import com.sun.tools.javac.code.Type;
  29 import com.sun.tools.javac.code.Types;
  30 import com.sun.tools.javac.code.Types.UniqueType;
  31 import com.sun.tools.javac.util.List;
  32 import com.sun.tools.javac.util.Name;
  33 import com.sun.tools.javac.util.Pair;
  34 
  35 import java.util.Objects;
  36 import java.util.stream.Stream;
  37 


  38 /**
  39  * This interface models all javac entities that can be used to represent constant pool entries.
  40  * A pool constant entity must (i) be associated with a constant pool entry tag and have a function
  41  * which generates a key for the desired pool entry (so as to avoid duplicate entries when writing the
  42  * constant pool).
  43  */
  44 public interface PoolConstant {
  45 
  46     /**
  47      * The constant pool entry key.
  48      */
  49     default Object poolKey(Types types) { return this; }
  50 
  51     /**
  52      * The constant pool entry tag.
  53      */
  54     int poolTag();
  55 
  56     /**
  57      * The root of pool constants that can be loaded (e.g. with {@code ldc}, or appear as static




  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.javac.jvm;
  27 
  28 import com.sun.tools.javac.code.Type;
  29 import com.sun.tools.javac.code.Types;
  30 import com.sun.tools.javac.code.Types.UniqueType;
  31 import com.sun.tools.javac.util.List;
  32 import com.sun.tools.javac.util.Name;
  33 import com.sun.tools.javac.util.Pair;
  34 
  35 import java.util.Objects;
  36 import java.util.stream.Stream;
  37 
  38 import com.sun.tools.javac.code.Symbol;
  39 
  40 /**
  41  * This interface models all javac entities that can be used to represent constant pool entries.
  42  * A pool constant entity must (i) be associated with a constant pool entry tag and have a function
  43  * which generates a key for the desired pool entry (so as to avoid duplicate entries when writing the
  44  * constant pool).
  45  */
  46 public interface PoolConstant {
  47 
  48     /**
  49      * The constant pool entry key.
  50      */
  51     default Object poolKey(Types types) { return this; }
  52 
  53     /**
  54      * The constant pool entry tag.
  55      */
  56     int poolTag();
  57 
  58     /**
  59      * The root of pool constants that can be loaded (e.g. with {@code ldc}, or appear as static


< prev index next >