I'd love to see a stack trace when that happens (could even be triggered by 
dumping stack in your static initializer if nothing else).

On Saturday, October 12, 2013 3:17:50 AM UTC-5, Wujek Srujek wrote:
>
> So you are saying compilation is trying to instantiate class and run 
> static initializers? This seems very backward, are you sure?
>
>
> On Sat, Oct 12, 2013 at 8:30 AM, Zach Oakes <zso...@gmail.com<javascript:>
> > wrote:
>
>> I should add, I am aware I can bring in a class dynamically with 
>> Class/forName, and that is what I ended up doing for the Timer class. 
>> However, this is not always practical, and sometimes is simply not an 
>> option if aot-compilation is required.
>>
>>
>> On Saturday, October 12, 2013 2:28:38 AM UTC-4, Zach Oakes wrote:
>>>
>>> I recently learned that merely importing a Java class in Clojure causes 
>>> static initializers to be run. Sometimes, this causes compilation errors, 
>>> because they are written with the assumption that they will only be run 
>>> during runtime.
>>>
>>> I ran into this just now while trying to make a simple Clojure game with 
>>> LibGDX. After simply importing its Timer class, I began getting compilation 
>>> errors. The stack trace shows it is due to a static 
>>> initializer<https://github.com/libgdx/libgdx/blob/511b557c1a2d23bf8110a05b0ef54cc20b7f958d/gdx/src/com/badlogic/gdx/utils/Timer.java#L32>attempting
>>>  to instantiate the class!
>>>
>>> I also ran into this recently while trying to use RoboVM. My question 
>>> is, do I have any options? I haven't found many discussions about this here 
>>> or elsewhere. This surprises me, because it seems like something more 
>>> people should be running into.
>>>
>>  -- 
>> -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@googlegroups.com<javascript:>
>> Note that posts from new members are moderated - please be patient with 
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+u...@googlegroups.com <javascript:>
>> 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+u...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>

-- 
-- 
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/groups/opt_out.

Reply via email to