Hi!
My script creates a simple GET request:
#!/usr/bin/env clj
(import java.net.URL)
(let [connection (. (new URL "http://dummy.restapiexample.com/api/v1/employees") openConnection)]
(. connection setRequestMethod "GET")
(let [body (slurp (. connection getInputStream))]
(println body)))
It works but it yields warnings on startup:
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by clojure.lang.InjectedInvoker/1384454980 (file:/Users/user/.m2/repository/org/clojure/clojure/1.10.0/clojure-1.10.0.jar) to method sun.net.www.protocol.http.HttpURLConnection.setRequestMethod(java.lang.String)
WARNING: Please consider reporting this to the maintainers of clojure.lang.InjectedInvoker/1384454980
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
The warning disappears if I just remove setRequestMethod
. However, if I need to create a POST request later I still need to use setRequestMethod
. How can I use setRequestMethod
without getting these warnings?