Starting November 9th,'s Gitlab instance has implemented a more open account policy, allowing anyone with a GitHub or Google account to create an account on our instance.

At the same time, the login policy has started to require 2-factor authentication (2FA).

See for discussion.

Specialize print-java-object-by-class to use java class-specific print method

(Alan Ruttenberg)


    (defmethod java::print-java-object-by-class
        ((class (eql ':||))
         obj stream)
      (print 'hi)

From <>.

Merges <>.
parent bae34d25
......@@ -457,12 +457,29 @@ is equivalent to the following Java code:
;;; print-object
(defmethod print-object ((obj java:java-object) stream)
(print-java-object-by-class (intern (jclass-name (jobject-class obj)) 'keyword) obj stream))
;;define extensions by eql methods on class name interned in keyword package
;;e.g. (defmethod java::print-java-object-by-class ((class (eql ':||)) obj stream)
;; (print 'hi)
;; (call-next-method))
(defmethod print-java-object-by-class :around (class obj stream)
(handler-bind ((java-exception #'(lambda(c)
(format stream "#<~a, while printing a ~a>"
(jcall "toString" (java-exception-cause c))
(jcall "getName" (jcall "getClass" obj)))
(return-from print-object))))
(write-string (sys::%write-to-string obj) stream)))
(return-from print-java-object-by-class))))
;; we have to do our own inheritence for the java class
(defmethod print-java-object-by-class (class obj stream)
(loop for super = class then (jclass-superclass super)
for keyword = (intern (jcall "getName" super) 'keyword)
for method = (find-method #'print-java-object-by-class nil (list `(eql ,keyword) t t) nil)
while (jclass-superclass super)
when method do (return-from print-java-object-by-class
(print-java-object-by-class keyword obj stream)))
(write-string (sys::%write-to-string obj) stream))
(defmethod print-object ((e java:java-exception) stream)
(handler-bind ((java-exception #'(lambda(c)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment