(Object target, String fieldName, Object val)
| 427 | } |
| 428 | |
| 429 | public static Object setInstanceField(Object target, String fieldName, Object val) { |
| 430 | Class c = target.getClass(); |
| 431 | Field f = getField(c, fieldName, false); |
| 432 | if(f != null) |
| 433 | { |
| 434 | try |
| 435 | { |
| 436 | f.set(target, boxArg(f.getType(), val)); |
| 437 | } |
| 438 | catch(IllegalAccessException e) |
| 439 | { |
| 440 | throw Util.sneakyThrow(e); |
| 441 | } |
| 442 | return val; |
| 443 | } |
| 444 | throw new IllegalArgumentException("No matching field found: " + fieldName |
| 445 | + " for " + target.getClass()); |
| 446 | } |
| 447 | |
| 448 | // not used as of Clojure 1.6, but left for runtime compatibility with |
| 449 | // compiled bytecode from older versions |
no test coverage detected