Re: Using CNI on inner classes
Bryce McKinlay <[email protected]>
| Newsgroups | gmane.comp.gcc.java.devel |
|---|---|
| Message-ID | <[email protected]> |
On Thu, Aug 13, 2009 at 10:10 AM, Andrew Haley<[email protected]> 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.