Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clj-kondo fails with No maching field found: getMessage for class java.lang.NullPointerException when initializing cache #61

Closed
jumarko opened this issue Apr 8, 2019 · 4 comments
Labels
bug Something isn't working

Comments

@jumarko
Copy link

jumarko commented Apr 8, 2019

I've just installed clj-kondo via homebrew on my Mac OS X (10.14.3) and tried to run it on a closed-source project (fairly non-trivial with lots of dependencies) but cache initialization fails after a while with the following error:

$ clj-kondo --version
clj-kondo v2019.04.07-alpha

$ clj-kondo --lint $(lein classpath) --cache
...
Exception in thread "main" java.lang.IllegalArgumentException: No matching field found: getMessage for class java.lang.NullPointerException
        at clojure.lang.Reflector.getInstanceField(Reflector.java:397)
        at clojure.lang.Reflector.invokeNoArgInstanceMember(Reflector.java:440)
        at clojure.stacktrace$print_throwable.invokeStatic(stacktrace.clj:43)
        at clojure.stacktrace$print_stack_trace.invokeStatic(stacktrace.clj:55)
        at clojure.stacktrace$print_stack_trace.invoke(stacktrace.clj:48)
        at clojure.stacktrace$print_stack_trace.invokeStatic(stacktrace.clj:53)
        at clojure.stacktrace$print_stack_trace.invoke(stacktrace.clj:48)
        at clj_kondo.main$_main$fn__4224.invoke(main.clj:269)
        at clj_kondo.main$_main.invokeStatic(main.clj:267)
        at clj_kondo.main$_main.doInvoke(main.clj:265)
        at clojure.lang.RestFn.applyTo(RestFn.java:137)
        at clj_kondo.main.main(Unknown Source)

I tried the same on my clojure-experiments public project and it fails again with the same error

I've tried both Java 8 and Java 11 => the same result.

I've got a bunch of extra dependencies in my ~/.lein/profiles.clj so I thought they may affect it too.
However, I ran this using only base lein profile and the result is again the same:

clj-kondo --lint $(lein with-profile base classpath) --cache

WARNING!!! version ranges found for:
[net.cgrand/sjacket "0.1.1"] -> [org.clojure/clojure "[1.3.0,)"]
Consider using [net.cgrand/sjacket "0.1.1" :exclusions [org.clojure/clojure]].
[net.cgrand/sjacket "0.1.1"] -> [net.cgrand/regex "1.1.0"] -> [org.clojure/clojure "[1.2.0,)"]
Consider using [net.cgrand/sjacket "0.1.1" :exclusions [org.clojure/clojure]].
[net.cgrand/sjacket "0.1.1"] -> [net.cgrand/parsley "0.9.2"] -> [net.cgrand/regex "1.1.0"] -> [org.clojure/clojure "[1.2.0,)"]
Consider using [net.cgrand/sjacket "0.1.1" :exclusions [org.clojure/clojure]].

Exception in thread "main" java.lang.IllegalArgumentException: No matching field found: getMessage for class java.lang.NullPointerException
        at clojure.lang.Reflector.getInstanceField(Reflector.java:397)
        at clojure.lang.Reflector.invokeNoArgInstanceMember(Reflector.java:440)
        at clojure.stacktrace$print_throwable.invokeStatic(stacktrace.clj:43)
        at clojure.stacktrace$print_stack_trace.invokeStatic(stacktrace.clj:55)
        at clojure.stacktrace$print_stack_trace.invoke(stacktrace.clj:48)
        at clojure.stacktrace$print_stack_trace.invokeStatic(stacktrace.clj:53)
        at clojure.stacktrace$print_stack_trace.invoke(stacktrace.clj:48)
        at clj_kondo.main$_main$fn__4224.invoke(main.clj:269)
        at clj_kondo.main$_main.invokeStatic(main.clj:267)
        at clj_kondo.main$_main.doInvoke(main.clj:265)
        at clojure.lang.RestFn.applyTo(RestFn.java:137)
        at clj_kondo.main.main(Unknown Source)
@jumarko jumarko changed the title clj-kondo fails with No maching field found: getMessage for class java.lang.NullPointerException when initializing cache in clj-kondo fails with No maching field found: getMessage for class java.lang.NullPointerException when initializing cache Apr 8, 2019
@borkdude borkdude added the bug Something isn't working label Apr 8, 2019
@borkdude
Copy link
Member

borkdude commented Apr 8, 2019

Three issues:

Cannot use clojure.stracktrace/print-stack-trace with GraalVM: https://dev.clojure.org/jira/browse/CLJ-2502
So I'll drop back to Java .printStackTrace for now.

Second issue was a NullPointer exception: inc used on null when producing the summary.
I'll fix that as well.

Third issue: clj-kondo has trouble parsing the defn forms in https://github.com/tonsky/datascript/blob/master/src/datascript/db.cljc#L34. clj-kondo handles this gracefully by just ignoring them, but I'll take a look why this is the case.

borkdude added a commit that referenced this issue Apr 8, 2019
borkdude added a commit that referenced this issue Apr 8, 2019
borkdude added a commit that referenced this issue Apr 8, 2019
@borkdude
Copy link
Member

borkdude commented Apr 8, 2019

@jumarko Thanks for the report and trying out clj-kondo.
A binary with the fix included is available here:

Mac:
https://1047-176829714-gh.circle-artifacts.com/0/release/clj-kondo-2019.04.08-alpha-SNAPSHOT-macos-amd64.tar.gz

Linux:
https://1045-176829714-gh.circle-artifacts.com/0/release/clj-kondo-2019.04.08-alpha-SNAPSHOT-linux-amd64.tar.gz

Can you try this out before I'll merge to master?

@jumarko
Copy link
Author

jumarko commented Apr 8, 2019

@borkdude thanks for the super-fast response!
I can confirm that the cache initialization now works fine.

borkdude added a commit that referenced this issue Apr 8, 2019
@borkdude
Copy link
Member

borkdude commented Apr 8, 2019

Fixed with bf14173

@borkdude borkdude closed this as completed Apr 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants