From: SourceForge.net <no...@so...> - 2007-09-06 18:54:32
|
Bugs item #1789561, was opened at 2007-09-06 13:54 Message generated for change (Tracker Item Submitted) made by Item Submitter 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); } } ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112867&aid=1789561&group_id=12867 |
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 |
From: SourceForge.net <no...@so...> - 2007-10-06 04:30:43
|
Bugs item #1789561, was opened at 2007-09-06 13:54 Message generated for change (Comment added) made by cgroves 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: Charles Groves (cgroves) Date: 2007-10-05 23:30 Message: Logged In: YES user_id=1174327 Originator: NO I can't actually get this to fail as you describe. I've created several variations on classes with get, set and is methods, and they've always been callable. We incorrectly add the empty string to __dict__ which is a problem I'm going to fix, but I'd like to be able to reproduce what you noticed. Could you attach some Java code that produces the problem? ---------------------------------------------------------------------- Comment By: ayesha (ayeshaiqbal) Date: 2007-09-30 23: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 |
From: SourceForge.net <no...@so...> - 2007-10-06 13:59:45
|
Bugs item #1789561, was opened at 2007-09-06 13:54 Message generated for change (Comment added) made by derbylittle 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: David Little (derbylittle) Date: 2007-10-06 08:59 Message: Logged In: YES user_id=1840252 Originator: YES The error occurs when you try to call the java method from jython. So for instance, in java: public class MyClass{ private int myValue; public int set(int value){myValue=value;} } and in jython: myObject = MyClass() myObject.set(5) The call to set will not work, because the method was never added to jython wrapper of the java class. ---------------------------------------------------------------------- Comment By: Charles Groves (cgroves) Date: 2007-10-05 23:30 Message: Logged In: YES user_id=1174327 Originator: NO I can't actually get this to fail as you describe. I've created several variations on classes with get, set and is methods, and they've always been callable. We incorrectly add the empty string to __dict__ which is a problem I'm going to fix, but I'd like to be able to reproduce what you noticed. Could you attach some Java code that produces the problem? ---------------------------------------------------------------------- Comment By: ayesha (ayeshaiqbal) Date: 2007-09-30 23: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 |
From: SourceForge.net <no...@so...> - 2007-10-06 17:27:36
|
Bugs item #1789561, was opened at 2007-09-06 13:54 Message generated for change (Comment added) made by cgroves 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: Charles Groves (cgroves) Date: 2007-10-06 12:27 Message: Logged In: YES user_id=1174327 Originator: NO I changed that code to the following so it would compile: public class MyClass { private int myValue; public int set(int value) { myValue = value; return myValue; } } Here's the results in Jython: Jython 2.2.1rc2 on java1.5.0_07 Type "copyright", "credits" or "license" for more information. >>> import MyClass >>> m = MyClass() >>> m.set(7) 7 >>> If I change the return type to void, I can call it equally well. I tried code like that and several other variations, and it's always callable. Is there some difference in the actual code where you saw this fail? ---------------------------------------------------------------------- Comment By: David Little (derbylittle) Date: 2007-10-06 08:59 Message: Logged In: YES user_id=1840252 Originator: YES The error occurs when you try to call the java method from jython. So for instance, in java: public class MyClass{ private int myValue; public int set(int value){myValue=value;} } and in jython: myObject = MyClass() myObject.set(5) The call to set will not work, because the method was never added to jython wrapper of the java class. ---------------------------------------------------------------------- Comment By: Charles Groves (cgroves) Date: 2007-10-05 23:30 Message: Logged In: YES user_id=1174327 Originator: NO I can't actually get this to fail as you describe. I've created several variations on classes with get, set and is methods, and they've always been callable. We incorrectly add the empty string to __dict__ which is a problem I'm going to fix, but I'd like to be able to reproduce what you noticed. Could you attach some Java code that produces the problem? ---------------------------------------------------------------------- Comment By: ayesha (ayeshaiqbal) Date: 2007-09-30 23: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 |
From: SourceForge.net <no...@so...> - 2008-01-19 23:17:37
|
Bugs item #1789561, was opened at 2007-09-06 13:54 Message generated for change (Comment added) made by cgroves 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: Closed >Resolution: Works For Me 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: Charles Groves (cgroves) Date: 2008-01-19 18:17 Message: Logged In: YES user_id=1174327 Originator: NO No response in 3 months. Closing. ---------------------------------------------------------------------- Comment By: Charles Groves (cgroves) Date: 2007-10-06 12:27 Message: Logged In: YES user_id=1174327 Originator: NO I changed that code to the following so it would compile: public class MyClass { private int myValue; public int set(int value) { myValue = value; return myValue; } } Here's the results in Jython: Jython 2.2.1rc2 on java1.5.0_07 Type "copyright", "credits" or "license" for more information. >>> import MyClass >>> m = MyClass() >>> m.set(7) 7 >>> If I change the return type to void, I can call it equally well. I tried code like that and several other variations, and it's always callable. Is there some difference in the actual code where you saw this fail? ---------------------------------------------------------------------- Comment By: David Little (derbylittle) Date: 2007-10-06 08:59 Message: Logged In: YES user_id=1840252 Originator: YES The error occurs when you try to call the java method from jython. So for instance, in java: public class MyClass{ private int myValue; public int set(int value){myValue=value;} } and in jython: myObject = MyClass() myObject.set(5) The call to set will not work, because the method was never added to jython wrapper of the java class. ---------------------------------------------------------------------- Comment By: Charles Groves (cgroves) Date: 2007-10-05 23:30 Message: Logged In: YES user_id=1174327 Originator: NO I can't actually get this to fail as you describe. I've created several variations on classes with get, set and is methods, and they've always been callable. We incorrectly add the empty string to __dict__ which is a problem I'm going to fix, but I'd like to be able to reproduce what you noticed. Could you attach some Java code that produces the problem? ---------------------------------------------------------------------- Comment By: ayesha (ayeshaiqbal) Date: 2007-09-30 23: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 |