Fork me on GitHub

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


hmm adding a require of the ns seems to fix it


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 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


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

pleasetrythisathome04:08:50 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


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


@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?


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


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