public inbox for java-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* PR libgcj/34444: Class.getEnclosingClass() returns null on enclosed class
@ 2008-01-04 17:08 Andrew Haley
  0 siblings, 0 replies; only message in thread
From: Andrew Haley @ 2008-01-04 17:08 UTC (permalink / raw)
  To: java-patches

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-01-04 17:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-04 17:08 PR libgcj/34444: Class.getEnclosingClass() returns null on enclosed class Andrew Haley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).