This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: Symbol table resolution
Bryce McKinlay writes:
> Andrew Haley wrote:
> > Bryce McKinlay writes:
> > > Andrew Haley wrote:
> > > > Properly enforcing access rules in libgcj causes problems in that
> > > > compiler-generated code sometimes wants to access private methods.
> > > >
> > > Presumably, this is only because GCJ doesn't generate accessor methods
> > > correctly? [*]
> >
> > No, it's nothing to do with accessor methods.
> >
> > It's purely for optimization: sometimes the compiler generates calls
> > to private methods for things like Class.forName(). We need to make
> > these methods private for security reasons, but the compiler needs to
> > generate calls to them.
> >
> Oh, of course - I forgot about those. In that case, wouldn't it be
> easier (and cleaner) just to maintain a list of these "special" methods
> in the linker that compiler-generated code is allowed to call?
I thought about that. It won't work, because there's no way to
distinguish between a call inserted by the compiler and a rogue app
trying to call those private methods. You really need to know.
Andrew.