From: SourceForge.net <no...@so...> - 2007-10-01 04:04:42
|
Bugs item #1789561, was opened at 2007-09-06 22:54 Message generated for change (Comment added) made by ayeshaiqbal You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112867&aid=1789561&group_id=12867 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Core Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: David Little (derbylittle) Assigned to: Nobody/Anonymous (nobody) Summary: Functions named 'set' 'get' or 'is' do not work Initial Comment: 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); } } ---------------------------------------------------------------------- Comment By: ayesha (ayeshaiqbal) Date: 2007-10-01 08:04 Message: Logged In: YES user_id=1856489 Originator: NO Hi David , I have attached your patch in the patches list . There are really no formalities required to contribute to jython . In the future you can attach your patches in the patch list . See http://wiki.python.org/jython/PatchGuidelines for guidelines on submitting patches. Make sure you use spaces instead of tabs in your patch.Also you can subscribe to the jython-dev mailing list and participate in our discussions . You can also join the #jython channel at irc.freenode.net and chat with the other jython developers. Cheers, Ayesha ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112867&aid=1789561&group_id=12867 |