Lines Matching refs:cast

74     static int unboxInteger(Object x, boolean cast) {
77 return primitiveConversion(Wrapper.INT, x, cast).intValue();
80 static byte unboxByte(Object x, boolean cast) {
83 return primitiveConversion(Wrapper.BYTE, x, cast).byteValue();
86 static short unboxShort(Object x, boolean cast) {
89 return primitiveConversion(Wrapper.SHORT, x, cast).shortValue();
92 static boolean unboxBoolean(Object x, boolean cast) {
95 return (primitiveConversion(Wrapper.BOOLEAN, x, cast).intValue() & 1) != 0;
98 static char unboxCharacter(Object x, boolean cast) {
101 return (char) primitiveConversion(Wrapper.CHAR, x, cast).intValue();
104 static long unboxLong(Object x, boolean cast) {
107 return primitiveConversion(Wrapper.LONG, x, cast).longValue();
110 static float unboxFloat(Object x, boolean cast) {
113 return primitiveConversion(Wrapper.FLOAT, x, cast).floatValue();
116 static double unboxDouble(Object x, boolean cast) {
119 return primitiveConversion(Wrapper.DOUBLE, x, cast).doubleValue();
129 private static MethodHandle unbox(Wrapper wrap, boolean cast) {
130 EnumMap<Wrapper, MethodHandle> cache = UNBOX_CONVERSIONS[(cast?1:0)];
155 mh = MethodHandles.insertArguments(mh, 1, cast);
160 + (cast ? " (cast)" : ""));
184 public static Number primitiveConversion(Wrapper wrap, Object x, boolean cast) {
185 // Maybe merge this code with Wrapper.convert/cast.
188 if (!cast) return null;
202 if (xwrap == null || !cast && !wrap.isConvertibleFrom(xwrap))
204 return (Number) wrap.wrapperType().cast(x);
380 // use zeroInt and cast the result
447 * Identity function, with reference cast.
454 // inlined Class.cast because we can't ForceInline it
461 return new ClassCastException("Cannot cast " + obj.getClass().getName() + " to " + t.getName());
473 //CAST_REFERENCE = IMPL_LOOKUP.findVirtual(Class.class, "cast", idType);
556 public static MethodHandle cast(Class<?> type) {
557 if (type.isPrimitive()) throw new IllegalArgumentException("cannot cast primitive type "+type);