On Apr 3, 2010, at 11:38, Bill Janssen <[email protected]> wrote:
Does JCC support templated types yet?
Yes, Lucene Java moved to Java 5 and makes extensive use of generics
in the 3.x release series.
I added support for that in JCC 2.5.
In particular, I'd like to be able to say,
--sequence List<com.parc.goodstuff.Stuff>
'size:()I'
'get:(I)Lcom/parc.goodstuff.Stuff;'
The first arg to --sequence is that of an existing class, and the
following, the actual signatures of existing methods on it.
If you define a class foo parameterized on type T and that type is the
return type of a method, that type is used, at runtime, as the wrapper
for the return value.
JCC does not generate code for all known expansions of a generic class
- that would lead to serious code explosion. Instead, the python
instance of an instatiated parameterized java class contains the type
parameters used and the wrapper methods use them to produce python
return objects or accept python parameters of the expected types.
The support for generics is good enough for Lucene's usage - not
bad:-) - but may have some holes and bugs still. I recently fixed a
bug on trunk with failing to inherit type parameters to inner classes,
for example.
Also, there doesn't seem to be a way, from python, to directly
instantiate a class passing it type parameters. There is from C++, of
course. Consider that an oversight. I should add support for that.
If you'd like to see the parameters of an instance of a class you know
is parameterized, use the parameters_ property.
Andi..
Bill