This is the mail archive of the
kawa@sources.redhat.com
mailing list for the Kawa project.
Re: primitive-throw wraps all exceptions (was: Kawa wraps Java exceptions unexpectedly)
- To: Jocelyn Paine <popx at pop3 dot ifs dot org dot uk>
- Subject: Re: primitive-throw wraps all exceptions (was: Kawa wraps Java exceptions unexpectedly)
- From: Per Bothner <per at bothner dot com>
- Date: Mon, 08 Oct 2001 12:51:14 -0700
- CC: kawa at sourceware dot cygnus dot com
- References: <Pine.LNX.4.10.10110080753120.3670-100000@pop3.ifs.org.uk>
Jocelyn Paine wrote:
>As for implementation, I understand that in Java, the exceptions would
>need to be declared. Is this also required by the JVM? In other words, if
>method M throws a gnu.text.SyntaxException, say, but its translation into
>JVM doesn't declare this, is it then invalid JVM code?
>
The JVM (and the verifier, I believe) ignores "throws" specification.
The problem is Java code that implements or calls Scheme code.
For example PrimProcedure's applyV method does not have a throws
clause, so it cannot throw checked exceptions.
The orgin Kawa used throws clauses, but it was clumsy, so I threw
them out. However, it occurred to me that it might be reasonable
to just say that all "apply" and similar methods (such as "eval")
could be just declared to throw Exception (or perhaps just Throwable).
Then we wouldn't need wrappers. This could be consistent with an
future extension that allows you to specify a throws clause for a Scheme
procedure - if you don't specify one, the default is 'throws Exceptions'
However, this is a rather drastic change, and would need more thought
and experimentation..