From cc0df196ee35da434bd2ab69887354c296b3fbae Mon Sep 17 00:00:00 2001 From: Shagun Agrawal Date: Wed, 24 Jul 2024 19:42:43 +0530 Subject: Fix reflection warnings for graal VM compilation --- src/cljcc/cljcc.clj | 2 ++ src/cljcc/driver.clj | 11 ++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/cljcc/cljcc.clj b/src/cljcc/cljcc.clj index 1da49fd..5d0be54 100644 --- a/src/cljcc/cljcc.clj +++ b/src/cljcc/cljcc.clj @@ -3,6 +3,8 @@ [cljcc.driver :as d]) (:gen-class)) +(set! *warn-on-reflection* true) + (defn greet "Callable entry point to the application." [data] diff --git a/src/cljcc/driver.clj b/src/cljcc/driver.clj index 960bd1f..0cd3f9f 100644 --- a/src/cljcc/driver.clj +++ b/src/cljcc/driver.clj @@ -19,7 +19,7 @@ (println "running on mac")) :unsupported (throw (Exception. (str os " is not currently supported.")))))) -(defn remove-extension [filename] +(defn remove-extension [^String filename] (if (.contains filename ".") (.substring filename 0 (.lastIndexOf filename ".")) filename)) @@ -29,7 +29,7 @@ preprocessed-file-path (make-file-name directory (remove-extension filename) "i") output (handle-sh "gcc" "-E" "-P" input-file-path "-o" preprocessed-file-path)] (if (= 1 (:exit output)) - (throw (Exception. (:out output))) + (throw (Exception. ^String (:out output))) (println (str "Successfully preprocessed file: " preprocessed-file-path))))) (defn assemble [directory filename] @@ -39,7 +39,7 @@ output (handle-sh "gcc" assembly-file "-o" output-file)] (println file-without-ext assembly-file output-file output) (if (= 1 (:exit output)) - (throw (Exception. (:out output))) + (throw (Exception. ^String (:out output))) (println (str "Successfully created executable at: " output-file output))))) (defn run-compile [directory filename] @@ -58,8 +58,9 @@ (defn run "Runs the compiler driver with the given input source file." - [file-path] - (let [file (io/file file-path) + [^String file-path] + (let [file (io/file ^String file-path) + _ (println file) filename (.getName file) directory (.getParent file)] (handle-os) -- cgit v1.2.3