|
The code for proxy-call-with-super internally used by proxy-super does not handle exceptions from the call method:
(defn proxy-call-with-super [call this meth]
(let [m (proxy-mappings this)]
(update-proxy this (assoc m meth nil))
(let [ret (call)]
(update-proxy this m)
ret)))
As a result the following sequence behaves unexpectedly:
(def obj (proxy [java.lang.ClassLoader] []
(loadClass [cl] (println "enter")
(proxy-super loadClass cl))))
(.loadClass obj "nonexistent")
;; prints enter, then throws ClassNotFoundException
(.loadClass obj "nonexistent")
;; does not print anything before throwing cnfe
A try-finally block around the invocation would solve this particular issue.
|