File tree Expand file tree Collapse file tree 4 files changed +13
-10
lines changed
Expand file tree Collapse file tree 4 files changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -10,12 +10,12 @@ Latest stable release: 1.0
1010CLI/deps.edn dependency information:
1111
1212``` clojure
13- org.clojars.jeff_evans/java-case {:mvn/version " 1.0 " }
13+ org.clojars.jeff_evans/java-case {:mvn/version " 1.1 " }
1414```
1515Leiningen dependency information:
1616
1717``` clojure
18- [jeff_evans/java-case " 1.0 " ]
18+ [jeff_evans/java-case " 1.1 " ]
1919```
2020
2121This library is not yet deployed to Maven central.
@@ -57,7 +57,9 @@ doesn't matter.
5757 " 20+" " Java 20 and beyond" ))
5858=>
5959(clojure.core/case
60- (clojure.core/or us.jeffevans.java-case/*java-spec-version-override* " 11" )
60+ (clojure.core/or
61+ us.jeffevans.java-case/*java-spec-version-override*
62+ (us.jeffevans.java-case/current-java-spec-version ))
6163 ("11" " 12" " 13" " 14" " 15" " 16" )
6264 " Java 11 through 16"
6365 " 17"
Original file line number Diff line number Diff line change 44 [org.corfield.build :as bb]))
55
66(def lib 'org.clojars.jeff_evans /java-case )
7- (def version " 1.0" )
8- #_ ; alternatively, use MAJOR.MINOR.COMMITS:
9- (def version (format " 1.0.%s" (b/git-count-revs nil )))
7+ (def version " 1.1" )
108
119(defn test " Run the tests." [opts]
1210 (bb/run-tests opts))
Original file line number Diff line number Diff line change 33 <modelVersion >4.0.0</modelVersion >
44 <groupId >org.clojars.jeff_evans</groupId >
55 <artifactId >java-case</artifactId >
6- <version >1.0 </version >
6+ <version >1.1 </version >
77 <name >jeff_evans/java-case</name >
88 <description >A simple Clojure macro for selecting different forms based on the runtime JDK version</description >
99 <url >https://github.com/jeff-evans/java-case</url >
Original file line number Diff line number Diff line change 33
44(def ^:dynamic *java-spec-version-override* nil )
55
6- (def ^:private ^:const java-spec-version (System/getProperty " java.specification.version" ))
6+ (defn current-java-spec-version
7+ " Returns the current Java major version, from the java.specification.version JVM property."
8+ []
9+ (System/getProperty " java.specification.version" ))
710
811(def ^:private ^:const highest-known-spec-version 17 )
912
2730 (java-spec-versions nil ))
2831 ([range-boundaries]
2932 (let [int-range-boundaries (filter #(re-matches #"\d +" %) (keys range-boundaries))
30- curr-version (or *java-spec-version-override* java-spec-version)
33+ curr-version (or *java-spec-version-override* ( current- java-spec-version) )
3134 highest-v (highest-version (conj int-range-boundaries curr-version))]
3235 (if (and highest-v (> highest-v highest-known-spec-version))
3336 (->> (inc highest-v)
106109 [& definitions ]
107110 (let [num-defs (count definitions )
108111 partitions (inputs->version-ranges (map first (partition 2 definitions )))]
109- `(case (or *java-spec-version-override* ~ java-spec-version)
112+ `(case (or *java-spec-version-override* ( current- java-spec-version) )
110113 ~@(map-indexed (partial map-indexed-case-exprs num-defs partitions) definitions ))))
You can’t perform that action at this time.
0 commit comments