l3nz / cli-matic

Compact, hands-free [sub]command line parsing library for Clojure.
Eclipse Public License 2.0
361 stars 29 forks source link

YAML tests are failing under Java 11 #89

Closed lread closed 3 years ago

lread commented 4 years ago

version

0.3.11

platform macOS

> java -version
openjdk version "11.0.5" 2019-10-15
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.5+10)
Eclipse OpenJ9 VM AdoptOpenJDK (build openj9-0.17.0, JRE 11 Mac OS X amd64-64-Bit Compressed References 20191016_371 (JIT enabled, AOT enabled)
OpenJ9   - 77c1cf708
OMR      - 20db4fbc
JCL      - 2a7af5674b based on jdk-11.0.5+10)

Also tried Amazon Correto

> java -version
openjdk version "11.0.5" 2019-10-15 LTS
OpenJDK Runtime Environment Corretto-11.0.5.10.1 (build 11.0.5+10-LTS)
OpenJDK 64-Bit Server VM Corretto-11.0.5.10.1 (build 11.0.5+10-LTS, mixed mode)

problem

Three YAML tests are failing under Java 11. These same three tests pass under Java 8.

repro

lein test shows the following failures:

lein test :only cli-matic.presets-test/test-yaml

FAIL in (test-yaml) (presets_test.cljc:354)
YAML single value
expected: (= (parse-cmds-simpler ["foo" "--val" "a: 1\nb: 2"] (mkDummyCfg {:option "val", :as "x", :type :yaml})) {:commandline {:_arguments [], :val {"a" 1, "b" 2}}, :error-text "", :parse-errors :NONE})
  actual: (not (= {:commandline {}, :parse-errors :ERR-PARMS-SUBCMD, :error-text "Error while parsing option \"--val a: 1\\nb: 2\": java.lang.AssertionError: Assert failed: with-yaml?"} {:commandline {:_arguments [], :val {"a" 1, "b" 2}}, :error-text "", :parse-errors :NONE}))

lein test :only cli-matic.presets-test/test-yaml

FAIL in (test-yaml) (presets_test.cljc:368)
Slurping multiline YAML
expected: (= (parse-cmds-simpler ["foo" "--val" "resources/yaml_simple.yaml"] (mkDummyCfg {:option "val", :as "x", :type :yamlfile})) {:commandline {:_arguments [], :val {"list" [1 2 "hi"], "intval" 100, "strval" "good"}}, :error-text "", :parse-errors :NONE})
  actual: (not (= {:commandline {}, :parse-errors :ERR-PARMS-SUBCMD, :error-text "Error while parsing option \"--val resources/yaml_simple.yaml\": java.lang.AssertionError: Assert failed: with-yaml?"} {:commandline {:_arguments [], :val {"list" [1 2 "hi"], "intval" 100, "strval" "good"}}, :error-text "", :parse-errors :NONE}))

lein test :only cli-matic.presets-test/test-yaml

FAIL in (test-yaml) (presets_test.cljc:383)
Complex multiline YAML
expected: (= (-> (parse-cmds-simpler ["foo" "--val" "resources/yaml_full.yaml"] (mkDummyCfg {:option "val", :as "x", :type :yamlfile})) (get-in [:commandline :val]) (select-keys ["invoice" "date"])) {"invoice" 34843, "date" #inst "2001-01-23T00:00:00.000-00:00"})
  actual: (not (= {} {"invoice" 34843, "date" #inst "2001-01-23T00:00:00.000-00:00"}))

expected behavior

Tests should pass under Java 11

actual behavior

see repro above

observations

When I tried out the current git HEAD of io.forward/yaml, YAML tests pass under Java 11 but then failed under java 8.

diavoletto76 commented 3 years ago

Hi, now version 0.4.3 works fine under Java 11.

I think that under Java 8 tests fail because io.forward/yaml 1.0.10 was compiled with Java 11 which produces classes incompatible with Java 8.

Please have a look also at io.forward/yamal - issue #29 and issue #109.

l3nz commented 3 years ago

Thanks - closing.