PR java/19870: Generate Synthetic Accessors For Static Private Field Accesses Across Nested Classes

Ranjit Mathew rmathew@gmail.com
Thu May 26 09:43:00 GMT 2005


Hi,

  Here is a patch for PR java/19870. This patch generalises
the current synthetic accessor generation support in GCJ for
private fields in outer classes accessed from nested classes
to additionally support:

  1. private *static* fields

  2. access to private static fields *inside nested classes*
     (the original testcase given in PR19870)

  3. access from a nested class to a private static field
     in a "sibling" nested class.

The attached testsuite patch demonstrates what is now
possible to support in GCJ with this patch.

For static accessors, the initial "this$" parameter
is ommitted now.

Since the accessors work both ways now, I've renamed
all "*outer_field*" methods and macros to "*nested_field*"
for lack of a better name and updated their documentation.

Tested on i686-pc-linux-gnu with Jacks included. The Jacks
testresults were rather disappointing:

  FAIL: 8.5.2-accessible-static-member-usage-3
  FAIL: 15.8.4-static-2

The first is a failure to consider "foo" constant
in "case foo:" for a switch statement, where foo is
an outer field. The second is a slight corner case
that used to mistakenly pass earlier. I vote to
just XFAIL these two for now.

OK for mainline? Assuming the patch as such is
OK, is the attached testsuite addition also OK?

The new testcase demonstrates all the static
field access (read/write) combinations that
work correctly now.

Thanks,
Ranjit.

-- 
Ranjit Mathew      Email: rmathew AT gmail DOT com

Bangalore, INDIA.    Web: http://ranjitmathew.hostingzero.com/
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: pr19870.txt
URL: <http://gcc.gnu.org/pipermail/java-patches/attachments/20050526/5dc99366/attachment.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: pr19870tests.txt
URL: <http://gcc.gnu.org/pipermail/java-patches/attachments/20050526/5dc99366/attachment-0001.txt>


More information about the Java-patches mailing list