On Wed, 17 Jun 2009, Ludovico Cavedon wrote:
I tried to run JCC on HtmlUnit [1]. I managed to get it working, but I had to hack JCC code. Here are the issues I had: I think it would be worth to fix them on the JCC codebase.
Definitely. If you could send in a patch with your changes, that would be best. More comments inline.
I am using the latest snapshot of JCC * If I get an error jcc.cpp.JavaError: java.lang.ExceptionInInitializerError I actually added a "print className" to understand which class was causing the error * org.mozilla.javascript.SecureCaller and com.gargoylesoftware.htmlunit.javascript.host.ActiveXObjectImpl cause a jcc.cpp.JavaError: java.lang.ExceptionInInitializerError If I use --exclude it does not work either, because findClass() is called anyway and it will trigger the exception My workaround was by skipping the classes in the cpp.py code. I could not understand why the though that exception...
It could be that the class could not be loaded because of some native code required by the class in a shared library that was not found. This would need to be fixed by adding yet another command line flag that adds to the initVM() call in cpp.py a java.lib.path to use with the VM.
* org.mozilla.javascript.ScriptableObject defined constants like: static int READONLY However the file /usr/include/python2.6/structmember.h contains: #define READONLY 1 which will replace "READONLY" with "1" when compiling the code generated by JCC How do you think it should be handled? My workaround was to "#undef XXX" before every "static yyy XXX".
You can add that word as a reserved word using the --reserved flag. Or, you can edit the RESERVED list in cpp.py and add that word to it for good.
* org.mozilla.javascript.ScriptableObject defines a method "typeof()", which conflicts with C++ "typeof" keyword. SImilar problem as above... I skipped methods named "typeof" in cpp.py and python.py.
Ugh, that 'typeof' reserved word should definitely be in the RESERVED word list in cpp.py. I'll add it now.
For the rest, seems to be working great; i think JCC is a very interesting project!
Thanks ! Andi..