code: static boolean isBshAssignable( Class toType, Class fromType )
      {
          try {
              return castObject(
                  toType, fromType, null/*fromValue*/,
                  ASSIGNMENT, true/*checkOnly*/
              ) == VALID_CAST;
          } catch ( UtilEvalError e ) {
              // This should not happen with checkOnly true
              throw new InterpreterError("err in cast check: "+e, e);
          }
      }
docs: Test if a type can be converted to another type via BeanShell
  extended syntax rules (a superset of Java conversion rules).