Message11142

Author jamesmudd
Recipients jamesmudd
Date 2017-02-28.19:57:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1488311875.54.0.0354324083423.issue2558@psf.upfronthosting.co.za>
In-reply-to
Content
This is not a bug, but i wasn't sure where to put improvements? It would be nice if when calling a java method which takes a enum automatic type conversion from string could be done if possible. This would make calling enum methods more convenient.

At the moment a call to a method taking a enum with a string fails, even if the enum valueOf(String) method would work e.g

Jython 2.7.1b3 (, Feb 28 2017, 19:53:14) 
[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.8.0_121
Type "help", "copyright", "credits" or "license" for more information.
>>> import java.time.LocalDate
>>> date = java.time.LocalDate.of(2015, 'DECEMBER', 3)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: of(): 2nd arg can't be coerced to int, java.time.Month
>>> 

Since Jython already does other similar type coercion I think this would be a nice extension, but maybe i'm missing a reason why its a really bad idea?
History
Date User Action Args
2017-02-28 19:57:55jamesmuddsetrecipients: + jamesmudd
2017-02-28 19:57:55jamesmuddsetmessageid: <1488311875.54.0.0354324083423.issue2558@psf.upfronthosting.co.za>
2017-02-28 19:57:55jamesmuddlinkissue2558 messages
2017-02-28 19:57:54jamesmuddcreate