[Bug java/19870] gcj -C doesn't generate accessors for private members in inner class
mckinlay at redhat dot com
gcc-bugzilla@gcc.gnu.org
Wed Mar 9 18:57:00 GMT 2005
------- Additional Comments From mckinlay at redhat dot com 2005-03-09 18:22 -------
gcj is generating code which references private members across class boundaries,
which isn't legal at the class/VM level. To fix this, we need to generate
package-private accessor methods when a private member is referenced from an
enclosed or enclosing class.
eg: jikes generates:
Method name:"main" public static Signature: (java.lang.String[])void
Attribute "Code", length:38, max_stack:2, max_locals:1, code_length:10
0: getstatic <Field java.lang.System.out java.io.PrintStream>
3: invokestatic <Method A$B.access$0 ()int>
6: invokevirtual <Method java.io.PrintStream.println (int)void>
9: return
Attribute "LineNumberTable", length:10, count: 2
line: 10 at pc: 0
line: 11 at pc: 9
Method name:"access$0" static Signature: ()int
Attribute "Synthetic", length:0
Attribute "Code", length:28, max_stack:1, max_locals:0, code_length:4
0: getstatic <Field A$B.i int>
3: ireturn
Attribute "LineNumberTable", length:6, count: 1
line: 3 at pc: 0
--
What |Removed |Added
----------------------------------------------------------------------------
Summary|gcj -C compiled code |gcj -C doesn't generate
|accessing private fields of |accessors for private
|inner classes from outer |members in inner class
|class give |
|IllegalAccessError |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19870
More information about the Java-prs
mailing list