juxt / clip

Light structure and support for dependency injection
MIT License
228 stars 15 forks source link

respect java.lang.AutoCloseable #29

Open loganlinn opened 2 years ago

loganlinn commented 2 years ago

the README suggests AutoCloseable is respected, but currently is not.

reproduction:

dev=> (require '[juxt.clip.core :as clip])
nil

dev=> (def config
 #_=>   {:components
 #_=>    {:a {:start #(reify java.lang.AutoCloseable
 #_=>                   (close [_]
 #_=>                     (println "close <java.lang.AutoCloseable>")))}
 #_=>     :b {:start #(reify java.io.Closeable
 #_=>                   (close [_]
 #_=>                     (println "close <java.io.Closeable>")))}}})
 #_=>

dev=> (clip/stop config (clip/start config))
close <java.io.Closeable>
{:a nil, :b nil}

makes the following improvements: