marick / Midje

Midje provides a migration path from clojure.test to a more flexible, readable, abstract, and gracious style of testing
MIT License
1.69k stars 129 forks source link

Exception in thread "main" java.lang.IllegalArgumentException: Must hint overloaded method: toArray, compiling:(ordered/set.clj:12:1) #487

Closed habruening closed 1 year ago

habruening commented 1 year ago

The quux example of the tutorial does not work for me. I tried many things. Going back to Java 11. Using another version of Leiningen. Going back to midje 1.6.3.

I suppose, the problem is this: https://github.com/clj-commons/ordered/issues/45.

But shouldn't the examples work out of the box?

me@linux:~/fjt/quux$ lein version
Leiningen 2.10.0 on Java 21.0.1 Java HotSpot(TM) 64-Bit Server VM
me@linux:~/fjt/quux$ java --version
java 21.0.1 2023-10-17 LTS
Java(TM) SE Runtime Environment (build 21.0.1+12-LTS-29)
Java HotSpot(TM) 64-Bit Server VM (build 21.0.1+12-LTS-29, mixed mode, sharing)
me@linux:~/fjt/quux$ cat ~/.lein/profiles.clj 
{:user {:plugins [[lein-midje "3.2.1"]]}}
me@linux:~/fjt$ cd ..
me@linux:~/fjt$ rm quux/ -r
me@linux:~/fjt$ lein new midje quux
Generating a project called 'quux' based on the 'midje' template.
me@linux:~/fjt$ cd quux/
me@linux:~/fjt/quux$ cat project.clj 
(defproject quux "0.0.1-SNAPSHOT"
  :description "Cool new project to do things and stuff"
  :dependencies [[org.clojure/clojure "1.7.0"]]
  :profiles {:dev {:dependencies [[midje "1.7.0"]]}
             ;; You can add dependencies that apply to `lein midje` below.
             ;; An example would be changing the logging destination for test runs.
             :midje {}})
             ;; Note that Midje itself is in the `dev` profile to support
             ;; running autotest in the repl.
