This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Allow array method invocations to be resolved in Object
- From: Andrew Haley <aph at redhat dot com>
- To: java-patches at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Thu, 9 Feb 2006 11:35:08 +0000
- Subject: Allow array method invocations to be resolved in Object
Recent Java compilers generate invocations of nonexistent (and, in
fact, impossible to declare) methods like boolean[].clone(). This
works because Object is a superclass of every class, so such methods
are resolved in Object.
Unfortunately, libgcj cannot cope with this, and fails with
java.lang.ClassNotFoundException: boolean[] not found in
gnu.gcj.runtime.SystemClassLoader{urls=[file:./], parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}
The Right Thing to do in the long term is to correct libgcj so that it
can cope with methods like boolean[].clone(). However, in the
meantime it's cleaner simply to tweak the compiler to resolve such
methods in Object.
This is the root cause of
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=180418
Andrew.
Index: expr.c
===================================================================
--- expr.c (revision 110710)
+++ expr.c (working copy)
@@ -2279,6 +2279,7 @@
superclass chain when we're BC-compiling. */
if (! flag_verify_invocations
&& method
+ && ! TYPE_ARRAY_P (self_type)
&& self_type != DECL_CONTEXT (method))
method = NULL_TREE;