<< Back to previous view

[CLJ-1030] Misleading ClassCastException when coercing a String to int Created: 25/Jul/12  Updated: 06/Jan/13

Status: Open
Project: Clojure
Component/s: None
Affects Version/s: Release 1.4
Fix Version/s: None

Type: Enhancement Priority: Minor
Reporter: Philipp Meier Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: bug

Attachments: File improved-int-char-casting-error-messages.diff    
Patch: Code and Test

 Description   

Observed behaviour

(int "0") =>
java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Character

Expected behaviour
(int "0") =>
java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
or
IllegalArgumentException



 Comments   
Comment by Andy Fingerhut [ 24/Sep/12 11:20 AM ]

If someone wants to improve the behavior of int in this case, they should also consider similar improvements to the error messages for unchecked-int, char, and unchecked-char.

Comment by Michael Drogalis [ 06/Jan/13 8:45 PM ]

Patch improved-int-char-casting-error-messages.diff on January 6, 2013.

Generated at Mon May 20 21:22:25 CDT 2013 using JIRA 4.4#649-r158309.