jdk/src/java.base/share/classes/sun/invoke/util/Wrapper.java
changeset 44591 b9bf065070fe
parent 44590 15a77e5b7612
equal deleted inserted replaced
44590:15a77e5b7612 44591:b9bf065070fe
   516      * If the target type is an interface, perform no runtime check.
   516      * If the target type is an interface, perform no runtime check.
   517      * (This loophole is safe, and is allowed by the JVM verifier.)
   517      * (This loophole is safe, and is allowed by the JVM verifier.)
   518      * If the target type is a primitive, change it to a wrapper.
   518      * If the target type is a primitive, change it to a wrapper.
   519      */
   519      */
   520     static <T> Class<T> forceType(Class<?> type, Class<T> exampleType) {
   520     static <T> Class<T> forceType(Class<?> type, Class<T> exampleType) {
   521         boolean z = (type == exampleType ||
       
   522                type.isPrimitive() && forPrimitiveType(type) == findWrapperType(exampleType) ||
       
   523                exampleType.isPrimitive() && forPrimitiveType(exampleType) == findWrapperType(type) ||
       
   524                type == Object.class && !exampleType.isPrimitive());
       
   525         if (!z)
       
   526             System.out.println(type+" <= "+exampleType);
       
   527         assert(type == exampleType ||
   521         assert(type == exampleType ||
   528                type.isPrimitive() && forPrimitiveType(type) == findWrapperType(exampleType) ||
   522                type.isPrimitive() && forPrimitiveType(type) == findWrapperType(exampleType) ||
   529                exampleType.isPrimitive() && forPrimitiveType(exampleType) == findWrapperType(type) ||
   523                exampleType.isPrimitive() && forPrimitiveType(exampleType) == findWrapperType(type) ||
   530                type == Object.class && !exampleType.isPrimitive());
   524                type == Object.class && !exampleType.isPrimitive());
   531         @SuppressWarnings("unchecked")
   525         @SuppressWarnings("unchecked")