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

changeset 1853
831467c4c6a7
parent 1826
9851071b551a
child 2525
2eb010b6cb22
     1.1 --- a/src/share/classes/com/sun/tools/javac/code/TypeTag.java	Mon Jun 24 22:03:57 2013 -0400
     1.2 +++ b/src/share/classes/com/sun/tools/javac/code/TypeTag.java	Tue Jun 25 16:12:53 2013 +0100
     1.3 @@ -42,132 +42,107 @@
     1.4  public enum TypeTag {
     1.5      /** The tag of the basic type `byte'.
     1.6       */
     1.7 -    BYTE(BYTE_CLASS, BYTE_SUPERCLASSES,
     1.8 -            TypeTagKind.PRIMITIVE | TypeTagKind.NUMERIC),
     1.9 +    BYTE(BYTE_CLASS, BYTE_SUPERCLASSES, true),
    1.10  
    1.11      /** The tag of the basic type `char'.
    1.12       */
    1.13 -    CHAR(CHAR_CLASS, CHAR_SUPERCLASSES,
    1.14 -            TypeTagKind.PRIMITIVE | TypeTagKind.NUMERIC),
    1.15 +    CHAR(CHAR_CLASS, CHAR_SUPERCLASSES, true),
    1.16  
    1.17      /** The tag of the basic type `short'.
    1.18       */
    1.19 -    SHORT(SHORT_CLASS, SHORT_SUPERCLASSES,
    1.20 -            TypeTagKind.PRIMITIVE | TypeTagKind.NUMERIC),
    1.21 -
    1.22 -    /** The tag of the basic type `int'.
    1.23 -     */
    1.24 -    INT(INT_CLASS, INT_SUPERCLASSES,
    1.25 -            TypeTagKind.PRIMITIVE | TypeTagKind.NUMERIC),
    1.26 +    SHORT(SHORT_CLASS, SHORT_SUPERCLASSES, true),
    1.27  
    1.28      /** The tag of the basic type `long'.
    1.29       */
    1.30 -    LONG(LONG_CLASS, LONG_SUPERCLASSES, TypeTagKind.PRIMITIVE | TypeTagKind.NUMERIC),
    1.31 +    LONG(LONG_CLASS, LONG_SUPERCLASSES, true),
    1.32  
    1.33      /** The tag of the basic type `float'.
    1.34       */
    1.35 -    FLOAT(FLOAT_CLASS, FLOAT_SUPERCLASSES, TypeTagKind.PRIMITIVE | TypeTagKind.NUMERIC),
    1.36 -
    1.37 +    FLOAT(FLOAT_CLASS, FLOAT_SUPERCLASSES, true),
    1.38 +    /** The tag of the basic type `int'.
    1.39 +     */
    1.40 +    INT(INT_CLASS, INT_SUPERCLASSES, true),
    1.41      /** The tag of the basic type `double'.
    1.42       */
    1.43 -    DOUBLE(DOUBLE_CLASS, DOUBLE_CLASS, TypeTagKind.PRIMITIVE | TypeTagKind.NUMERIC),
    1.44 -
    1.45 +    DOUBLE(DOUBLE_CLASS, DOUBLE_CLASS, true),
    1.46      /** The tag of the basic type `boolean'.
    1.47       */
    1.48 -    BOOLEAN(TypeTagKind.PRIMITIVE),
    1.49 +    BOOLEAN(0, 0, true),
    1.50  
    1.51      /** The tag of the type `void'.
    1.52       */
    1.53 -    VOID(TypeTagKind.VOID),
    1.54 +    VOID,
    1.55  
    1.56      /** The tag of all class and interface types.
    1.57       */
    1.58 -    CLASS(TypeTagKind.REFERENCE),
    1.59 +    CLASS,
    1.60  
    1.61      /** The tag of all array types.
    1.62       */
    1.63 -    ARRAY(TypeTagKind.REFERENCE),
    1.64 +    ARRAY,
    1.65  
    1.66      /** The tag of all (monomorphic) method types.
    1.67       */
    1.68 -    METHOD(TypeTagKind.OTHER),
    1.69 +    METHOD,
    1.70  
    1.71      /** The tag of all package "types".
    1.72       */
    1.73 -    PACKAGE(TypeTagKind.OTHER),
    1.74 +    PACKAGE,
    1.75  
    1.76      /** The tag of all (source-level) type variables.
    1.77       */
    1.78 -    TYPEVAR(TypeTagKind.REFERENCE),
    1.79 +    TYPEVAR,
    1.80  
    1.81      /** The tag of all type arguments.
    1.82       */
    1.83 -    WILDCARD(TypeTagKind.REFERENCE),
    1.84 +    WILDCARD,
    1.85  
    1.86      /** The tag of all polymorphic (method-) types.
    1.87       */
    1.88 -    FORALL(TypeTagKind.OTHER),
    1.89 +    FORALL,
    1.90  
    1.91      /** The tag of deferred expression types in method context
    1.92       */
    1.93 -    DEFERRED(TypeTagKind.OTHER),
    1.94 +    DEFERRED,
    1.95  
    1.96      /** The tag of the bottom type {@code <null>}.
    1.97       */
    1.98 -    BOT(TypeTagKind.OTHER),
    1.99 +    BOT,
   1.100  
   1.101      /** The tag of a missing type.
   1.102       */
   1.103 -    NONE(TypeTagKind.OTHER),
   1.104 +    NONE,
   1.105  
   1.106      /** The tag of the error type.
   1.107       */
   1.108 -    ERROR(TypeTagKind.REFERENCE | TypeTagKind.PARTIAL),
   1.109 +    ERROR,
   1.110  
   1.111      /** The tag of an unknown type
   1.112       */
   1.113 -    UNKNOWN(TypeTagKind.PARTIAL),
   1.114 +    UNKNOWN,
   1.115  
   1.116      /** The tag of all instantiatable type variables.
   1.117       */
   1.118 -    UNDETVAR(TypeTagKind.PARTIAL),
   1.119 +    UNDETVAR,
   1.120  
   1.121      /** Pseudo-types, these are special tags
   1.122       */
   1.123 -    UNINITIALIZED_THIS(TypeTagKind.OTHER),
   1.124 +    UNINITIALIZED_THIS,
   1.125  
   1.126 -    UNINITIALIZED_OBJECT(TypeTagKind.OTHER);
   1.127 +    UNINITIALIZED_OBJECT;
   1.128  
   1.129 -    final boolean isPrimitive;
   1.130 -    final boolean isNumeric;
   1.131 -    final boolean isPartial;
   1.132 -    final boolean isReference;
   1.133 -    final boolean isPrimitiveOrVoid;
   1.134      final int superClasses;
   1.135      final int numericClass;
   1.136 +    final boolean isPrimitive;
   1.137  
   1.138 -    private TypeTag(int kind) {
   1.139 -        this(0, 0, kind);
   1.140 +    private TypeTag() {
   1.141 +        this(0, 0, false);
   1.142      }
   1.143  
   1.144 -    private TypeTag(int numericClass, int superClasses, int kind) {
   1.145 -         isPrimitive = (kind & TypeTagKind.PRIMITIVE) != 0;
   1.146 -         isNumeric = (kind & TypeTagKind.NUMERIC) != 0;
   1.147 -         isPartial = (kind & TypeTagKind.PARTIAL) != 0;
   1.148 -         isReference = (kind & TypeTagKind.REFERENCE) != 0;
   1.149 -         isPrimitiveOrVoid = ((kind & TypeTagKind.PRIMITIVE) != 0) ||
   1.150 -                 ((kind & TypeTagKind.VOID) != 0);
   1.151 -         this.superClasses = superClasses;
   1.152 -         this.numericClass = numericClass;
   1.153 -     }
   1.154 -
   1.155 -    static class TypeTagKind {
   1.156 -        static final int PRIMITIVE = 1;
   1.157 -        static final int NUMERIC = 2;
   1.158 -        static final int REFERENCE = 4;
   1.159 -        static final int PARTIAL = 8;
   1.160 -        static final int OTHER = 16;
   1.161 -        static final int VOID = 32;
   1.162 +    private TypeTag(int numericClass, int superClasses, boolean isPrimitive) {
   1.163 +        this.superClasses = superClasses;
   1.164 +        this.numericClass = numericClass;
   1.165 +        this.isPrimitive = isPrimitive;
   1.166      }
   1.167  
   1.168      public static class NumericClasses {
   1.169 @@ -261,4 +236,5 @@
   1.170              throw new AssertionError("unknown primitive type " + this);
   1.171          }
   1.172      }
   1.173 +
   1.174  }

mercurial