[pylucene-dev] no stubs for inner classes

Andi Vajda vajda at osafoundation.org
Wed Mar 5 19:14:27 PST 2008


On Wed, 5 Mar 2008, Bill Janssen wrote:

> So, I'm stubbing a class that looks like this:
>
>  class GoodStuff {
>
>      public static class Frob {
>      }
>
>  }
>
> I invoke JCC with "--classpath MyJar.jar GoodStuff GoodStuff$Frob",
> which it's happy with, but I can't find any evidence that it generates
> any support for GoodStuff.Frob.
>
> I think the problem is that I should be saying "GoodStuff.Frob", but
> that doesn't seem to work because of this code in jcc/cpp.py:
>
>    cls = env.findClass(className.replace('.', '/'))

No, the className for findClass (and the corresponding .class file) would be 
named GoodStuff$Frob. This is how inner classes are named.

In other words, a class inner class called Frob inside GoodStuff which is 
sitting in some package named oh.my.cool.stuff would correspond to a class 
name for JNI's findClass() of "oh/my/cool/stuff/GoodStuff$Frob" and to a 
file named <classpath>/oh/my/cool/stuff/GoodStuff$Frob.class

To see if jcc generated anything for your inner class, see if you have a 
header file called oh/my/cool/stuff/GoodStuff$Frob.h somewhere.

Also, make sure your classes are public. In your example, GoodStuff is not.
It's package access.

Andi..


More information about the pylucene-dev mailing list