code: static boolean isJavaBoxTypesAssignable(
          Class lhsType, Class rhsType )
      {
          // Assignment to loose type... defer to bsh extensions
          if ( lhsType == null )
              return false;
  
          // prim can be boxed and assigned to Object
          if ( lhsType == Object.class )
              return true;
  
          // null rhs type corresponds to type of Primitive.NULL
          // assignable to any object type but not array
          if (rhsType == null)
              return !lhsType.isPrimitive() && !lhsType.isArray();
  
          // prim numeric type can be boxed and assigned to number
          if ( lhsType == Number.class
              && rhsType != Character.TYPE
              && rhsType != Boolean.TYPE
          )
              return true;
  
          // General case prim type to wrapper or vice versa.
          // I don't know if this is faster than a flat list of 'if's like above.
          // wrapperMap maps both prim to wrapper and wrapper to prim types,
          // so this test is symmetric
          if ( Primitive.wrapperMap.get( lhsType ) == rhsType )
              return true;
  
          return isJavaBaseAssignable(lhsType, rhsType);
      }
docs: Determine if the type is assignable via Java boxing/unboxing rules.