This is the mail archive of the kawa@sources.redhat.com mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Bug in Kawa 1.6.70 - try-catch in value context


I've been using Kawa as a vehicle to move a heap of SIOD code into Java
portability space, and so far it's been really impressive.  I was able
to go from minimal Java experience to knowledgeably cursing the Java
theading model in about two days with Kawa's help.

I have run into a bug, though.  The following code causes Kawa 1.6.70 to
crap out:

(define (foo a) a)

(foo
  (try-catch 'form
             (__error <kawa.lang.NamedException>
                      'form)))

As follows:

---------------------------------------

bane@shiny:~/kawa-1.6.70 > java kawa.repl
#|kawa:1|# (define (foo a) a)
#|kawa:2|# (foo
  (try-catch 'form
             (__error <kawa.lang.NamedException>
                      'form)))
#|)---:3|# #|)---:4|# #|)---:5|# Exception in thread "main"
java.lang.VerifyError: (class: atInteractiveLevel, method: run
signature: ()Ljava/lang/Object;) Accessing value from uninitialized
register 2
         at java.lang.Class.getField0(Native Method)
         at java.lang.Class.getDeclaredField(Class.java:1113)
         at gnu.expr.LambdaExp.evalToClass(LambdaExp.java:1340)
         at gnu.expr.LambdaExp.eval(LambdaExp.java:1371)
         at gnu.expr.ModuleExp.evalModule(ModuleExp.java:39)
         at kawa.Shell.run(Shell.java:85)
         at kawa.Shell.run(Shell.java:35)
         at kawa.Shell.run(Shell.java:19)
         at kawa.repl.main(repl.java:356)
bane@shiny:~/kawa-1.6.70 >

--------------------------------------

The same thing happens on two different Javas (jdk1.3 on Linux/x86, Java 
from Mac OS X), so I don't think this is a JVM feature.  This only 
happens when the try-catch is in a value context that doesn't 
open-code - things like (list (try-catch ...)) work.  I haven't been
able to get into anoncvs.cygnus.com, or I would have tried this with a
more recent Kawa.

I ran into this in the context of porting some SIOD code to Kawa - my 
calls to try-catch are going to be buried in compatibility macros, so I 
have a potential workaround of not using try-catch for its value 
directly - doing:

(let ((__result ()))
        (try-catch (set! __result (stuff...))
                (__error ... (set! __result (error-stuff)))
		...)
        __result)

instead of macroexpanding directly into try-catch, so I don't intend to
give up on Kawa because of this.
-- 
Robert Bane
Global Science & Technology
6411 Ivy Lane, Suite 300
Greenbelt MD 20770
301-474-9696 FAX:301-474-5970


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]