me@linux:~/fjt/quux$ lein test
Exception in thread "main" java.lang.IllegalArgumentException: Must hint overloaded method: toArray, compiling:(ordered/set.clj:12:1)
        at clojure.lang.Compiler.analyzeSeq(Compiler.java:6730)
        at clojure.lang.Compiler.analyze(Compiler.java:6524)
        at clojure.lang.Compiler.analyze(Compiler.java:6485)
        at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5861)
        at clojure.lang.Compiler$LetExpr$Parser.parse(Compiler.java:6179)
        at clojure.lang.Compiler.analyzeSeq(Compiler.java:6723)
        at clojure.lang.Compiler.analyze(Compiler.java:6524)
        at clojure.lang.Compiler.analyze(Compiler.java:6485)
        at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5861)
        at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5296)
        at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3925)
        at clojure.lang.Compiler.analyzeSeq(Compiler.java:6721)
        at clojure.lang.Compiler.analyze(Compiler.java:6524)
        at clojure.lang.Compiler.eval(Compiler.java:6779)
        at clojure.lang.Compiler.load(Compiler.java:7227)
        at clojure.lang.RT.loadResourceScript(RT.java:371)
        at clojure.lang.RT.loadResourceScript(RT.java:362)
        at clojure.lang.RT.load(RT.java:446)
        at clojure.lang.RT.load(RT.java:412)
        at clojure.core$load$fn__5448.invoke(core.clj:5866)
        at clojure.core$load.doInvoke(core.clj:5865)
        at clojure.lang.RestFn.invoke(RestFn.java:408)
        at clojure.core$load_one.invoke(core.clj:5671)
        at clojure.core$load_lib$fn__5397.invoke(core.clj:5711)
        at clojure.core$load_lib.doInvoke(core.clj:5710)
        at clojure.lang.RestFn.applyTo(RestFn.java:142)
        at clojure.core$apply.invoke(core.clj:632)
        at clojure.core$load_libs.doInvoke(core.clj:5749)
        at clojure.lang.RestFn.applyTo(RestFn.java:137)
        at clojure.core$apply.invoke(core.clj:632)
        at clojure.core$require.doInvoke(core.clj:5832)
        at clojure.lang.RestFn.invoke(RestFn.java:619)
        at midje.emission.plugins.util$eval1282$loading__5340__auto____1283.invoke(util.clj:1)
        at midje.emission.plugins.util$eval1282.invoke(util.clj:1)
        at clojure.lang.Compiler.eval(Compiler.java:6782)
        at clojure.lang.Compiler.eval(Compiler.java:6771)
        at clojure.lang.Compiler.load(Compiler.java:7227)
        at clojure.lang.RT.loadResourceScript(RT.java:371)
        at clojure.lang.RT.loadResourceScript(RT.java:362)
        at clojure.lang.RT.load(RT.java:446)
        at clojure.lang.RT.load(RT.java:412)
        at clojure.core$load$fn__5448.invoke(core.clj:5866)
        at clojure.core$load.doInvoke(core.clj:5865)
        at clojure.lang.RestFn.invoke(RestFn.java:408)
        at clojure.core$load_one.invoke(core.clj:5671)
        at clojure.core$load_lib$fn__5397.invoke(core.clj:5711)
        at clojure.core$load_lib.doInvoke(core.clj:5710)
        at clojure.lang.RestFn.applyTo(RestFn.java:142)
        at clojure.core$apply.invoke(core.clj:632)
        at clojure.core$load_libs.doInvoke(core.clj:5749)
        at clojure.lang.RestFn.applyTo(RestFn.java:137)
        at clojure.core$apply.invoke(core.clj:632)
        at clojure.core$require.doInvoke(core.clj:5832)
        at clojure.lang.RestFn.invoke(RestFn.java:551)
        at midje.emission.plugins.default$eval1174$loading__5340__auto____1175.invoke(default.clj:1)
        at midje.emission.plugins.default$eval1174.invoke(default.clj:1)
        at clojure.lang.Compiler.eval(Compiler.java:6782)
        at clojure.lang.Compiler.eval(Compiler.java:6771)
        at clojure.lang.Compiler.load(Compiler.java:7227)
        at clojure.lang.RT.loadResourceScript(RT.java:371)
        at clojure.lang.RT.loadResourceScript(RT.java:362)
        at clojure.lang.RT.load(RT.java:446)
        at clojure.lang.RT.load(RT.java:412)
        at clojure.core$load$fn__5448.invoke(core.clj:5866)
        at clojure.core$load.doInvoke(core.clj:5865)
        at clojure.lang.RestFn.invoke(RestFn.java:408)
        at clojure.core$load_one.invoke(core.clj:5671)
        at clojure.core$load_lib$fn__5397.invoke(core.clj:5711)
        at clojure.core$load_lib.doInvoke(core.clj:5710)
        at clojure.lang.RestFn.applyTo(RestFn.java:142)
        at clojure.core$apply.invoke(core.clj:632)
        at clojure.core$load_libs.doInvoke(core.clj:5749)
        at clojure.lang.RestFn.applyTo(RestFn.java:137)
        at clojure.core$apply.invoke(core.clj:632)
        at clojure.core$require.doInvoke(core.clj:5832)
        at clojure.lang.RestFn.invoke(RestFn.java:421)
        at midje.emission.api$load_plugin.invoke(api.clj:25)
        at clojure.lang.Var.invoke(Var.java:379)
        at midje.Bootstrap$bootstrap.invoke(Bootstrap.clj:16)
        at quux.core_test$eval213.invoke(sweet.clj:2)
        at clojure.lang.Compiler.eval(Compiler.java:6782)
        at clojure.lang.Compiler.load(Compiler.java:7227)
        at clojure.lang.RT.loadResourceScript(RT.java:371)
        at clojure.lang.RT.loadResourceScript(RT.java:362)
        at clojure.lang.RT.load(RT.java:446)
        at clojure.lang.RT.load(RT.java:412)
        at clojure.core$load$fn__5448.invoke(core.clj:5866)
        at clojure.core$load.doInvoke(core.clj:5865)
        at clojure.lang.RestFn.invoke(RestFn.java:408)
        at clojure.core$load_one.invoke(core.clj:5671)
        at clojure.core$load_lib$fn__5397.invoke(core.clj:5711)
        at clojure.core$load_lib.doInvoke(core.clj:5710)
        at clojure.lang.RestFn.applyTo(RestFn.java:142)
        at clojure.core$apply.invoke(core.clj:632)
        at clojure.core$load_libs.doInvoke(core.clj:5749)
        at clojure.lang.RestFn.applyTo(RestFn.java:137)
        at clojure.core$apply.invoke(core.clj:632)
        at clojure.core$require.doInvoke(core.clj:5832)
        at clojure.lang.RestFn.invoke(RestFn.java:421)
        at quux.core_test$eval191$loading__5340__auto____192.invoke(core_test.clj:1)
        at quux.core_test$eval191.invoke(core_test.clj:1)
        at clojure.lang.Compiler.eval(Compiler.java:6782)
        at clojure.lang.Compiler.eval(Compiler.java:6771)
        at clojure.lang.Compiler.load(Compiler.java:7227)
        at clojure.lang.RT.loadResourceScript(RT.java:371)
        at clojure.lang.RT.loadResourceScript(RT.java:362)
        at clojure.lang.RT.load(RT.java:446)
        at clojure.lang.RT.load(RT.java:412)
        at clojure.core$load$fn__5448.invoke(core.clj:5866)
        at clojure.core$load.doInvoke(core.clj:5865)
        at clojure.lang.RestFn.invoke(RestFn.java:408)
        at clojure.core$load_one.invoke(core.clj:5671)
        at clojure.core$load_lib$fn__5397.invoke(core.clj:5711)
        at clojure.core$load_lib.doInvoke(core.clj:5710)
        at clojure.lang.RestFn.applyTo(RestFn.java:142)
        at clojure.core$apply.invoke(core.clj:632)
        at clojure.core$load_libs.doInvoke(core.clj:5749)
        at clojure.lang.RestFn.applyTo(RestFn.java:137)
        at clojure.core$apply.invoke(core.clj:632)
        at clojure.core$require.doInvoke(core.clj:5832)
        at clojure.lang.RestFn.applyTo(RestFn.java:137)
        at clojure.core$apply.invoke(core.clj:630)
        at user$eval85.invoke(form-init3753810118924835477.clj:1)
        at clojure.lang.Compiler.eval(Compiler.java:6782)
        at clojure.lang.Compiler.eval(Compiler.java:6772)
        at clojure.lang.Compiler.load(Compiler.java:7227)
        at clojure.lang.Compiler.loadFile(Compiler.java:7165)
        at clojure.main$load_script.invoke(main.clj:275)
        at clojure.main$init_opt.invoke(main.clj:280)
        at clojure.main$initialize.invoke(main.clj:308)
        at clojure.main$null_opt.invoke(main.clj:343)
        at clojure.main$main.doInvoke(main.clj:421)
        at clojure.lang.RestFn.invoke(RestFn.java:421)
        at clojure.lang.Var.invoke(Var.java:383)
        at clojure.lang.AFn.applyToHelper(AFn.java:156)
        at clojure.lang.Var.applyTo(Var.java:700)
        at clojure.main.main(main.java:37)
Caused by: java.lang.IllegalArgumentException: Must hint overloaded method: toArray
        at clojure.lang.Compiler$NewInstanceMethod.parse(Compiler.java:8050)
        at clojure.lang.Compiler$NewInstanceExpr.build(Compiler.java:7642)
        at clojure.lang.Compiler$NewInstanceExpr$DeftypeParser.parse(Compiler.java:7523)
        at clojure.lang.Compiler.analyzeSeq(Compiler.java:6723)
        ... 136 more
Tests failed.
philomates commented 1 year ago

this is an issue with https://github.com/marick/lein-midje where it places an old version of midje in the project it generates. If you update to midje 1.10.9 it should work.

habruening commented 1 year ago

Indeed. That works! Thanks a lot!