Java Code Examples for sun.invoke.util.Wrapper#asWrapperType()

The following examples show how to use sun.invoke.util.Wrapper#asWrapperType() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MethodTypeForm.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/** Canonicalize the given return or param type.
 *  Return null if the type is already canonicalized.
 */
static Class<?> canonicalize(Class<?> t, int how) {
    Class<?> ct;
    if (t == Object.class) {
        // no change, ever
    } else if (!t.isPrimitive()) {
        switch (how) {
            case UNWRAP:
                ct = Wrapper.asPrimitiveType(t);
                if (ct != t)  return ct;
                break;
            case RAW_RETURN:
            case ERASE:
                return Object.class;
        }
    } else if (t == void.class) {
        // no change, usually
        switch (how) {
            case RAW_RETURN:
                return int.class;
            case WRAP:
                return Void.class;
        }
    } else {
        // non-void primitive
        switch (how) {
            case WRAP:
                return Wrapper.asWrapperType(t);
            case INTS:
                if (t == int.class || t == long.class)
                    return null;  // no change
                if (t == double.class)
                    return long.class;
                return int.class;
            case LONGS:
                if (t == long.class)
                    return null;  // no change
                return long.class;
            case RAW_RETURN:
                if (t == int.class || t == long.class ||
                    t == float.class || t == double.class)
                    return null;  // no change
                // everything else returns as an int
                return int.class;
        }
    }
    // no change; return null to signify
    return null;
}
 
Example 2
Source File: MethodTypeForm.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
/** Canonicalize the given return or param type.
 *  Return null if the type is already canonicalized.
 */
static Class<?> canonicalize(Class<?> t, int how) {
    Class<?> ct;
    if (t == Object.class) {
        // no change, ever
    } else if (!t.isPrimitive()) {
        switch (how) {
            case UNWRAP:
                ct = Wrapper.asPrimitiveType(t);
                if (ct != t)  return ct;
                break;
            case RAW_RETURN:
            case ERASE:
                return Object.class;
        }
    } else if (t == void.class) {
        // no change, usually
        switch (how) {
            case RAW_RETURN:
                return int.class;
            case WRAP:
                return Void.class;
        }
    } else {
        // non-void primitive
        switch (how) {
            case WRAP:
                return Wrapper.asWrapperType(t);
            case INTS:
                if (t == int.class || t == long.class)
                    return null;  // no change
                if (t == double.class)
                    return long.class;
                return int.class;
            case LONGS:
                if (t == long.class)
                    return null;  // no change
                return long.class;
            case RAW_RETURN:
                if (t == int.class || t == long.class ||
                    t == float.class || t == double.class)
                    return null;  // no change
                // everything else returns as an int
                return int.class;
        }
    }
    // no change; return null to signify
    return null;
}
 
Example 3
Source File: MethodTypeForm.java    From jdk-1.7-annotated with Apache License 2.0 4 votes vote down vote up
/** Canonicalize the given return or param type.
 *  Return null if the type is already canonicalized.
 */
static Class<?> canonicalize(Class<?> t, int how) {
    Class<?> ct;
    if (t == Object.class) {
        // no change, ever
    } else if (!t.isPrimitive()) {
        switch (how) {
            case UNWRAP:
                ct = Wrapper.asPrimitiveType(t);
                if (ct != t)  return ct;
                break;
            case RAW_RETURN:
            case ERASE:
                return Object.class;
        }
    } else if (t == void.class) {
        // no change, usually
        switch (how) {
            case RAW_RETURN:
                return int.class;
            case WRAP:
                return Void.class;
        }
    } else {
        // non-void primitive
        switch (how) {
            case WRAP:
                return Wrapper.asWrapperType(t);
            case INTS:
                if (t == int.class || t == long.class)
                    return null;  // no change
                if (t == double.class)
                    return long.class;
                return int.class;
            case LONGS:
                if (t == long.class)
                    return null;  // no change
                return long.class;
            case RAW_RETURN:
                if (t == int.class || t == long.class ||
                    t == float.class || t == double.class)
                    return null;  // no change
                // everything else returns as an int
                return int.class;
        }
    }
    // no change; return null to signify
    return null;
}
 
