This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Re: Multiple file compilation patch
- To: Bryce McKinlay <bryce at albatross dot co dot nz>
- Subject: Re: Multiple file compilation patch
- From: Mark Wielaard <mark at klomp dot org>
- Date: Sun, 18 Mar 2001 23:51:33 +0100
- Cc: java at gcc dot gnu dot org, java-patches at gcc dot gnu dot org
- References: <3AB4507B.D056E9F@albatross.co.nz> <m2itl7v6ss.fsf@kelso.bothner.com> <3AB48BFD.50667AA8@albatross.co.nz> <20010318145100.A9869@klomp.org> <20010318170211.A23414@klomp.org> <20010318223159.A1678@klomp.org> <3AB52FDD.EBDC4B23@albatross.co.nz>
Hi,
On Mon, Mar 19, 2001 at 09:59:57AM +1200, Bryce McKinlay wrote:
>
> Can you tell what its trying to cast to what? I've seen this kind of
> thing happen when compiling from class files, or when compiling a mixture
> of class/source files.
By making the following patch to _Jv_CheckCast I can now see what is being
cast to what:
2001-03-18 Mark Wielaard <mark@klomp.org>
* java/lang/natClass.cc (_Jv_CheckCast): add class names to exception
OK to commit?
I now get the following StackTrace:
$ gkjc CompilerCheck.java 2>&1 | head
Exception in thread "main" java.lang.ClassCastException: at.dms.classfile.ClassConstant cannot be cast to at.dms.classfile.NameAndTypeConstant
at 0x401ab81a: java.lang.Throwable.Throwable(java.lang.String) (/usr/local/gcc/lib/libgcj.so.1)
at 0x4019f9e1: java.lang.Exception.Exception(java.lang.String) (/usr/local/gcc/lib/libgcj.so.1)
at 0x401a3f21: java.lang.RuntimeException.RuntimeException(java.lang.String) (/usr/local/gcc/lib/libgcj.so.1)
at 0x4019de31:
java.lang.ClassCastException.ClassCastException(java.lang.String) (/usr/local/gcc/lib/libgcj.so.1)
at 0x4018bf82: _Jv_CheckCast (/usr/local/gcc/lib/libgcj.so.1)
at 0x0817fdf8: at.dms.classfile.UnresolvedConstant.resolveConstant(at.dms.classfile.PooledConstant[]) (/home/mark/src/KopiSusu/allsrc/src/at/dms/classfile/UnresolvedConstant.java:0)
at 0x0816ba4a: at.dms.classfile.ConstantPool.ConstantPool(java.io.DataInput)
(/home/mark/src/KopiSusu/allsrc/src/at/dms/classfile/ConstantPool.java:0)
[... etc ...]
And a ClassConstant really cannot be cast to a NameAndTypeConstant.
But I don't know how the code reached this point.
Cheers,
Mark
--
Stuff to read:
<http://www.toad.com/gnu/whatswrong.html>
What's Wrong with Copy Protection, by John Gilmore
Index: java/lang/natClass.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/lang/natClass.cc,v
retrieving revision 1.37
diff -u -u -r1.37 natClass.cc
--- natClass.cc 2001/02/14 05:32:31 1.37
+++ natClass.cc 2001/03/18 22:50:15
@@ -983,7 +983,12 @@
{
if (__builtin_expect
(obj != NULL && ! _Jv_IsAssignableFrom(c, JV_CLASS (obj)), false))
- JvThrow (new java::lang::ClassCastException);
+ JvThrow (new java::lang::ClassCastException
+ ((new java::lang::StringBuffer
+ (obj->getClass()->getName()))->append
+ (JvNewStringUTF(" cannot be cast to "))->append
+ (c->getName())->toString()));
+
return obj;
}