phillip.l...@newcastle.ac.uk (Phillip Lord) writes: > I know about *warn-on-reflection* but is there anyway that I can get > an error-on-reflection instead?
I don't think so. > I've been type hinting my application (50% done and yes it goes faster > now), and it's a bit painful. What I would really want is to have a > unit test which fails if reflection is used. > > So far, my best idea is catching standard-out and parsing it for > reflection warnings. Not ideal. clojure/test/clojure/test_helper.clj already contains some helper macros for doing that, e.g., `should-not-reflect`: https://github.com/clojure/clojure/blob/0b73494c3c855e54b1da591eeb687f24f608f346/test/clojure/test_helper.clj#L126 One problem is, though, that you not only get reflection warnings for your own code but also for code in dependencies. So you need to tweak that macro with another regex that matches only reflection warnings in your own files. But then you should be able to do something like this: --8<---------------cut here---------------start------------->8--- (ns myproject.test :require [clojure.test :as test]) (defmacro should-not-reflect ...) (test/deftest no-reflection-at-all (should-not-reflect (do (require 'myproject.ns1 :reload) (require 'myproject.ns2 :reload) ...))) --8<---------------cut here---------------end--------------->8--- HTH, Tassilo -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.