Message10671

Author jsaiz
Recipients jsaiz
Date 2016-02-01.13:25:55
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1454333157.19.0.868194563368.issue2456@psf.upfronthosting.co.za>
In-reply-to
Content
[DESCRIPTION]

Consider this simple example that works in Jython 2.5.2:

linux> jython2.5
Jython 2.5.2 (Release_2_5_2:7206, Mar 2 2011, 23:12:06) 
[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.8.0_60
Type "help", "copyright", "credits" or "license" for more information.
>>> import java              
>>> a = java.util.ArrayList()
>>> a.add("a")               
True
>>> a.remove(0)              
u'a'

The element with index 0 has been removed.

The same code fails in Jython 2.7.0:

linux> jython2.7
Jython 2.7.0 (default:9987c746f838, Apr 29 2015, 02:25:11) 
[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.8.0_60
Type "help", "copyright", "credits" or "license" for more information.
>>> import java
>>> a = java.util.ArrayList()
>>> a.add("a")
True
>>> a.remove(0)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: 0 is not in list


[DIAGNOSIS]

The exception is thrown by JavaProxyList.listRemoveOverrideProxy, which covers the method List.remove(Object), but not List.remove(int).


[SOLUTION]

Fix JavaProxyList.listRemoveOverrideProxy to cope with removal by index.
History
Date User Action Args
2016-02-01 13:25:57jsaizsetrecipients: + jsaiz
2016-02-01 13:25:57jsaizsetmessageid: <1454333157.19.0.868194563368.issue2456@psf.upfronthosting.co.za>
2016-02-01 13:25:56jsaizlinkissue2456 messages
2016-02-01 13:25:55jsaizcreate