This is the mail archive of the
kawa@sources.redhat.com
mailing list for the Kawa project.
some patches
- To: kawa at sourceware dot cygnus dot com
- Subject: some patches
- From: ygrats at gmx dot net
- Date: Wed, 9 Aug 2000 11:27:25 +0200 (MEST)
Hi
I encountered some NullPointerExceptions using conversion (as ...),
(instance? ...), and a (IMHO) misleading Error using (make 'class) if class does
not exist.
Here are the patches, that you (Per) could include (maybe something like
these, I'm not sure about the correct naming of the Exception messages ...)
Cheers,
Martin Atzmueller
NullPointerExceptions using 'instance?
;; type does not exist
(set! s 'nil)
(instance? s <kawa.util.FString>)
;; value <-> type
(instance? <java.lang.String> "bla")
Patch:
--- gnu/kawa/reflect/InstanceOf.java Tue Aug 8 17:58:57 2000
+++ gnu/kawa/reflect/InstanceOf.java.new Tue Aug 8 17:33:21 2000
@@ -15,7 +15,13 @@
public Object apply2 (Object arg1, Object arg2)
{
Type type = interpreter.asType(arg2);
- return interpreter.booleanObject(type.isInstance(arg1));
+ Object booleanObject;
+ try {
+ booleanObject = interpreter.booleanObject(type.isInstance(arg1));
+ } catch ( NullPointerException ex ) {
+ throw new WrappedException( "unknown type spec: "+type );
+ }
+ return booleanObject;
}
static gnu.bytecode.ClassType typeType;
===
NullPointerException doing conversion:
(as <foo> 1)
Patch:
--- kawa/standard/convert.java Tue Aug 8 17:58:26 2000
+++ kawa/standard/convert.java.new Tue Aug 8 17:56:13 2000
@@ -20,7 +20,11 @@
public Object apply2 (Object arg1, Object arg2)
{
Type type = (Type) arg1;
+ try {
return type.coerceFromObject (arg2);
+ } catch ( NullPointerException ex ) {
+ throw new WrappedException( "unknown type spec: "+type );
+ }
}
static gnu.bytecode.ClassType typeType;
===
(make <foo>)
==>
java.lang.RuntimeException: make: no method named `<init>' in class foo
Patch:
--- kawa-1.6.70/gnu/kawa/reflect/Invoke.java Tue May 23 04:32:19 2000
+++ kawa-1.6.70-mna/gnu/kawa/reflect/Invoke.java Wed Aug 9 10:50:21 2000
@@ -81,6 +81,13 @@
throw new WrongType(thisProc, 1, null);
mname = Compilation.mangleName(mname);
}
+
+ try {
+ Class.forName( dtype.getName() );
+ } catch ( Exception ex ) {
+ throw new WrappedException( thisProc.getName() + ": class "
+ + arg0.toString() + " not found.", ex
);
+ }
MethodProc proc
= ClassMethods.apply(dtype, mname, null, null,
thisProc.kind=='S' ? Access.STATIC : 0,
--
Homepage: http://jove.prohosting.com/~ygrats/
Mail: ygrats@gmx.net
Sent through GMX FreeMail - http://www.gmx.net