Most often, you don't add type hints to code you :use or :require. You disable the warnings, or accept that you will see a slew of them, or if you only want to see them in your own code but not in libraries you use, remove :warn-on-reflection true from your project.clj, and edit your source files to put a line like (set! *warn-on-reflection true) near the beginning of the file, after the ns statement.
If the source code is available, e.g. on Github, you can get a copy of it, edit it to eliminate the reflection warnings (when possible), and then install a copy of that project locally in your ~/.m2 Maven repo using 'lein install' (if the project uses Leiningen). You could even submit a JIRA ticket with patch (if the library is part of Clojure core) or whatever the project owner prefers for change ideas (e.g. often Github pull requests), and they might choose to accept your changes into their copy of the library. Andy On Sun, Dec 22, 2013 at 2:33 PM, larry google groups < lawrencecloj...@gmail.com> wrote: > > I know this has been discussed before but I could not find anything like a > canonical answer via Google. I just set to > > :warn-on-reflection true > > in my project.clj and now I get the following warnings. How do I fix the > warnings that are in 3rd party libraries? How do I add type hints to code I > :use or :require? > > lein uberjar > Compiling admin.core > Reflection warning, admin/monitoring.clj:15:5 - call to enumerate can't be > resolved. > Reflection warning, admin/monitoring.clj:22:27 - reference to field > getName can't be resolved. > Reflection warning, admin/monitoring.clj:27:25 - reference to field getId > can't be resolved. > Reflection warning, admin/monitoring.clj:34:50 - reference to field getId > can't be resolved. > Reflection warning, admin/monitoring.clj:37:26 - reference to field > getName can't be resolved. > Reflection warning, admin/monitoring.clj:37:39 - reference to field getId > can't be resolved. > Reflection warning, clj_time/core.clj:577:10 - reference to field > getDayOfMonth can't be resolved. > Reflection warning, monger/joda_time.clj:32:19 - reference to field toDate > can't be resolved. > Reflection warning, monger/joda_time.clj:64:14 - reference to field toDate > can't be resolved. > Reflection warning, clojure/core/incubator.clj:90:7 - reference to field > getClass can't be resolved. > Reflection warning, clojure/core/incubator.clj:90:7 - reference to field > isArray can't be resolved. > Reflection warning, lamina/trace/timer.clj:173:7 - call to enqueue can't > be resolved. > Reflection warning, lamina/trace/timer.clj:302:5 - call to enqueue can't > be resolved. > Reflection warning, formative/util.clj:37:9 - call to valueOf can't be > resolved. > Reflection warning, jkkramer/verily.clj:304:15 - call to digit can't be > resolved. > Reflection warning, formative/parse.clj:45:9 - call to valueOf can't be > resolved. > Reflection warning, formative/parse.clj:49:15 - call to valueOf can't be > resolved. > Reflection warning, formative/parse.clj:55:13 - call to valueOf can't be > resolved. > Reflection warning, formative/parse.clj:74:13 - call to > java.math.BigDecimal ctor can't be resolved. > Reflection warning, formative/parse.clj:87:21 - call to > java.math.BigInteger ctor can't be resolved. > Reflection warning, admin/controller.clj:159:29 - reference to field > toString can't be resolved. > Reflection warning, admin/controller.clj:159:29 - reference to field > toString can't be resolved. > Reflection warning, net/cgrand/xml.clj:85:4 - call to parse can't be > resolved. > Reflection warning, net/cgrand/tagsoup.clj:15:3 - call to parse can't be > resolved. > Reflection warning, net/cgrand/tagsoup.clj:32:18 - call to > org.xml.sax.InputSource ctor can't be resolved. > Reflection warning, net/cgrand/enlive_html.clj:54:16 - call to > org.xml.sax.InputSource ctor can't be resolved. > Reflection warning, admin/supervisor.clj:54:5 - call to java.lang.Thread > ctor can't be resolved. > Reflection warning, admin/supervisor.clj:54:5 - call to java.lang.Thread > ctor can't be resolved. > Reflection warning, clojure/tools/reader/default_data_readers.clj:175:20 - > reference to field get can't be resolved. > Reflection warning, clojure/tools/reader/default_data_readers.clj:177:15 - > call to format can't be resolved. > Reflection warning, clojure/tools/reader/default_data_readers.clj:177:5 - > call to write can't be resolved. > Reflection warning, clojure/tools/reader/default_data_readers.clj:220:20 - > reference to field get can't be resolved. > Reflection warning, clojure/tools/reader/default_data_readers.clj:222:15 - > call to format can't be resolved. > Reflection warning, clojure/tools/reader/default_data_readers.clj:222:5 - > call to write can't be resolved. > Reflection warning, clojure/tools/reader.clj:71:20 - call to digit can't > be resolved. > Reflection warning, clojure/tools/reader.clj:77:20 - call to digit can't > be resolved. > Reflection warning, clojure/tools/reader.clj:89:24 - call to digit can't > be resolved. > Reflection warning, clojure/tools/reader.clj:214:23 - call to digit can't > be resolved. > Reflection warning, clojure/tools/reader.clj:218:23 - call to digit can't > be resolved. > Reflection warning, clojure/tools/reader/edn.clj:78:20 - call to digit > can't be resolved. > Reflection warning, clojure/tools/reader/edn.clj:84:20 - call to digit > can't be resolved. > Reflection warning, clojure/tools/reader/edn.clj:96:24 - call to digit > can't be resolved. > Reflection warning, clojure/tools/reader/edn.clj:205:23 - call to digit > can't be resolved. > Reflection warning, clojure/tools/reader/edn.clj:209:23 - call to digit > can't be resolved. > Reflection warning, ns_tracker/core.clj:20:28 - reference to field > lastModified can't be resolved. > Reflection warning, ns_tracker/core.clj:25:6 - reference to field > lastModified can't be resolved. > Reflection warning, ring/middleware/session/cookie.clj:82:27 - reference > to field getBytes can't be resolved. > > -- > -- > 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. > -- -- 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.