From 0ac6c2ef4d297eed53eb682ca8627a54f41e5ca2 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Tue, 27 Dec 2016 05:52:05 -0400 Subject: - Added type annotations to eliminate reflection. --- luxc/src/lux/compiler.clj | 6 +++--- luxc/src/lux/compiler/cache.clj | 8 ++++---- luxc/src/lux/compiler/cache/ann.clj | 6 +++--- luxc/src/lux/compiler/cache/type.clj | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) (limited to 'luxc/src') diff --git a/luxc/src/lux/compiler.clj b/luxc/src/lux/compiler.clj index 78fe301fd..b9b4e8de0 100644 --- a/luxc/src/lux/compiler.clj +++ b/luxc/src/lux/compiler.clj @@ -124,15 +124,15 @@ (defn init! "(-> (List Text) Null)" - [resources-dirs target-dir] + [resources-dirs ^String target-dir] (do (reset! &&/!output-dir target-dir) (&¶llel/setup!) (reset! !source->last-line {}) - (.mkdirs (java.io.File. target-dir)) + (.mkdirs (new java.io.File target-dir)) (let [class-loader (ClassLoader/getSystemClassLoader) addURL (doto (.getDeclaredMethod java.net.URLClassLoader "addURL" (into-array [java.net.URL])) (.setAccessible true))] - (doseq [resources-dir (&/->seq resources-dirs)] + (doseq [^String resources-dir (&/->seq resources-dirs)] (.invoke addURL class-loader (to-array [(->> resources-dir (new java.io.File) .toURI .toURL)])))))) diff --git a/luxc/src/lux/compiler/cache.clj b/luxc/src/lux/compiler/cache.clj index 5f0a77c65..e1951c0d5 100644 --- a/luxc/src/lux/compiler/cache.clj +++ b/luxc/src/lux/compiler/cache.clj @@ -64,7 +64,7 @@ [^File module] (->> module .listFiles - (filter #(.isDirectory %)) + (filter #(.isDirectory ^File %)) (map module-dirs) (apply concat) (list* module))) @@ -72,10 +72,10 @@ (defn clean [state] "(-> Compiler Null)" (let [needed-modules (->> state (&/get$ &/$modules) &/|keys &/->seq set) - output-dir-prefix (str (.getAbsolutePath (new File @&&/!output-dir)) "/") + output-dir-prefix (str (.getAbsolutePath (new File ^String @&&/!output-dir)) "/") outdated? #(->> % (contains? needed-modules) not) - outdated-modules (->> (new File @&&/!output-dir) - .listFiles (filter #(.isDirectory %)) + outdated-modules (->> (new File ^String @&&/!output-dir) + .listFiles (filter #(.isDirectory ^File %)) (map module-dirs) doall (apply concat) (map #(-> ^File % .getAbsolutePath (string/replace output-dir-prefix ""))) (filter outdated?))] diff --git a/luxc/src/lux/compiler/cache/ann.clj b/luxc/src/lux/compiler/cache/ann.clj index d50c02465..d372876f6 100644 --- a/luxc/src/lux/compiler/cache/ann.clj +++ b/luxc/src/lux/compiler/cache/ann.clj @@ -99,17 +99,17 @@ (defn ^:private deserialize-ident* [^String input] (when (.startsWith input "@") - (let [[ident* ^String input*] (.split (.substring input 1) stop 2) + (let [[^String ident* ^String input*] (.split (.substring input 1) stop 2) [_module _name] (.split ident* ident-separator 2)] [(&/T [_module _name]) input*]))) (defn ^:private deserialize-ident [^String input] (when (.startsWith input "@") - (let [[ident* ^String input*] (.split (.substring input 1) stop 2) + (let [[^String ident* ^String input*] (.split (.substring input 1) stop 2) [_module _name] (.split ident* ident-separator 2)] [(&/$IdentM (&/T [_module _name])) input*]))) -(defn ^:private deserialize-seq [deserializer input] +(defn ^:private deserialize-seq [deserializer ^String input] (cond (.startsWith input nil-signal) [&/$Nil (.substring input 1)] diff --git a/luxc/src/lux/compiler/cache/type.clj b/luxc/src/lux/compiler/cache/type.clj index 80d3a93d6..eb82e162f 100644 --- a/luxc/src/lux/compiler/cache/type.clj +++ b/luxc/src/lux/compiler/cache/type.clj @@ -74,7 +74,7 @@ (declare deserialize-type) -(defn ^:private deserialize-list [input] +(defn ^:private deserialize-list [^String input] (cond (.startsWith input nil-signal) [&/$Nil (.substring input 1)] -- cgit v1.2.3