On Sat, 11 Jun 2011, Christian Heimes wrote:
Am 09.06.2011 19:13, schrieb Andi Vajda:
If there is a way to get at Java docstrings from the Java reflection API,
then that would be a very cool addition to JCC !
I'm not a Java expert but that shouldn't be possible. As far as I know
Java, the reflection API only works on compiled Java code. Contrary to
Python, Java byte code doesn't contain any doc strings. In order to get
the doc strings, you would have to pull the doc strings from the java
source code files.
I suggest another approach. You could use javadoc to dump the doc
strings as XML. Then you can parse the file during JCC run and add the
doc strings from the XML file. I recommend that you make doc strings
generation optional and disabled by default. Doc strings may increase
the size of a JCC module A LOT.
In the mean time you could just include the method signature(s) in the
doc strings. JCC already has all information of a method or class
constructor.
Yes, this approach would work quite well !
In jcc/python.py, where the C++ code generation for the Python layer is
implemented, the doc strings previously extracted with javadoc could be
added to the DECLARE_TYPE/METHOD/*FIELD macro calls.
Andi..