Fork me on GitHub
#boot
<
2019-08-15
>
pleasetrythisathome03:08:13

so when i try (aot :all true) i get a failure on an import statement of a .clj file that imports a class that also needs to be aot compiled since boot is trying to compile it before the other namespace. do import’s not get considered in a dependency graph for aot compilation?

Alex Miller (Clojure team)12:08:34

No, they don’t. import is for classes, and classes are already compiled. compilation happens as part of loading under require

pleasetrythisathome04:08:23

hmm adding a require of the ns seems to fix it

pleasetrythisathome04:08:03

so the issue i’m attempting around is that i’m extending a class that is used by java code i’m running from clojure. i’d run into inconsistent issues where aoting the class before the clojure runtime is started (either boot or a clojure repl started by boot) gives me an abstractmethoderror for a method defined as abstract by the superclass i’m extending. based on this https://clojure.org/reference/compilation#_runtime it sounds like the var may not be bound when the class is instantiated, but I don’t understand why that would be since the code instantiating the class requires the namespace that is generating said class

pleasetrythisathome04:08:17

i’d say it works maybe 50% of the time, pretty randomly

pleasetrythisathome04:08:50

https://clojure.atlassian.net/browse/CLJ-1544#comment-43558 refers to protocols needing to be aot’d if they exist in an external library, does that mean i need to aot compile the java superclass as well?

Alex Miller (Clojure team)12:08:32

That question doesn’t make sense - java classes are always compiled by java, never by Clojure aot

pleasetrythisathome04:08:38

there’s a lot here https://groups.google.com/forum/#!searchin/clojure/aot%7Csort:date/clojure/aejqMwraPk8/UnJhurORBAAJ that i’m not sure i entirely understand…but i have a feeling might contain answers

pleasetrythisathome04:08:16

@alexmiller specifically your comment about anything “downstream” should be AOT’d as well. does that mean that any clojure code calling a class created with gen-class should be AOT’d?

pleasetrythisathome04:08:52

and if so is this possible to do at the repl?

Alex Miller (Clojure team)12:08:22

No to the prior question, it means that any aot compiled class should never load a ns in a clj file, only aot compiled code

pleasetrythisathome01:08:43

thanks that makes sense!

Alex Miller (Clojure team)12:08:00

But it’s ok from in a clj to require an aot compiled class