Fork me on GitHub

Did anyone notice a problem with Timbre when using JDK 17? I got a log with this stacktrace:

[33mtaoensso.timbre/[1;33mstacktrace[m  [32m            timbre.cljc:  944[m
                                                      [33mio.aviso.exception/[1;33mformat-exception[m  [32m          exception.clj:  641[m
                                                      [33mio.aviso.exception/[1;33mformat-exception[m  [32m          exception.clj:  643[m
                                                       [33mio.aviso.exception/[1;33mwrite-exception[m  [32m          exception.clj:  636[m
                                                     [33mio.aviso.exception/[1;33manalyze-exception[m  [32m          exception.clj:  453[m
                                                      [33mio.aviso.exception/[1;33mexpand-exception[m  [32m          exception.clj:  418[m
                                                            [33mio.aviso.exception/[1;33mmatch-keys[m  [32m          exception.clj:  101[m
                                                                      [33mclojure.core/[1;33mreduce[m  [32m               core.clj: 6886[m
                                                              [33mclojure.core.protocols/fn/[1;33mG[m  [32m          protocols.clj:   13[m
                                                                [33mclojure.core.protocols/[1;33mfn[m  [32m          protocols.clj:   75[m
                                                        [33mclojure.core.protocols/[1;33mseq-reduce[m  [32m          protocols.clj:   24[m
                                                                         [33mclojure.core/[1;33mseq[m  [32m               core.clj:  139[m
                                                                                      [37m...[m  [32m                             [m
                                                              [33mclojure.core/bean/thisfn/[1;33mfn[m  [32m         core_proxy.clj:  427[m
                                                                      [33mclojure.core/bean/[1;33mv[m  [32m         core_proxy.clj:  419[m
                                                                  [33mclojure.core/bean/fn/[1;33mfn[m  [32m         core_proxy.clj:  413[m
                                                                                      [37m...[m  [32m                             [m
                                [37mjdk.internal.reflect.Reflection.newIllegalAccessException[m  [32m  392[m
[1;31mjava.lang.IllegalAccessException[m: [3mclass clojure.core$bean$fn__7278$fn__7279 cannot access class (in module java.base) because module java.base does not export to unnamed module @26933859[m
It looks like it's trying to access which is no longer exposed in JDK 17 (or maybe some earlier JDK versions)?


--add-exports=java.base/ something along those lines in jvm opts ? (or add-opens even) (i don't think it's timbre related, it looks like it's aviso pretty not being able to "datafy" the exception)


But it's timbre using aviso, right? I'm wondering what information they are trying to get that makes it more useful than plain stacktrace..


yes, maybe you can propose a fallback when the exception is not introspectable


(StackTraceElement->vec (.getStackTrace (Thread/currentThread)))

; Execution error (ClassCastException) at user/eval9690 (REPL:138).
; class [Ljava.lang.StackTraceElement; cannot be cast to class java.lang.StackTraceElement ([Ljava.lang.StackTraceElement; and java.lang.StackTraceElement are in module java.base of loader 'bootstrap')
What is the difference between Ljava.lang.x and java.lang.x and can one be converted to the other?


It's [Ljava.lang.x; actually - the [ and ; bits are still important.


And on how to convert - just map over all of them, assuming you need all of them:

(map StackTraceElement->vec (.getStackTrace (Thread/currentThread)))


🙏:skin-tone-3: Makes obvious sense, once you know what it means. Of course a list of stack traces is not the same as a single stack trace.


...err I guess I mean "stack trace elements". Ok got it now. 💡