Test if a type can be converted to another type via BeanShell extended syntax rules (a superset of Java conversion rules).
( Class toType, Class fromType )
| 366 | extended syntax rules (a superset of Java conversion rules). |
| 367 | */ |
| 368 | static boolean isBshAssignable( Class toType, Class fromType ) |
| 369 | { |
| 370 | try { |
| 371 | return castObject( |
| 372 | toType, fromType, null/*fromValue*/, |
| 373 | ASSIGNMENT, true/*checkOnly*/ |
| 374 | ) == VALID_CAST; |
| 375 | } catch ( UtilEvalError e ) { |
| 376 | // This should not happen with checkOnly true |
| 377 | throw new InterpreterError("err in cast check: "+e); |
| 378 | } |
| 379 | } |
| 380 | |
| 381 | /** Find array element type for class. |
| 382 | * Roll back component type until class is not an array anymore. |
no test coverage detected