/** * Gets the type of a local variable that is used to store a value of a given class. This method * partitions all classes into one of the following categories: * * <p> * * <blockquote> * * <pre> * * Local Variable Type | Types * ---------------------+------- * INT | boolean, byte, short, int * FLOAT | float * LONG | long * DOUBLE | double * ADDRESS | Address * UWORD | UWord * OFFSET | Offset * REFERENCE | types in java.lang.Object hierarchy * * </pre> * * </blockquote> * * <p> * * @param type the type of a value that will be stored in a local variable * @return the local variable type for storing values of type <code>type</code> */ public static Klass getLocalTypeFor(Klass type) { switch (type.getSystemID()) { case CID.BOOLEAN: case CID.BYTE: case CID.SHORT: case CID.CHAR: case CID.INT: { return Klass.INT; } case CID.FLOAT: case CID.LONG: case CID.DOUBLE: { return type; } case CID.UWORD: case CID.OFFSET: case CID.ADDRESS: { return type; } default: { Assert.that(Klass.REFERENCE.isAssignableFrom(type)); return Klass.REFERENCE; } } }