Message1897
I'm not sure how to join the project and make a this change to the source myself so I thought I would post this here:
I discovered an error that causes Jython to be unable to make calls to functions with the names "set", "get", or "is". This is because the code which looks for getters and setters (which assumes these sorts of functions begin with these three prefixes) does not check to see if these values are prefixes (it simply assumes that they always will be prefixes). The following code (found in PyType.java under branches/Release_2_2maint) is currently:
if(added && !Modifier.isStatic(meth.getModifiers())) {
// check for xxxX.*
int n = meth.getParameterTypes().length;
if(methname.startsWith("get") && n == 0) {
propnames.put(methname.substring(3), "getter");
} else if(methname.startsWith("is") && n == 0
&& meth.getReturnType() == Boolean.TYPE) {
propnames.put(methname.substring(2), "getter");
} else if(methname.startsWith("set") && n == 1) {
propnames.put(methname.substring(3), meth);
}
}
but should really read:
if(added && !Modifier.isStatic(meth.getModifiers())) {
// check for xxxX.*
int n = meth.getParameterTypes().length;
if(methname.startsWith("get") && n == 0 &&
methname.length() > 3) {
propnames.put(methname.substring(3), "getter");
} else if(methname.startsWith("is") && n == 0
&& meth.getReturnType() == Boolean.TYPE &&
methname.length() > 2) {
propnames.put(methname.substring(2), "getter");
} else if(methname.startsWith("set") && n == 1 &&
methname.length() > 3) {
propnames.put(methname.substring(3), meth);
}
} |
|
Date |
User |
Action |
Args |
2008-02-20 17:18:01 | admin | link | issue1789561 messages |
2008-02-20 17:18:01 | admin | create | |
|