This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-07-14
Channels
- # aleph (4)
- # announcements (1)
- # beginners (40)
- # calva (6)
- # cider (10)
- # clara (5)
- # cljdoc (24)
- # cljs-dev (2)
- # clojure (24)
- # clojure-italy (4)
- # clojure-uk (5)
- # clojurescript (13)
- # community-development (5)
- # core-async (7)
- # data-science (9)
- # datomic (2)
- # duct (12)
- # emacs (3)
- # events (1)
- # figwheel-main (2)
- # fulcro (2)
- # malli (1)
- # off-topic (1)
- # parinfer (1)
- # precept (6)
- # re-frame (27)
- # shadow-cljs (5)
- # sql (6)
- # unrepl (2)
Is there a workaround for conflicts with clojure-required java classes? I’m trying to run:
(import '(software.amazon.awscdk.services.lambda Runtime))
But I get the error:
Runtime already refers to: class java.lang.Runtime
don't think so... there's refer-clojure
which is only vaguely related. doesn't work for that
You don’t have to import
@g7s you can file a ticket at https://clojure.atlassian.net/servicedesk/customer/portal/1, no login needed
is it possible to make the compiler explicit about which file is buggy by printing the full filepath instead of only the name?
I actually made a change in this area for 1.10.1 - are you on 1.10.0 or 1.10.1?
I am using 1.10.1, and in stack traces of exceptions I see file names with no directory path leading to them. Are the improvements you are referring to related to printing the fully-namespace-qualified symbol name of the function, or something else?
I’m talking about the location in the message itself (but it depends some on the source of the exception)
The particular example above actually must be 1.10.0 as this is a clojure.main failure and should dump to a file
The stack trace is never full, as that’s in the stack line print
That would be nice -- I suspect it is a JVM limitation somewhere, never looked into the root cause of why a longer path is not shown.
@alexmiller well then I guess I did (wasn't sure if this was the right way)
@i From the class included with most StackTraceElement objects in a stack trace, you can use various Java method calls to try to find the full path to a compiled .class file (if there is one) or a .clj source file, but note that there might be both a ".class" and a ".clj" file in the set of available JVM resources, and nothing in the StackTraceElement can tell you for sure which -- only way I know is to try a few JVM .getResource method calls with a few different names to check what is available. The path name of the .class file need not have any correspondence with a Clojure source file, but often they will be correlated because of the way people typically create the directory structure of their Clojure files.
This code seems to work if there is a .class file, but finds no resource if there is no .class file -- you could make straightforward additions to this code to look for a .clj file if there was no .class file, or whatever order you wanted to try looking for them:
;;
(defn class-info [classname-str]
(let [klass (Class/forName classname-str)
loader (.getClassLoader klass)
resource-name (str (clojure.string/replace classname-str "." "/")
".class")
rsrc (.getResource loader resource-name)]
{:klass klass :loader loader :resource-name resource-name
:resource rsrc}))
I actually made a change in this area for 1.10.1 - are you on 1.10.0 or 1.10.1?
hi everyone. I’m trying to find the syntax that lets you use 2 + 2
instead of (+ 2 2)
. can someone remind me pls
yeah, that’s what I was looking for! thank you @deleted-user 🙂