< prev index next >

src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeTag.java

Print this page




  25 
  26 package com.sun.tools.javac.code;
  27 
  28 import com.sun.source.tree.Tree.Kind;
  29 
  30 import javax.lang.model.type.TypeKind;
  31 
  32 import static com.sun.tools.javac.code.TypeTag.NumericClasses.*;
  33 
  34 /** An interface for type tag values, which distinguish between different
  35  *  sorts of types.
  36  *
  37  *  <p><b>This is NOT part of any supported API.
  38  *  If you write code that depends on this, you do so at your own risk.
  39  *  This code and its internal interfaces are subject to change or
  40  *  deletion without notice.</b>
  41  */
  42 public enum TypeTag {
  43     /** The tag of the basic type `byte'.
  44      */
  45     BYTE(BYTE_CLASS, BYTE_SUPERCLASSES, true),
  46 
  47     /** The tag of the basic type `char'.
  48      */
  49     CHAR(CHAR_CLASS, CHAR_SUPERCLASSES, true),
  50 
  51     /** The tag of the basic type `short'.
  52      */
  53     SHORT(SHORT_CLASS, SHORT_SUPERCLASSES, true),
  54 
  55     /** The tag of the basic type `long'.
  56      */
  57     LONG(LONG_CLASS, LONG_SUPERCLASSES, true),
  58 
  59     /** The tag of the basic type `float'.
  60      */
  61     FLOAT(FLOAT_CLASS, FLOAT_SUPERCLASSES, true),
  62     /** The tag of the basic type `int'.
  63      */
  64     INT(INT_CLASS, INT_SUPERCLASSES, true),
  65     /** The tag of the basic type `double'.
  66      */
  67     DOUBLE(DOUBLE_CLASS, DOUBLE_CLASS, true),
  68     /** The tag of the basic type `boolean'.
  69      */
  70     BOOLEAN(0, 0, true),
  71 
  72     /** The tag of the type `void'.
  73      */
  74     VOID,
  75 
  76     /** The tag of all class and interface types.
  77      */
  78     CLASS,
  79 
  80     /** The tag of all array types.
  81      */
  82     ARRAY,
  83 
  84     /** The tag of all (monomorphic) method types.
  85      */
  86     METHOD,
  87 
  88     /** The tag of all package "types".
  89      */
  90     PACKAGE,
  91 
  92     /** The tag of all module "types".
  93      */
  94     MODULE,


 121      */
 122     ERROR,
 123 
 124     /** The tag of an unknown type
 125      */
 126     UNKNOWN,
 127 
 128     /** The tag of all instantiatable type variables.
 129      */
 130     UNDETVAR,
 131 
 132     /** Pseudo-types, these are special tags
 133      */
 134     UNINITIALIZED_THIS,
 135 
 136     UNINITIALIZED_OBJECT;
 137 
 138     final int superClasses;
 139     final int numericClass;
 140     final boolean isPrimitive;

 141 
 142     private TypeTag() {
 143         this(0, 0, false);
 144     }
 145 
 146     private TypeTag(int numericClass, int superClasses, boolean isPrimitive) {
 147         this.superClasses = superClasses;
 148         this.numericClass = numericClass;
 149         this.isPrimitive = isPrimitive;

 150     }
 151 
 152     public static class NumericClasses {
 153         public static final int BYTE_CLASS = 1;
 154         public static final int CHAR_CLASS = 2;
 155         public static final int SHORT_CLASS = 4;
 156         public static final int INT_CLASS = 8;
 157         public static final int LONG_CLASS = 16;
 158         public static final int FLOAT_CLASS = 32;
 159         public static final int DOUBLE_CLASS = 64;
 160 
 161         static final int BYTE_SUPERCLASSES = BYTE_CLASS | SHORT_CLASS | INT_CLASS |
 162                 LONG_CLASS | FLOAT_CLASS | DOUBLE_CLASS;
 163 
 164         static final int CHAR_SUPERCLASSES = CHAR_CLASS | INT_CLASS |
 165                 LONG_CLASS | FLOAT_CLASS | DOUBLE_CLASS;
 166 
 167         static final int SHORT_SUPERCLASSES = SHORT_CLASS | INT_CLASS |
 168                 LONG_CLASS | FLOAT_CLASS | DOUBLE_CLASS;
 169 




  25 
  26 package com.sun.tools.javac.code;
  27 
  28 import com.sun.source.tree.Tree.Kind;
  29 
  30 import javax.lang.model.type.TypeKind;
  31 
  32 import static com.sun.tools.javac.code.TypeTag.NumericClasses.*;
  33 
  34 /** An interface for type tag values, which distinguish between different
  35  *  sorts of types.
  36  *
  37  *  <p><b>This is NOT part of any supported API.
  38  *  If you write code that depends on this, you do so at your own risk.
  39  *  This code and its internal interfaces are subject to change or
  40  *  deletion without notice.</b>
  41  */
  42 public enum TypeTag {
  43     /** The tag of the basic type `byte'.
  44      */
  45     BYTE(BYTE_CLASS, BYTE_SUPERCLASSES, true, byte.class),
  46 
  47     /** The tag of the basic type `char'.
  48      */
  49     CHAR(CHAR_CLASS, CHAR_SUPERCLASSES, true, char.class),
  50 
  51     /** The tag of the basic type `short'.
  52      */
  53     SHORT(SHORT_CLASS, SHORT_SUPERCLASSES, true, short.class),
  54 
  55     /** The tag of the basic type `long'.
  56      */
  57     LONG(LONG_CLASS, LONG_SUPERCLASSES, true, long.class),
  58 
  59     /** The tag of the basic type `float'.
  60      */
  61     FLOAT(FLOAT_CLASS, FLOAT_SUPERCLASSES, true, float.class),
  62     /** The tag of the basic type `int'.
  63      */
  64     INT(INT_CLASS, INT_SUPERCLASSES, true, int.class),
  65     /** The tag of the basic type `double'.
  66      */
  67     DOUBLE(DOUBLE_CLASS, DOUBLE_CLASS, true, double.class),
  68     /** The tag of the basic type `boolean'.
  69      */
  70     BOOLEAN(0, 0, true, boolean.class),
  71 
  72     /** The tag of the type `void'.
  73      */
  74     VOID(0, 0, false, void.class),
  75 
  76     /** The tag of all class and interface types.
  77      */
  78     CLASS,
  79 
  80     /** The tag of all array types.
  81      */
  82     ARRAY,
  83 
  84     /** The tag of all (monomorphic) method types.
  85      */
  86     METHOD,
  87 
  88     /** The tag of all package "types".
  89      */
  90     PACKAGE,
  91 
  92     /** The tag of all module "types".
  93      */
  94     MODULE,


 121      */
 122     ERROR,
 123 
 124     /** The tag of an unknown type
 125      */
 126     UNKNOWN,
 127 
 128     /** The tag of all instantiatable type variables.
 129      */
 130     UNDETVAR,
 131 
 132     /** Pseudo-types, these are special tags
 133      */
 134     UNINITIALIZED_THIS,
 135 
 136     UNINITIALIZED_OBJECT;
 137 
 138     final int superClasses;
 139     final int numericClass;
 140     final boolean isPrimitive;
 141     public final Class<?> theClass;
 142 
 143     private TypeTag() {
 144         this(0, 0, false, null);
 145     }
 146 
 147     private TypeTag(int numericClass, int superClasses, boolean isPrimitive, Class<?> theClass) {
 148         this.superClasses = superClasses;
 149         this.numericClass = numericClass;
 150         this.isPrimitive = isPrimitive;
 151         this.theClass = theClass;
 152     }
 153 
 154     public static class NumericClasses {
 155         public static final int BYTE_CLASS = 1;
 156         public static final int CHAR_CLASS = 2;
 157         public static final int SHORT_CLASS = 4;
 158         public static final int INT_CLASS = 8;
 159         public static final int LONG_CLASS = 16;
 160         public static final int FLOAT_CLASS = 32;
 161         public static final int DOUBLE_CLASS = 64;
 162 
 163         static final int BYTE_SUPERCLASSES = BYTE_CLASS | SHORT_CLASS | INT_CLASS |
 164                 LONG_CLASS | FLOAT_CLASS | DOUBLE_CLASS;
 165 
 166         static final int CHAR_SUPERCLASSES = CHAR_CLASS | INT_CLASS |
 167                 LONG_CLASS | FLOAT_CLASS | DOUBLE_CLASS;
 168 
 169         static final int SHORT_SUPERCLASSES = SHORT_CLASS | INT_CLASS |
 170                 LONG_CLASS | FLOAT_CLASS | DOUBLE_CLASS;
 171 


< prev index next >