Example 4
Source File: MethodTypeForm.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
/** Canonicalize the given return or param type.
 *  Return null if the type is already canonicalized.
 */
static Class<?> canonicalize(Class<?> t, int how) {
    Class<?> ct;
    if (t == Object.class) {
        // no change, ever
    } else if (!t.isPrimitive()) {
        switch (how) {
            case UNWRAP:
                ct = Wrapper.asPrimitiveType(t);
                if (ct != t)  return ct;
                break;
            case RAW_RETURN:
            case ERASE:
                return Object.class;
        }
    } else if (t == void.class) {
        // no change, usually
        switch (how) {
            case RAW_RETURN:
                return int.class;
            case WRAP:
                return Void.class;
        }
    } else {
        // non-void primitive
        switch (how) {
            case WRAP:
                return Wrapper.asWrapperType(t);
            case INTS:
                if (t == int.class || t == long.class)
                    return null;  // no change
                if (t == double.class)
                    return long.class;
                return int.class;
            case LONGS:
                if (t == long.class)
                    return null;  // no change
                return long.class;
            case RAW_RETURN:
                if (t == int.class || t == long.class ||
                    t == float.class || t == double.class)
                    return null;  // no change
                // everything else returns as an int
                return int.class;
        }
    }
    // no change; return null to signify
    return null;
}
 
Example 5
Source File: MethodTypeForm.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
/** Canonicalize the given return or param type.
 *  Return null if the type is already canonicalized.
 */
static Class<?> canonicalize(Class<?> t, int how) {
    Class<?> ct;
    if (t == Object.class) {
        // no change, ever
    } else if (!t.isPrimitive()) {
        switch (how) {
            case UNWRAP:
                ct = Wrapper.asPrimitiveType(t);
                if (ct != t)  return ct;
                break;
            case RAW_RETURN:
            case ERASE:
                return Object.class;
        }
    } else if (t == void.class) {
        // no change, usually
        switch (how) {
            case RAW_RETURN:
                return int.class;
            case WRAP:
                return Void.class;
        }
    } else {
        // non-void primitive
        switch (how) {
            case WRAP:
                return Wrapper.asWrapperType(t);
            case INTS:
                if (t == int.class || t == long.class)
                    return null;  // no change
                if (t == double.class)
                    return long.class;
                return int.class;
            case LONGS:
                if (t == long.class)
                    return null;  // no change
                return long.class;
            case RAW_RETURN:
                if (t == int.class || t == long.class ||
                    t == float.class || t == double.class)
                    return null;  // no change
                // everything else returns as an int
                return int.class;
        }
    }
    // no change; return null to signify
    return null;
}
 
Example 6
Source File: MethodTypeForm.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/** Canonicalize the given return or param type.
 *  Return null if the type is already canonicalized.
 */
static Class<?> canonicalize(Class<?> t, int how) {
    Class<?> ct;
    if (t == Object.class) {
        // no change, ever
    } else if (!t.isPrimitive()) {
        switch (how) {
            case UNWRAP:
                ct = Wrapper.asPrimitiveType(t);
                if (ct != t)  return ct;
                break;
            case RAW_RETURN:
            case ERASE:
                return Object.class;
        }
    } else if (t == void.class) {
        // no change, usually
        switch (how) {
            case RAW_RETURN:
                return int.class;
            case WRAP:
                return Void.class;
        }
    } else {
        // non-void primitive
        switch (how) {
            case WRAP:
                return Wrapper.asWrapperType(t);
            case INTS:
                if (t == int.class || t == long.class)
                    return null;  // no change
                if (t == double.class)
                    return long.class;
                return int.class;
            case LONGS:
                if (t == long.class)
                    return null;  // no change
                return long.class;
            case RAW_RETURN:
                if (t == int.class || t == long.class ||
                    t == float.class || t == double.class)
                    return null;  // no change
                // everything else returns as an int
                return int.class;
        }
    }
    // no change; return null to signify
    return null;
}
 
Example 7
Source File: MethodTypeForm.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/** Canonicalize the given return or param type.
 *  Return null if the type is already canonicalized.
 */
