I think I am seeing static initialisers being run at AOT time when the
class is used as a type hint tag. This isn't a regression from previous
versions of clojure, but with the forNameNonLoading changes that have gone
in recently I was under the impression that this shouldn't be a problem any
more.

My specific case has a static initialiser which loads a native library (and
I don't have the appropriate binary architecture for the machine doing the
compilation).

The function definition
(defn some-function [^com.my_class.ExampleWhichLoadsNative x] ...)

fails at AOT compile time with the (abridged) stack trace containing:
...
        at clojure.lang.Compiler.analyzeSeq(Compiler.java:6715)
at clojure.lang.Compiler.analyze(Compiler.java:6499)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6696)
at clojure.lang.Compiler.analyze(Compiler.java:6499)
at clojure.lang.Compiler.access$200(Compiler.java:38)
at clojure.lang.Compiler$DefExpr$Parser.parse(Compiler.java:560)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6708)
at clojure.lang.Compiler.analyze(Compiler.java:6499)
at clojure.lang.Compiler.analyze(Compiler.java:6460)
at clojure.lang.Compiler.compile1(Compiler.java:7285)
at clojure.lang.Compiler.compile(Compiler.java:7356)
at clojure.lang.RT.compile(RT.java:406)
...
Caused by:
...
        <my class clinit>
        at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:274)
at clojure.lang.RT.classForName(RT.java:2127)
at clojure.lang.RT.classForName(RT.java:2136)
at clojure.lang.Compiler$HostExpr.maybeClass(Compiler.java:1000)
at clojure.lang.Compiler$HostExpr.tagToClass(Compiler.java:1092)
at clojure.lang.Compiler.tagClass(Compiler.java:8187)
at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5218)
at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3900)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6706)
...

On Wed Jan 21 2015 at 23:58:28 Alan Moore <kahunamo...@gmail.com> wrote:

> Sweet - thanks for the reply. I hope I didn't sound impatient... I'm very
> grateful for your hard work on it. I'd offer to help but I'm sure it is
> beyond me and my crazy-mad Clojure skillz(tm). I think I'll leave the hard
> stuff to the real experts :-)
>
> Alan
>
>
> On Wednesday, January 21, 2015 at 6:07:13 AM UTC-8, Alex Miller wrote:
>>
>> I am actively working on an updated set of patches, hopefully for
>> inclusion in the next alpha.
>>
>> Alex
>
>  --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to