Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Backwards compability with 1.2.1

  • Loading branch information...
commit 69d7ccba24466419ff44a0bffe5f83369b3ef560 1 parent 82598bb
@Raynes Raynes authored
Showing with 16 additions and 6 deletions.
  1. +3 −1 project.clj
  2. +9 −3 src/clojail/core.clj
  3. +4 −2 src/clojail/testers.clj
4 project.clj
@@ -1,3 +1,5 @@
(defproject clojail "0.5.0"
:description "A sandboxing library."
- :dependencies [[clojure "1.3.0"]])
+ :dependencies [[clojure "1.3.0"]]
+ :dev-dependencies [[lein-multi "1.1.0-SNAPSHOT"]]
+ :multi-deps {"1.2.1" [[clojure "1.2.1"]]})
12 src/clojail/core.clj
@@ -22,7 +22,8 @@
;; It sucks to have to deal with TimeUnits. They're so damned long.
-(def uglify-time-unit "Create a map of pretty keywords to ugly TimeUnits"
+(def ^{:doc "Create a map of pretty keywords to ugly TimeUnits"}
+ uglify-time-unit
(into {} (for [[enum aliases] {TimeUnit/NANOSECONDS [:ns :nanoseconds]
TimeUnit/MICROSECONDS [:us :microseconds]
TimeUnit/MILLISECONDS [:ms :milliseconds]
@@ -68,7 +69,10 @@
(try (if-let [resolved (ns-resolve nspace s)]
- (catch RuntimeException _ s)))
+ ;; Catching both of these exceptions appears to be necessary, because the exception that
+ ;; is thrown appears to be different depending on which version of Clojure you use.
+ (catch RuntimeException _ s)
+ (catch ClassNotFoundException _ s)))
(defn flatten-all
"The core flatten doesn't flatten maps."
@@ -121,7 +125,9 @@
(recurse form)))))))
;; Compose our earlier functions.
-(def ^{:private true} ensafen "Fix code to make interop safe."
+(def ^{:private true
+ :doc "Fix code to make interop safe."}
+ ensafen
(comp dotify macroexpand-most))
(defn- mutilate
6 src/clojail/testers.clj
@@ -7,7 +7,8 @@
"Create a package object for putting in a tester."
[s] (Package/getPackage s))
-(def secure-tester-without-def "A tester that attempts to be secure, and allows def."
+(def ^{:doc "A tester that attempts to be secure, and allows def."}
+ secure-tester-without-def
#{'alter-var-root 'intern 'eval 'catch clojure.lang.Compiler
'load-string 'load-reader 'addMethod 'ns-resolve 'resolve 'find-var
'*read-eval* clojure.lang.Ref clojure.lang.Reflector 'ns-publics
@@ -20,5 +21,6 @@
(p "java.util.concurrent")
(p "java.awt")})
-(def secure-tester "A somewhat secure tester. No promises."
+(def ^{:doc "A somewhat secure tester. No promises."}
+ secure-tester
(conj secure-tester-without-def 'def))
Please sign in to comment.
Something went wrong with that request. Please try again.