This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: Multiple file compilation patch
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;
}