Using CNI on inner classes
Bryce McKinlay
bmckinlay@gmail.com
Thu Aug 13 10:07:00 GMT 2009
On Thu, Aug 13, 2009 at 10:10 AM, Andrew Haley<aph@redhat.com> wrote:
> If the method is declared private, it really will be private, even
> to cni.
>
> If you really need to breach privacy, you can do this in Test$Inner.h:
>
> class Test$Inner : public ::java::lang::Object
> {
> friend class ::Test;
>
> but I can't really see the point of private methods in an inner class
> that you actually intend to be called from the enclosing class.
In Java the private methods are accessible to the enclosing class. So,
ideally gcjh would add friend declarations, like the above,
automatically to inner classes to approximate the Java semantics.
But, the easiest fix here is just to make the private method
package-private instead.
More information about the Java
mailing list