From: Peter G. <pe...@ar...> - 2005-11-06 20:50:18
|
On Sun, 6 Nov 2005 at 19:52:00 +0100, Andras Simon wrote: > On Fri, 4 Nov 2005, Peter Graves wrote: > > There's a fundamental (and, I think, necessary) schizophrenia in ABCL's > > condition system: conditions defined in the *.java source files are > > instanceof Condition, but conditions defined by DEFINE-CONDITION are > > normal STANDARD-OBJECTs. > > > > Is this the reason for the following? > > CL-USER(1): (define-condition throwable (java-exception) ()) > THROWABLE > CL-USER(2): (register-java-exception "java.lang.Throwable" 'throwable) > T > CL-USER(3): (handler-case > (jnew (jconstructor "java.lang.String" "java.lang.String") > (make-immediate-object nil :ref)) > (throwable (c) c)) > #<THROWABLE {F1CDFB}> > CL-USER(4): (java-exception-cause *) > Debugger invoked on condition of type TYPE-ERROR: > The value #<THROWABLE {F1CDFB}> is not of type JAVA-EXCEPTION. > Restarts: > 0: TOP-LEVEL Return to top level. > [1] CL-USER(5): :res > CL-USER(6): (typep * 'java-exception) > T > CL-USER(7): > > That there is an error is fine, since I haven't updated Java.java. (I > plan to do that soon, by the way.) But the message is quite > misleading. Yes, JAVA-EXCEPTION-CAUSE was expecting its argument to be instanceof Condition, but a THROWABLE is just a STANDARD-OBJECT. Fixing that bug exposed a printing bug with UNBOUND-SLOT conditions, which I've also fixed. So now it works (or at least signals a plausible error): CL-USER(1): (define-condition throwable (java-exception) ()) THROWABLE CL-USER(2): (register-java-exception "java.lang.Throwable" 'throwable) T CL-USER(3): (handler-case (jnew (jconstructor "java.lang.String" "java.lang.String") (make-immediate-object nil :ref)) (throwable (c) c)) #<THROWABLE {1ABA308}> CL-USER(4): (java-exception-cause *) Debugger invoked on condition of type UNBOUND-SLOT: The slot SYSTEM::CAUSE is unbound in the object #<THROWABLE {1ABA308}>. Restarts: 0: TOP-LEVEL Return to top level. [1] CL-USER(5): There are probably more bugs like this lurking in the condition system, pending the completion of a thorough cleanup pass. -Peter |