static Class<?> canonicalize(Class<?> t, int how) {
    Class<?> ct;
    if (t == Object.class) {
        // no change, ever
    } else if (!t.isPrimitive()) {
        switch (how) {
            case UNWRAP:
                ct = Wrapper.asPrimitiveType(t);
                if (ct != t)  return ct;
                break;
            case RAW_RETURN:
            case ERASE:
                return Object.class;
        }
    } else if (t == void.class) {
        // no change, usually
        switch (how) {
            case RAW_RETURN:
                return int.class;
            case WRAP:
                return Void.class;
        }
    } else {
        // non-void primitive
        switch (how) {
            case WRAP:
                return Wrapper.asWrapperType(t);
            case INTS:
                if (t == int.class || t == long.class)
                    return null;  // no change
                if (t == double.class)
                    return long.class;
                return int.class;
            case LONGS:
                if (t == long.class)
                    return null;  // no change
                return long.class;
            case RAW_RETURN:
                if (t == int.class || t == long.class ||
                    t == float.class || t == double.class)
                    return null;  // no change
                // everything else returns as an int
                return int.class;
        }
    }
    // no change; return null to signify
    return null;
}
 
Example 8
Source File: MethodTypeForm.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/** Canonicalize the given return or param type.
 *  Return null if the type is already canonicalized.
 */
static Class<?> canonicalize(Class<?> t, int how) {
    Class<?> ct;
    if (t == Object.class) {
        // no change, ever
    } else if (!t.isPrimitive()) {
        switch (how) {
            case UNWRAP:
                ct = Wrapper.asPrimitiveType(t);
                if (ct != t)  return ct;
                break;
            case RAW_RETURN:
            case ERASE:
                return Object.class;
        }
    } else if (t == void.class) {
        // no change, usually
        switch (how) {
            case RAW_RETURN:
                return int.class;
            case WRAP:
                return Void.class;
        }
    } else {
        // non-void primitive
        switch (how) {
            case WRAP:
                return Wrapper.asWrapperType(t);
            case INTS:
                if (t == int.class || t == long.class)
                    return null;  // no change
                if (t == double.class)
                    return long.class;
                return int.class;
            case LONGS:
                if (t == long.class)
                    return null;  // no change
                return long.class;
            case RAW_RETURN:
                if (t == int.class || t == long.class ||
                    t == float.class || t == double.class)
                    return null;  // no change
                // everything else returns as an int
                return int.class;
        }
    }
    // no change; return null to signify
    return null;
}
 
Example 9
Source File: MethodTypeForm.java    From Java8CN with Apache License 2.0 4 votes vote down vote up
/** Canonicalize the given return or param type.
 *  Return null if the type is already canonicalized.
 */
static Class<?> canonicalize(Class<?> t, int how) {
    Class<?> ct;
    if (t == Object.class) {
        // no change, ever
    } else if (!t.isPrimitive()) {
        switch (how) {
            case UNWRAP:
                ct = Wrapper.asPrimitiveType(t);
                if (ct != t)  return ct;
                break;
            case RAW_RETURN:
            case ERASE:
                return Object.class;
        }
    } else if (t == void.class) {
        // no change, usually
        switch (how) {
            case RAW_RETURN:
                return int.class;
            case WRAP:
                return Void.class;
        }
    } else {
        // non-void primitive
        switch (how) {
            case WRAP:
                return Wrapper.asWrapperType(t);
            case INTS:
                if (t == int.class || t == long.class)
                    return null;  // no change
                if (t == double.class)
                    return long.class;
                return int.class;
            case LONGS:
                if (t == long.class)
                    return null;  // no change
                return long.class;
            case RAW_RETURN:
                if (t == int.class || t == long.class ||
                    t == float.class || t == double.class)
                    return null;  // no change
                // everything else returns as an int
                return int.class;
        }
    }
    // no change; return null to signify
    return null;
}
 
Example 10
Source File: MethodTypeForm.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
/** Canonicalize the given return or param type.
 *  Return null if the type is already canonicalized.
 */
static Class<?> canonicalize(Class<?> t, int how) {
    Class<?> ct;
    if (t == Object.class) {
        // no change, ever
    } else if (!t.isPrimitive()) {
        switch (how) {
            case UNWRAP:
                ct = Wrapper.asPrimitiveType(t);
                if (ct != t)  return ct;
                break;
            case RAW_RETURN:
            case ERASE:
                return Object.class;
        }
    } else if (t == void.class) {
        // no change, usually
        switch (how) {
            case RAW_RETURN:
                return int.class;
            case WRAP:
                return Void.class;
        }
    } else {
        // non-void primitive
        switch (how) {
            case WRAP:
                return Wrapper.asWrapperType(t);
            case INTS:
                if (t == int.class || t == long.class)
                    return null;  // no change
                if (t == double.class)
                    return long.class;
                return int.class;
            case LONGS:
                if (t == long.class)
                    return null;  // no change
                return long.class;
            case RAW_RETURN:
                if (t == int.class || t == long.class ||
                    t == float.class || t == double.class)
                    return null;  // no change
                // everything else returns as an int
                return int.class;
        }
    }
    // no change; return null to signify
    return null;
}
 
Example 11
Source File: MethodTypeForm.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
/** Canonicalize the given return or param type.
 *  Return null if the type is already canonicalized.
 */
static Class<?> canonicalize(Class<?> t, int how) {
    Class<?> ct;
    if (t == Object.class) {
        // no change, ever
    } else if (!t.isPrimitive()) {
        switch (how) {
            case UNWRAP:
                ct = Wrapper.asPrimitiveType(t);
                if (ct != t)  return ct;
                break;
            case RAW_RETURN:
            case ERASE:
                return Object.class;
        }
    } else if (t == void.class) {
        // no change, usually
        switch (how) {
            case RAW_RETURN:
                return int.class;
            case WRAP:
                return Void.class;
        }
    } else {
        // non-void primitive
        switch (how) {
            case WRAP:
                return Wrapper.asWrapperType(t);
            case INTS:
                if (t == int.class || t == long.class)
                    return null;  // no change
                if (t == double.class)
                    return long.class;
                return int.class;
            case LONGS:
                if (t == long.class)
                    return null;  // no change
                return long.class;
            case RAW_RETURN:
                if (t == int.class || t == long.class ||
                    t == float.class || t == double.class)
                    return null;  // no change
                // everything else returns as an int
                return int.class;
        }
    }
    // no change; return null to signify
    return null;
}
 
Example 12
Source File: MethodTypeForm.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/** Canonicalize the given return or param type.
 *  Return null if the type is already canonicalized.
 */
static Class<?> canonicalize(Class<?> t, int how) {
    Class<?> ct;
    if (t == Object.class) {
        // no change, ever
    } else if (!t.isPrimitive()) {
        switch (how) {
            case UNWRAP:
                ct = Wrapper.asPrimitiveType(t);
                if (ct != t)  return ct;
                break;
            case RAW_RETURN:
            case ERASE:
                return Object.class;
        }
    } else if (t == void.class) {
        // no change, usually
        switch (how) {
            case RAW_RETURN:
                return int.class;
            case WRAP:
                return Void.class;
        }
    } else {
        // non-void primitive
        switch (how) {
            case WRAP:
                return Wrapper.asWrapperType(t);
            case INTS:
                if (t == int.class || t == long.class)
                    return null;  // no change
                if (t == double.class)
                    return long.class;
                return int.class;
            case LONGS:
                if (t == long.class)
                    return null;  // no change
                return long.class;
            case RAW_RETURN:
                if (t == int.class || t == long.class ||
                    t == float.class || t == double.class)
                    return null;  // no change
                // everything else returns as an int
                return int.class;
        }
    }
    // no change; return null to signify
    return null;
}
 
Example 13
Source File: MethodTypeForm.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/** Canonicalize the given return or param type.
 *  Return null if the type is already canonicalized.
 */
static Class<?> canonicalize(Class<?> t, int how) {
    Class<?> ct;
    if (t == Object.class) {
        // no change, ever
    } else if (!t.isPrimitive()) {
        switch (how) {
            case UNWRAP:
                ct = Wrapper.asPrimitiveType(t);
                if (ct != t)  return ct;
                break;
            case RAW_RETURN:
            case ERASE:
                return Object.class;
        }
    } else if (t == void.class) {
        // no change, usually
        switch (how) {
            case RAW_RETURN:
                return int.class;
            case WRAP:
                return Void.class;
        }
    } else {
        // non-void primitive
        switch (how) {
            case WRAP:
                return Wrapper.asWrapperType(t);
            case INTS:
                if (t == int.class || t == long.class)
                    return null;  // no change
                if (t == double.class)
                    return long.class;
                return int.class;
            case LONGS:
                if (t == long.class)
                    return null;  // no change
                return long.class;
            case RAW_RETURN:
                if (t == int.class || t == long.class ||
                    t == float.class || t == double.class)
                    return null;  // no change
                // everything else returns as an int
                return int.class;
        }
    }
    // no change; return null to signify
    return null;
}
 
