This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java 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]

Patch: FYI: interpreter and checkcast message


I'm checking this in on the trunk.  If I remember I'll put it on the
4.0 branch once it reopens (there are a fair number of patches pending
for it ... I hope it reopens soon).

The checkcast opcode in the interpreter put a different, and less
useful, message into the ClassCastException it threw.  I changed this
to use _Jv_CheckCast instead.

Tom

Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>

	* interpret.cc (run) <insn_checkcast, checkcast_resolved>: Use
	_Jv_CheckCast.

Index: interpret.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/interpret.cc,v
retrieving revision 1.51
diff -u -r1.51 interpret.cc
--- interpret.cc 24 Jun 2005 22:04:11 -0000 1.51
+++ interpret.cc 29 Jun 2005 16:15:34 -0000
@@ -25,7 +25,6 @@
 #include <java/lang/StringBuffer.h>
 #include <java/lang/Class.h>
 #include <java/lang/reflect/Modifier.h>
-#include <java/lang/ClassCastException.h>
 #include <java/lang/VirtualMachineError.h>
 #include <java/lang/InternalError.h>
 #include <java/lang/NullPointerException.h>
@@ -3022,8 +3021,7 @@
 	jclass to = (_Jv_Linker::resolve_pool_entry (meth->defining_class,
 						       index)).clazz;
 
-	if (value != NULL && ! to->isInstance (value))
-	  throw new java::lang::ClassCastException (to->getName());
+	value = (jobject) _Jv_CheckCast (to, value);
 
 	PUSHA (value);
 
@@ -3040,8 +3038,7 @@
         SAVE_PC();
 	jobject value = POPA ();
 	jclass to = (jclass) AVAL ();
-	if (value != NULL && ! to->isInstance (value))
-	  throw new java::lang::ClassCastException (to->getName());
+	value = (jobject) _Jv_CheckCast (to, value);
 	PUSHA (value);
       }
       NEXT_INSN;


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