This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[gcjx] Patch: FYI: fix this$0 access


I'm checking this in on the gcjx branch.

We were generating a private this$0, but this makes it harder for
inner classes to access via multiple layers of outer class.  (gcj
takes this approach and generates accessor methods for its synthetic
this$0 fields... gross.)  It is simpler to make this field
package-private and it is safe as well (this is what jikes does).

Chris Burdess found this bug while doing testing on
builder.classpath.org.

Tested against jacks on x86 FC4.

Tom

Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>

	* model/class.cc (get_this_0): Make this$0 package-private.

Index: model/class.cc
===================================================================
--- model/class.cc	(revision 108950)
+++ model/class.cc	(working copy)
@@ -1,6 +1,6 @@
 // Class representation.
 
-// Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+// Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
 //
 // This file is part of GCC.
 //
@@ -637,11 +637,10 @@
 			   new model_forwarding_resolved (get_location (),
 							  declaring_class),
 			   this);
-      // Note that it might be possible for us to inherit this$0
-      // from our superclass.  We could do this if we made it
-      // package-private, and if our superclass was an inner class
-      // of our declaring class.  FIXME?
-      this_0->set_modifiers (ACC_PRIVATE | ACC_FINAL);
+      // Make the new field package-private.  This lets any inner
+      // classes of this more easily access our outer class -- no
+      // accessor methods will be required.
+      this_0->set_modifiers (ACC_FINAL);
       this_0->set_synthetic ();
 
       assert (resolution_state >= POST_MEMBERS);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]