code: public boolean isCastable(Type t, Type s, Warner warn) {
          if (t == s)
              return true;
          if (t.isPrimitive() != s.isPrimitive()) {
              t = skipTypeVars(t, false);
              return (isConvertible(t, s, warn)
                      || (allowObjectToPrimitiveCast &&
                          s.isPrimitive() &&
                          isSubtype(boxedClass(s).type, t)));
          }
          if (warn != warnStack.head) {
              try {
                  warnStack = warnStack.prepend(warn);
                  checkUnsafeVarargsConversion(t, s, warn);
                  return isCastable.visit(t,s);
              } finally {
                  warnStack = warnStack.tail;
              }
          } else {
              return isCastable.visit(t,s);
          }
      }
docs: Is t is castable to s?<br>
  s is assumed to be an erased type.<br>
  (not defined for Method and ForAll types).