Example 14
Source File: MethodTypeForm.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/** Canonicalize the given return or param type.
 *  Return null if the type is already canonicalized.
 */
static Class<?> canonicalize(Class<?> t, int how) {
    Class<?> ct;
    if (t == Object.class) {
        // no change, ever
    } else if (!t.isPrimitive()) {
        switch (how) {
            case UNWRAP:
                ct = Wrapper.asPrimitiveType(t);
                if (ct != t)  return ct;
                break;
            case RAW_RETURN:
            case ERASE:
                return Object.class;
        }
    } else if (t == void.class) {
        // no change, usually
        switch (how) {
            case RAW_RETURN:
                return int.class;
            case WRAP:
                return Void.class;
        }
    } else {
        // non-void primitive
        switch (how) {
            case WRAP:
                return Wrapper.asWrapperType(t);
            case INTS:
                if (t == int.class || t == long.class)
                    return null;  // no change
                if (t == double.class)
                    return long.class;
                return int.class;
            case LONGS:
                if (t == long.class)
                    return null;  // no change
                return long.class;
            case RAW_RETURN:
                if (t == int.class || t == long.class ||
                    t == float.class || t == double.class)
                    return null;  // no change
                // everything else returns as an int
                return int.class;
        }
    }
    // no change; return null to signify
    return null;
}
 
Example 15
Source File: MethodTypeForm.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
/** Canonicalize the given return or param type.
 *  Return null if the type is already canonicalized.
 */
static Class<?> canonicalize(Class<?> t, int how) {
    Class<?> ct;
    if (t == Object.class) {
        // no change, ever
    } else if (!t.isPrimitive()) {
        switch (how) {
            case UNWRAP:
                ct = Wrapper.asPrimitiveType(t);
                if (ct != t)  return ct;
                break;
            case RAW_RETURN:
            case ERASE:
                return Object.class;
        }
    } else if (t == void.class) {
        // no change, usually
        switch (how) {
            case RAW_RETURN:
                return int.class;
            case WRAP:
                return Void.class;
        }
    } else {
        // non-void primitive
        switch (how) {
            case WRAP:
                return Wrapper.asWrapperType(t);
            case INTS:
                if (t == int.class || t == long.class)
                    return null;  // no change
                if (t == double.class)
                    return long.class;
                return int.class;
            case LONGS:
                if (t == long.class)
                    return null;  // no change
                return long.class;
            case RAW_RETURN:
                if (t == int.class || t == long.class ||
                    t == float.class || t == double.class)
                    return null;  // no change
                // everything else returns as an int
                return int.class;
        }
    }
    // no change; return null to signify
    return null;
}
 
Example 16
Source File: MethodTypeForm.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/** Canonicalize the given return or param type.
 *  Return null if the type is already canonicalized.
 */
static Class<?> canonicalize(Class<?> t, int how) {
    Class<?> ct;
    if (t == Object.class) {
        // no change, ever
    } else if (!t.isPrimitive()) {
        switch (how) {
            case UNWRAP:
                ct = Wrapper.asPrimitiveType(t);
                if (ct != t)  return ct;
                break;
            case RAW_RETURN:
            case ERASE:
                return Object.class;
        }
    } else if (t == void.class) {
        // no change, usually
        switch (how) {
            case RAW_RETURN:
                return int.class;
            case WRAP:
                return Void.class;
        }
    } else {
        // non-void primitive
        switch (how) {
            case WRAP:
                return Wrapper.asWrapperType(t);
            case INTS:
                if (t == int.class || t == long.class)
                    return null;  // no change
                if (t == double.class)
                    return long.class;
                return int.class;
            case LONGS:
                if (t == long.class)
                    return null;  // no change
                return long.class;
            case RAW_RETURN:
                if (t == int.class || t == long.class ||
                    t == float.class || t == double.class)
                    return null;  // no change
                // everything else returns as an int
                return int.class;
        }
    }
    // no change; return null to signify
    return null;
}
 
