This is the mail archive of the
java-discuss@sourceware.cygnus.com
mailing list for the Java project.
Re: FAQ Update
>>>>> "Bryce" == Bryce McKinlay <bryce@albatross.co.nz> writes:
Bryce> Obviously, only a classes own native method's should be allowed
Bryce> access to its private fields and methods. We should really fix
Bryce> the offending code if privates are somehow being accessed
Bryce> outside the class, so this heuristic sounds like it would be a
Bryce> sufficient fix.
I looked, and I now believe we only violate protection for protected
or "default" fields. I think private fields really are private right
now. I saw this because gcjh translates private Java fields into
private C++ fields, meaning we can't violate that protection in native
code. Java protected/default fields are translated to C++ public
fields.
I think it would be nice to have a gcjh flag to translate Java
protected/default to something else in C++ (protected, perhaps), to
enable stricter (but not really identical-to-Java) protection for
developers who want it. Any comments? If people like this idea, I'll
submit a PR (for now; someday we'll rewrite gcjh...).
Tom