This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
PR libgcj/34444: Class.getEnclosingClass() returns null on enclosed class
- From: Andrew Haley <aph at redhat dot com>
- To: java-patches at gcc dot gnu dot org
- Date: Fri, 4 Jan 2008 17:08:33 +0000
- Subject: PR libgcj/34444: Class.getEnclosingClass() returns null on enclosed class
Another case where Sun's javadoc was rather vague.
Andrew.
2008-01-04 Andrew Haley <aph@redhat.com>
PR libgcj/34444
* java/lang/natClass.cc (Class::getEnclosingClass): Call
getDeclaringClass().
Index: natClass.cc
===================================================================
--- natClass.cc (revision 131034)
+++ natClass.cc (working copy)
@@ -1043,7 +1043,8 @@
_Jv_word indexes;
indexes.i = getEnclosingMethodData();
if (indexes.i == 0)
- return NULL;
+ // No enclosing method, but perhaps a member or anonymous class
+ return getDeclaringClass();
_Jv_ushort class_index, method_index;
_Jv_loadIndexes (&indexes, class_index, method_index);
return _Jv_Linker::resolve_pool_entry (this, class_index).clazz;
--
Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, UK
Registered in England and Wales No. 3798903