Fork me on GitHub
#clojure-spec
<
2020-04-19
>
salam01:04:54

@alexmiller It seems like the Clojure Spec 1 alpha JAR is compiled against Java 1.5 (class file version 49). Is that intentional? It seemed a bit odd now that Clojure itself targets Java 1.8 (class file version 52).

Alex Miller (Clojure team)01:04:39

Which version in particular?

salam01:04:04

this is what's on my class path: spec.alpha-0.2.176.jar

salam01:04:57

i took a look at the pom.xml (https://github.com/clojure/spec.alpha/blob/master/pom.xml) file for spec.alpha and the absence of <target.version>1.8</target.version> in the <properties> section seems to confirm that.

Alex Miller (Clojure team)01:04:50

Iā€™m not at a computer but certainly older versions of the parent pom could have produced that

salam01:04:58

I see. I was experimenting with https://openjdk.java.net/jeps/310 and noticed the following warning and figured I should at least let you know:

OpenJDK 64-Bit Server VM warning: Pre JDK 6 class not supported by CDS: 49.0 clojure/spec/alpha/Spec
Preload Warning: Cannot find clojure/spec/alpha/Spec

Alex Miller (Clojure team)01:04:14

There is a newer version that I suspect is newer bytecode. - 0.2.187

Alex Miller (Clojure team)02:04:14

Spec was introduced in the same release that bumped to java 1.8 bytecode and it took a while for the contrib libs to catch up

salam02:04:54

ah, i see. it appears that the release version 1.10.1 of the clojure.jar still depends on the version that i have: https://search.maven.org/artifact/org.clojure/clojure/1.10.1/jar

Alex Miller (Clojure team)02:04:51

You can add an explicit dependency on the newer spec.alpha version to override

salam02:04:03

yep, i'll go with that. thank you.

salam03:04:50

ok, reporting back here. it turns out [org.clojure/spec.alpha "0.2.187"] is compiled against java 1.5 as well.

seancorfield04:04:34

Confirmed, if I'm reading this right. class version 49 for spec.alpha 0.2.187, but class version 52 for clojure itself. The latter is Java 8.

practicalli-johnny08:04:06

spec version 1 or version 2, that is the question šŸ™‚ My default assuming is spec 1 I am starting a new project, which I will mainly use spec for data structures I design and pass to functions as arguments. Its a data science visualisation project so there is a lot of data. I will also write specs for the functions that for the API for each namespace. Just checking that I am not missing an obvious benefit of using spec 2. Thank you.

mpenet08:04:13

1 for sure. v2 seems still wip, especially fn annotations which apparently will be improved/modified

šŸ‘ 4
didibus08:04:17

Spec 2 is experimental and subject to breaking change

didibus08:04:30

So unless you are doing this for fun, go with Spec 1

šŸ‘ 4