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

octahedrion15:08:45

when using deps.edn how do I deal with a dependency which in Leiningen is handled like this:

octahedrion15:08:03

[edu.stanford.nlp/stanford-corenlp "3.9.1"]
[edu.stanford.nlp/stanford-corenlp "3.9.1" :classifier "models"]

octahedrion15:08:31

i.e. the same dep twice but one with :classifier "models"

octahedrion15:08:53

:deps in deps.edn is a map

octahedrion15:08:20

ok the trick is to add a map entry (any unique key will do) with a :local/root "/path/to/.m2/repository/edu/stanford/nlp/stanford-corenlp/3.9.1/stanford-corenlp-3.9.1-models.jar