Issue2215

classification
Title: java.util.List derived classes lack list methods
Type: behaviour Severity: normal
Components: Core Versions: Jython 2.7
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: nonameentername, santa4nt, zyasoft
Priority: urgent Keywords:

Created on 2014-09-29.21:48:06 by zyasoft, last changed 2015-01-04.17:03:44 by zyasoft.

Messages
msg9056 (view) Author: Jim Baker (zyasoft) Date: 2014-09-29.21:48:05
Much as we saw with #1631, java.util.List objects do not have all the list methods, so they do not duck type properly as Python list objects (or more properly collections.Sequence):

$ jython27
>>> from java.util import ArrayList
>>> x = ArrayList()
>>> x.append("foo")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'java.util.ArrayList' object has no attribute 'append'

Note that we actually make this guarantee, but don't fulfill it:
https://hg.python.org/jython/rev/9fef5da411e5

>>> from collections import Sequence
>>> isinstance(x, Sequence)
True

Fix for beta 4. Use list_tests support library (used by test_list) to verify ops. Also looks at comprehensive support for set.
msg9058 (view) Author: Santoso Wijaya (santa4nt) Date: 2014-09-30.19:10:28
I can take this on.
msg9097 (view) Author: Jim Baker (zyasoft) Date: 2014-10-06.03:23:55
Santoso, sounds good. (I assume you have started, but if not, here's that ack!) I changed to nobody since you're not yet in the bugtracker as someone who can be assigned to.
msg9160 (view) Author: Santoso Wijaya (santa4nt) Date: 2014-10-19.02:20:19
I'm uploading commits for this to my bitbucket mirror: https://bitbucket.org/santa4nt/jython/commits/branch/fix-issue-2215

Work in progress...
msg9260 (view) Author: Jim Baker (zyasoft) Date: 2014-12-22.21:14:30
Changing this to urgent since there's a (small) chance that it breaks backwards compatibility, and so should be in beta 4.

I plan to finish Santoso's work, presumably sometime this week.
msg9267 (view) Author: Jim Baker (zyasoft) Date: 2014-12-27.16:01:20
Fixed as of https://hg.python.org/jython/rev/ae2a1efe4192

Note the backwards breaking change: remove will now raise a ValueError if the item is absent
History
Date User Action Args
2015-01-04 17:03:44zyasoftsetstatus: pending -> closed
2014-12-27 16:01:20zyasoftsetstatus: open -> pending
resolution: fixed
messages: + msg9267
2014-12-22 21:14:31zyasoftsetpriority: high -> urgent
messages: + msg9260
2014-10-19 02:20:20santa4ntsetmessages: + msg9160
2014-10-06 03:23:55zyasoftsetmessages: + msg9097
2014-09-30 19:10:29santa4ntsettype: behaviour
messages: + msg9058
nosy: + santa4nt
components: + Core
versions: + Jython 2.7
2014-09-29 21:48:07zyasoftcreate