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]
Other format: [Raw text]

Re: crashing Kawa with a boolean field


Jim White wrote:

That to me looks like a bug in java.util.Hashtable, not Kawa ...

Actually that NPE is a null key parameter to Hashtable.get.

My point was that the specification Hashtable.get does not specify any "throws" nor does it say that null is disallowed. Of course Sun no longer believes in specification: The implementtion is the specification. (Sun people have told me this.)



The origin of that is probably gnu.bytecode.PrimType.emitCoerceToObject line 78 which is a case with this:


default: cname = null;

Aha! I have't tried the attached patch (partl;y because I don't have an actual testcase, and partly because I need to get ready for a trip), so I don't know if it solved the problem, it it sure seems appropriate.


There also seems to be a mismatch in type naming between PrimType.emitCoerceToObject (which is using full java.lang class names) and Type.lookupType (which is using short Java source names for primitives).

That is intended and correct, I believe.


A side note on the initialization of the mapNameToType static in Type. Using a static initializer would eliminate the null check and provide class loading synchronization for free.

That may be reasonable. I prefer to defer unneeded initialization, but that may make synchronization difficult. (There some example of "double-locking" in Kawa, which I now read is consider a dubious idiom.)
--
--Per Bothner
per@bothner.com http://per.bothner.com/


--- PrimType.java~	Sun Apr 27 22:00:39 2003
+++ PrimType.java	Wed Jun 18 07:59:18 2003
@@ -67,7 +67,7 @@
 	code.emitElse();
 	code.emitGetStatic(clas.getDeclaredField("FALSE"));
 	code.emitFi();
-	break;
+	return;
       case 'C':  cname = "java.lang.Character"; break;
       case 'B':  cname = "java.lang.Byte";      break;
       case 'S':  cname = "java.lang.Short";     break;

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