clj-time / clj-time

A date and time library for Clojure, wrapping the Joda Time library.
Other
739 stars 161 forks source link

Fix reflection warnings #221

Closed sfnelson closed 7 years ago

sfnelson commented 7 years ago

Adds type hints where indicated by compiler, and enable refection warnings in leiningen builds to help avoid future regressions.

sfnelson commented 7 years ago

Thanks for releasing #219. Unfortunately, master had introduced a new reflection warning since that pull request was made and so this library is still causing noise in our builds. Could you please consider this pull request that resolves two more warnings and enables reflection warnings for the project in general, so that future contributors will be reminded to add type hints?

seancorfield commented 7 years ago

:+1: I'll cut 0.12.2 with this in.

seancorfield commented 7 years ago

Just so you're aware, with reflection warnings turned on for testing clj-time, it produces these warnings:

Reflection warning, such/vars.clj:26:3 - reference to field sym can't be resolved.
Reflection warning, such/wrongness.clj:16:46 - call to static method aset on clojure.lang.RT can't be resolved (argument types: unknown, int, java.lang.Class).
Reflection warning, such/wrongness.clj:16:23 - call to method getConstructor on java.lang.Object can't be resolved (no such method).
Reflection warning, such/wrongness.clj:18:47 - call to static method aset on clojure.lang.RT can't be resolved (argument types: unknown, int, unknown).
Reflection warning, such/wrongness.clj:18:21 - call to method newInstance can't be resolved (target class is unknown).
Reflection warning, such/casts.clj:144:28 - reference to field ns can't be resolved.
Reflection warning, such/casts.clj:144:39 - reference to field sym can't be resolved.
Reflection warning, com/rpl/specter/impl.clj:201:7 - call to java.lang.IllegalArgumentException ctor can't be resolved.
Reflection warning, com/rpl/specter/impl.clj:307:17 - call to java.lang.IllegalArgumentException ctor can't be resolved.
Performance warning, com/rpl/specter/impl.clj:516:7 - case has int tests, but tested expression is not primitive.
Reflection warning, com/rpl/specter/impl.clj:919:5 - call to java.lang.IllegalArgumentException ctor can't be resolved.
Reflection warning, com/rpl/specter/impl.clj:1047:7 - call to java.lang.IllegalArgumentException ctor can't be resolved.
Reflection warning, com/rpl/specter/impl.clj:1215:9 - call to java.lang.IllegalArgumentException ctor can't be resolved.
Reflection warning, com/rpl/specter/impl.clj:1232:7 - call to java.lang.IllegalArgumentException ctor can't be resolved.
Reflection warning, com/rpl/specter/impl.clj:1238:32 - call to java.lang.IllegalArgumentException ctor can't be resolved.
Reflection warning, com/rpl/specter/impl.clj:1276:11 - call to java.lang.IllegalArgumentException ctor can't be resolved.
Reflection warning, com/rpl/specter/impl.clj:1276:11 - call to java.lang.IllegalArgumentException ctor can't be resolved.
Reflection warning, com/rpl/specter/macros.clj:10:5 - call to java.lang.IllegalArgumentException ctor can't be resolved.
Reflection warning, such/readable.clj:146:36 - call to method substring on java.lang.Object can't be resolved (no such method).
Reflection warning, such/readable.clj:150:36 - call to method substring on java.lang.Object can't be resolved (no such method).
Reflection warning, midje/util/ecosystem.clj:41:12 - call to java.io.File ctor can't be resolved.
Reflection warning, midje/util/pile.clj:107:9 - call to method contains can't be resolved (target class is unknown).
Reflection warning, midje/config.clj:19:32 - call to method contains can't be resolved (target class is unknown).
Reflection warning, midje/emission/clojure_test_facade.clj:33:21 - reference to field toString can't be resolved.
Reflection warning, midje/emission/plugins/util.clj:101:8 - reference to field getClass can't be resolved.
Reflection warning, midje/emission/plugins/util.clj:101:8 - reference to field getName can't be resolved.
Reflection warning, flare/string.clj:23:24 - reference to field operation can't be resolved.
Reflection warning, flare/string.clj:23:43 - reference to field text can't be resolved.
Reflection warning, pointer/core.clj:36:5 - reference to field getFileName can't be resolved.
Reflection warning, midje/data/metaconstant.clj:43:5 - reference to field getNamespace on java.lang.Object can't be resolved.
Reflection warning, midje/checking/checkers/chatty.clj:61:20 - call to java.lang.Error ctor can't be resolved.
Reflection warning, midje/checking/checkers/simple.clj:86:24 - reference to field throwable can't be resolved.
Reflection warning, midje/data/compendium.clj:60:38 - call to method indexOf can't be resolved (target class is unknown).

Which are all in Midje or its dependencies...

seancorfield commented 7 years ago

Release 0.12.2 is on Clojars.

sfnelson commented 7 years ago

Thanks. I only ran lein test so I didn't see the midje warnings. Not much you can do about those unfortunately, but at least downstream users won't be affected.