Example 17
Source File: MethodTypeForm.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/** Canonicalize the given return or param type.
 *  Return null if the type is already canonicalized.
 */
static Class<?> canonicalize(Class<?> t, int how) {
    Class<?> ct;
    if (t == Object.class) {
        // no change, ever
    } else if (!t.isPrimitive()) {
        switch (how) {
            case UNWRAP:
                ct = Wrapper.asPrimitiveType(t);
                if (ct != t)  return ct;
                break;
            case RAW_RETURN:
            case ERASE:
                return Object.class;
        }
    } else if (t == void.class) {
        // no change, usually
        switch (how) {
            case RAW_RETURN:
                return int.class;
            case WRAP:
                return Void.class;
        }
    } else {
        // non-void primitive
        switch (how) {
            case WRAP:
                return Wrapper.asWrapperType(t);
            case INTS:
                if (t == int.class || t == long.class)
                    return null;  // no change
                if (t == double.class)
                    return long.class;
                return int.class;
            case LONGS:
                if (t == long.class)
                    return null;  // no change
                return long.class;
            case RAW_RETURN:
                if (t == int.class || t == long.class ||
                    t == float.class || t == double.class)
                    return null;  // no change
                // everything else returns as an int
                return int.class;
        }
    }
    // no change; return null to signify
    return null;
}
 
Example 18
Source File: MethodTypeForm.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
/** Canonicalize the given return or param type.
 *  Return null if the type is already canonicalized.
 */
static Class<?> canonicalize(Class<?> t, int how) {
    Class<?> ct;
    if (t == Object.class) {
        // no change, ever
    } else if (!t.isPrimitive()) {
        switch (how) {
            case UNWRAP:
                ct = Wrapper.asPrimitiveType(t);
                if (ct != t)  return ct;
                break;
            case RAW_RETURN:
            case ERASE:
                return Object.class;
        }
    } else if (t == void.class) {
        // no change, usually
        switch (how) {
            case RAW_RETURN:
                return int.class;
            case WRAP:
                return Void.class;
        }
    } else {
        // non-void primitive
        switch (how) {
            case WRAP:
                return Wrapper.asWrapperType(t);
            case INTS:
                if (t == int.class || t == long.class)
                    return null;  // no change
                if (t == double.class)
                    return long.class;
                return int.class;
            case LONGS:
                if (t == long.class)
                    return null;  // no change
                return long.class;
            case RAW_RETURN:
                if (t == int.class || t == long.class ||
                    t == float.class || t == double.class)
                    return null;  // no change
                // everything else returns as an int
                return int.class;
        }
    }
    // no change; return null to signify
    return null;
}
 
Example 19
Source File: MethodTypeForm.java    From AndroidComponentPlugin with Apache License 2.0 4 votes vote down vote up
/** Canonicalize the given return or param type.
 *  Return null if the type is already canonicalized.
 */
static Class<?> canonicalize(Class<?> t, int how) {
    Class<?> ct;
    if (t == Object.class) {
        // no change, ever
    } else if (!t.isPrimitive()) {
        switch (how) {
            case UNWRAP:
                ct = Wrapper.asPrimitiveType(t);
                if (ct != t)  return ct;
                break;
            case RAW_RETURN:
            case ERASE:
                return Object.class;
        }
    } else if (t == void.class) {
        // no change, usually
        switch (how) {
            case RAW_RETURN:
                return int.class;
            case WRAP:
                return Void.class;
        }
    } else {
        // non-void primitive
        switch (how) {
            case WRAP:
                return Wrapper.asWrapperType(t);
            case INTS:
                if (t == int.class || t == long.class)
                    return null;  // no change
                if (t == double.class)
                    return long.class;
                return int.class;
            case LONGS:
                if (t == long.class)
                    return null;  // no change
                return long.class;
            case RAW_RETURN:
                if (t == int.class || t == long.class ||
                    t == float.class || t == double.class)
                    return null;  // no change
                // everything else returns as an int
                return int.class;
        }
    }
    // no change; return null to signify
    return null;
}