Message10163

Author kaneg
Recipients kaneg
Date 2015-07-23.09:31:08
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1437643868.98.0.191905394116.issue2381@psf.upfronthosting.co.za>
In-reply-to
Content
In Jython 2.7, Java's Map instance, e.g. HashMap, its values() method returns a Non-Java type which will cause unexpected behavior. In old Jython 2.5, it is right. Details are in below:

Below is the behavior in Jython 2.7:

Jython 2.7.0+ (, May 18 2015, 14:16:04)
[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.8.0_51
Type "help", "copyright", "credits" or "license" for more information.
>>> from java.util import HashMap
>>> HashMap().values().iterator()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'list' object has no attribute 'iterator'
>>> type(HashMap().values())
<type 'list'>

Below is the behavior in Jython 2.5
Jython 2.5.3 (2.5:c56500f08d34+, Aug 13 2012, 14:48:36)
[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.8.0_51
>>> from java.util import HashMap
>>> m = HashMap()
>>> m.values()
[]
>>> m.values().iterator()
java.util.HashMap$ValueIterator@3d246ea3
>>> type(m.values())
<type 'java.util.HashMap$Values'>
History
Date User Action Args
2015-07-23 09:31:09kanegsetrecipients: + kaneg
2015-07-23 09:31:08kanegsetmessageid: <1437643868.98.0.191905394116.issue2381@psf.upfronthosting.co.za>
2015-07-23 09:31:08kaneglinkissue2381 messages
2015-07-23 09:31:08kanegcreate