(Class<?> src, Class<?> target)
| 415 | * This class duplicates code in jakarta.el.Util. When making changes keep the code in sync. |
| 416 | */ |
| 417 | private static boolean isAssignableFrom(Class<?> src, Class<?> target) { |
| 418 | // src will always be an object |
| 419 | // Short-cut. null is always assignable to an object and in EL null |
| 420 | // can always be coerced to a valid value for a primitive |
| 421 | if (src == null) { |
| 422 | return true; |
| 423 | } |
| 424 | |
| 425 | Class<?> targetClass; |
| 426 | if (target.isPrimitive()) { |
| 427 | if (target == Boolean.TYPE) { |
| 428 | targetClass = Boolean.class; |
| 429 | } else if (target == Character.TYPE) { |
| 430 | targetClass = Character.class; |
| 431 | } else if (target == Byte.TYPE) { |
| 432 | targetClass = Byte.class; |
| 433 | } else if (target == Short.TYPE) { |
| 434 | targetClass = Short.class; |
| 435 | } else if (target == Integer.TYPE) { |
| 436 | targetClass = Integer.class; |
| 437 | } else if (target == Long.TYPE) { |
| 438 | targetClass = Long.class; |
| 439 | } else if (target == Float.TYPE) { |
| 440 | targetClass = Float.class; |
| 441 | } else { |
| 442 | targetClass = Double.class; |
| 443 | } |
| 444 | } else { |
| 445 | targetClass = target; |
| 446 | } |
| 447 | return targetClass.isAssignableFrom(src); |
| 448 | } |
| 449 | |
| 450 | |
| 451 | /* |
no test coverage detected