Fork me on GitHub
#clojure
<
2018-08-19
>
beoliver10:08:33

Is it possible to test for reflection warnings? I was wondering if there is a pattern similar to this:

(deftest some-test
  (binding [*warn-on-reflection* true]
    (try
      (testing "some test"
        ...
        )
      (catch ReflectionWarning _ ...))))

noisesmith19:08:58

but even if testing at compile time, ReflectionWarnings don't get thrown do they?

emccue17:08:07

bit of a hack but, I think you can do something like this

noisesmith17:08:24

what is a ReflectionWarning then? I assumed it was a warning message not something that gets thrown.

emccue17:08:40

i put a gist which moved me down

noisesmith17:08:20

?? anyway regarding the initial thing in this thread, I found the source, this isn't something you can catch

beoliver10:08:27

ah... don't worry - Reflection warnings are compile time - so it doesn't make sense to test for them like this