Completed
Details
Details
Assignee
Unassigned
UnassignedReporter
Alf Kristian Støyle
Alf Kristian StøyleApproval
Ok
Patch
Code and Test
Priority

Affects versions
Fix versions
Created June 30, 2014 at 5:52 PM
Updated October 13, 2015 at 3:37 AM
Resolved October 13, 2015 at 3:37 AM
The compiler does not fail on "malformed" throw forms with less than or greater than one arg:
user=> (defn foo [] (throw)) #'user/foo user=> (foo) NullPointerException user/foo (NO_SOURCE_FILE:1) user=> (defn bar [] (throw Exception baz)) #'user/bar user=> (bar) ClassCastException java.lang.Class cannot be cast to java.lang.Throwable user/bar (NO_SOURCE_FILE:1) ; This one works, but ignored-symbol, should probably not be ignored user=> (defn quux [] (throw (Exception. "Works!") ignored-symbol)) #'user/quux user=> (quux) Exception Works! user/quux (NO_SOURCE_FILE:1)
Approach: Count forms and throw an appropriate exception if arity != 1.
Patch: clj-1456-5.patch
Screened by: Alex Miller