Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add type hints to eliminate reflection.

Running 'lein check' was producing these warnings:
clj_record/util.clj:6 - reference to field toLowerCase can't be resolved.
clj_record/util.clj:14 - reference to field toLowerCase can't be resolved.
clj_record/util.clj:16 - call to endsWith can't be resolved.
clj_record/util.clj:17 - call to endsWith can't be resolved.
clj_record/util.clj:21 - call to replaceAll can't be resolved.
clj_record/util.clj:6 - reference to field toLowerCase can't be resolved.
clj_record/util.clj:14 - reference to field toLowerCase can't be resolved.
clj_record/util.clj:16 - call to endsWith can't be resolved.
clj_record/util.clj:17 - call to endsWith can't be resolved.
clj_record/util.clj:21 - call to replaceAll can't be resolved.
  • Loading branch information...
commit 2f5da0cab28951e726683b3ab04c1d89b00be617 1 parent f949771
@mnicky mnicky authored
Showing with 3 additions and 3 deletions.
  1. +3 −3 src/clj_record/util.clj
View
6 src/clj_record/util.clj
@@ -2,7 +2,7 @@
"Assorted utilities for internal use."
(:require [clojure.string :as string]))
-(defn singularize [plural]
+(defn singularize [^String plural]
(let [lc (.toLowerCase plural)]
(condp re-find lc
#"ies$" (string/replace lc #"ies$" "y")
@@ -10,14 +10,14 @@
#"s$" (string/replace lc #"s$" "")
lc)))
-(defn pluralize [word]
+(defn pluralize [^String word]
(let [lc (.toLowerCase word)]
(cond
(.endsWith lc "y") (string/replace lc #"y$" "ies")
(some #(.endsWith lc %) ["s" "z" "ch" "sh" "x"]) (str lc "es")
:else (str lc "s"))))
-(defn dashes-to-underscores [s]
+(defn dashes-to-underscores [^String s]
(.replaceAll s "-" "_"))
(defmulti id-query-for :subprotocol)
Please sign in to comment.
Something went wrong with that request. Please try again.