G
gcash
I just managed to track down and fix a bug in the jython compiler. I don't
know if this is the right place to post it and call attention to it.
I'm writing a motorcycle transmission simulation in Java3D and Jython, which
is on the web at
<http://home.cfl.rr.com/genecash/transmission_applet/transmission_applet.html>
if anyone's interested.
At the moment, I was adding the star cam to the end of the shift drum, and the
associated cam follower.
OK, the shift drum is animated using a "RotationInterpolator" object, so I
decided to subclass this object as a "StarInterpolator" and add the little bit
of code to update the follower position every frame.
Well, so far, so good. It took me a day or so until I had it done. I was
testing it with the command line interpreter and it was all peachy. Then I
tried to compile it so I could put it up on the web, and it pukes up "cannot
resolve symbol" errors on the new subclass.
Ok, so the "RotationInterpolator" constructor has the following signature:
public RotationInterpolator(Alpha, TransformGroup);
public RotationInterpolator(Alpha, TransformGroup, Transform3D, float, float);
Well for some reason, jythonc is emitting code to handle the no-argument
RotationInterpolator() as well, and of course this chokes because there is no
such thing.
According to the Sun Java3D documentation, that is. Ahem. According to the
javap output, there *IS* a RotationInterpolator() constructor, but it's only
package accessable. OK, so that means I can't see it, but it's still in the
signature so jythonc is trying to deal with it.
In the addConstructors function in $JYTHON_HOME/Tools/jythonc/proxies.py, it
goes through the constructors and creates a list for each one. There's a
variable called "access" which is 0 if you can't see the constructor.
So this is the patch:
def addConstructors(self, c):
for constructor in c.getDeclaredConstructors():
access = constructor.modifiers
if isPrivate(access):
continue
if isNative(access):
access = access & ~NATIVE
if isProtected(access):
access = access & ~PROTECTED | PUBLIC
+ if not access:
+ continue
parameters = tuple(constructor.parameterTypes)
throws = constructor.exceptionTypes
self.jconstructors.append( (access, parameters, throws) )
-gc
know if this is the right place to post it and call attention to it.
I'm writing a motorcycle transmission simulation in Java3D and Jython, which
is on the web at
<http://home.cfl.rr.com/genecash/transmission_applet/transmission_applet.html>
if anyone's interested.
At the moment, I was adding the star cam to the end of the shift drum, and the
associated cam follower.
OK, the shift drum is animated using a "RotationInterpolator" object, so I
decided to subclass this object as a "StarInterpolator" and add the little bit
of code to update the follower position every frame.
Well, so far, so good. It took me a day or so until I had it done. I was
testing it with the command line interpreter and it was all peachy. Then I
tried to compile it so I could put it up on the web, and it pukes up "cannot
resolve symbol" errors on the new subclass.
Ok, so the "RotationInterpolator" constructor has the following signature:
public RotationInterpolator(Alpha, TransformGroup);
public RotationInterpolator(Alpha, TransformGroup, Transform3D, float, float);
Well for some reason, jythonc is emitting code to handle the no-argument
RotationInterpolator() as well, and of course this chokes because there is no
such thing.
According to the Sun Java3D documentation, that is. Ahem. According to the
javap output, there *IS* a RotationInterpolator() constructor, but it's only
package accessable. OK, so that means I can't see it, but it's still in the
signature so jythonc is trying to deal with it.
In the addConstructors function in $JYTHON_HOME/Tools/jythonc/proxies.py, it
goes through the constructors and creates a list for each one. There's a
variable called "access" which is 0 if you can't see the constructor.
So this is the patch:
def addConstructors(self, c):
for constructor in c.getDeclaredConstructors():
access = constructor.modifiers
if isPrivate(access):
continue
if isNative(access):
access = access & ~NATIVE
if isProtected(access):
access = access & ~PROTECTED | PUBLIC
+ if not access:
+ continue
parameters = tuple(constructor.parameterTypes)
throws = constructor.exceptionTypes
self.jconstructors.append( (access, parameters, throws) )
-gc