Issue2399

classification
Title: regrtest failures related to sort() on Java 8
Type: behaviour Severity: normal
Components: Core Versions: Jython 2.7
Milestone: Jython 2.7.2
process
Status: open Resolution: accepted
Dependencies: Superseder:
Assigned To: Nosy List: jeff.allen, stefan.richthofer, zyasoft
Priority: normal Keywords: test failure causes

Created on 2015-09-14.21:27:38 by jeff.allen, last changed 2017-02-16.22:40:08 by jeff.allen.

Messages
msg10261 (view) Author: Jeff Allen (jeff.allen) Date: 2015-09-14.21:27:37
Running the regression tests on Java 8 produces a couple of failures related to sort(). This was observed in:

Jython 2.7.1 (default:7ebdc6c80d55, Sep 11 2015, 01:50:57)
[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.8.0_45

test_sort produces quite a lengthy complaint that isn't actually failure (but I'm not sure how to interpret it):

error in exception during sort left some permutation
out of order at index 417 Complains(417) Complains(416)
...
followed by several hundred lines of output.

The specific failure in test_list_jy is:

======================================================================
ERROR: test_sort (__main__.JavaListTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\jython\2.7.1b1\Lib\test\list_tests.py", line 442, in test_sort
    self._test_sort()
  File "C:\jython\2.7.1b1\Lib\test\list_tests.py", line 446, in _test_sort
    u.sort()
TypeError: sort(): expected 1 args; got 0

----------------------------------------------------------------------
Which is odd.
msg10272 (view) Author: Jim Baker (zyasoft) Date: 2015-09-22.17:40:53
Java 8 added a sort method to java.util.List (https://docs.oracle.com/javase/8/docs/api/java/util/List.html#sort-java.util.Comparator-), which takes one arg. Meanwhile JavaProxyList defines list_sort, which takes the standard Python args for sorting a list.

I'm surprised that our version does not override. Perhaps related to http://bugs.jython.org/issue2391?

Easy to reproduce on Jython running on Java 8:

$ dist/bin/jython
Jython 2.7.1 (default:7ebdc6c80d55+, Sep 21 2015, 18:28:51)
[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.8.0_45
Type "help", "copyright", "credits" or "license" for more information.
>>> from java.util import ArrayList
>>> x = ArrayList([1, 0])
>>> x.sort()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: sort(): expected 1 args; got 0
msg11098 (view) Author: Stefan Richthofer (stefan.richthofer) Date: 2017-02-15.20:31:50
I guess I already created and fixed kind of a duplicate of this one (regarding test_list_jy) in #2550 (sorry for overlooking this issue).
Could you check if that solved all Java8 regressions you observed? I think test_sort still has issues though, so leaving this one open for now.
msg11099 (view) Author: Jeff Allen (jeff.allen) Date: 2017-02-16.22:40:07
I thought #2550 sounded familiar :)

test_list_jy is clean now (one skip), but test_sort still creates output like:

     [exec] test_sort
     [exec] test test_sort produced unexpected output:
     [exec] **********************************************************************
     [exec] error in exception during sort left some permutation
     [exec] out of order at index 5 Complains(5) Complains(4)
     [exec] [Complains(0), Complains(1), Complains(2), Complains(3), Complains(4), Complains(5), Complains(6), Complains(7), Complains(8), Complains(9), Complains(10), Complains(11), Complains(12), Complains(13), Complains(14), Complains(15), Complains(16), Complains(17), Complains(18), Complains(19), Complains(20), Complains(21), Complains(22), Complains(23), Complains(24), Complains(25), Complains(26), Complains(27), Complains(28), ...
...
     [exec] error in exception during sort left some permutation
     [exec] out of order at index 3 Complains(3) Complains(4)
     [exec] [Complains(0), Complains(1), Complains(2), Complains(3), Complains(4), Complains(5), Complains(6), Complains(7), Complains(8), Complains(9), Complains(10), Complains(11), Complains(12), Complains(13), Complains(14), Complains(15), Complains(16), Complains(17), Complains(18), ...
History
Date User Action Args
2017-02-16 22:40:08jeff.allensetmessages: + msg11099
2017-02-15 20:31:51stefan.richthofersetpriority: normal
type: behaviour
messages: + msg11098
nosy: + stefan.richthofer
2016-02-04 01:08:36zyasoftsetmilestone: Jython 2.7.2
2015-09-22 17:41:05zyasoftsetresolution: accepted
2015-09-22 17:40:54zyasoftsetnosy: + zyasoft
messages: + msg10272
2015-09-14 21:27:38jeff.allencreate