diff --git a/contrib/jss/invoke.lisp b/contrib/jss/invoke.lisp
index dcd5487..4ed07ae 100644
a
|
b
|
If OBJECT is a symbol it names a dot qualified static FIELD." |
325 | 325 | (jobject-class object)))) |
326 | 326 | (jfield (if (java-object-p field) |
327 | 327 | field |
328 | | (find field (#"getDeclaredFields" class) |
329 | | :key 'jfield-name :test 'equal)))) |
| 328 | (or (find-declared-field field class) |
| 329 | (error "Unable to find a FIELD named ~a for ~a" |
| 330 | field object))))) |
330 | 331 | (#"setAccessible" jfield +true+) |
331 | 332 | (values (#"get" jfield object) jfield)) |
332 | 333 | (if (symbolp object) |
… |
… |
If OBJECT is a symbol it names a dot qualified static FIELD." |
334 | 335 | (jfield class field)) |
335 | 336 | (jfield field object)))) |
336 | 337 | |
| 338 | (defun find-declared-field (field class) |
| 339 | "Return a FIELD object corresponding to the definition of FIELD |
| 340 | \(a string\) visible at CLASS. *Not* restricted to public classes, and checks |
| 341 | all superclasses of CLASS. |
| 342 | Returns NIL if no field object is found." |
| 343 | (loop while class |
| 344 | for field-obj = (get-declared-field class field) |
| 345 | if field-obj |
| 346 | do (return-from find-declared-field field-obj) |
| 347 | else |
| 348 | do (setf class (jclass-superclass class))) |
| 349 | nil) |
| 350 | |
| 351 | (defun get-declared-field (class fieldname) |
| 352 | (find fieldname (#"getDeclaredFields" class) |
| 353 | :key 'jfield-name :test 'equal)) |
| 354 | |
337 | 355 | ;; TODO use #"getSuperclass" and #"getInterfaces" to see whether there |
338 | 356 | ;; are fields in superclasses that we might set |
339 | 357 | (defun set-java-field (object field value &optional (try-harder *running-in-osgi*)) |