I'm just pulling LibGDX from maven and trying to call its classes via 
Clojure. I don't doubt that mock classes could work, but I think the effort 
in writing and maintaining them would be more than it's worth.

On Saturday, October 12, 2013 4:25:15 PM UTC-4, Colin Fleming wrote:
>
> In my case I'm AOTing, so compiling against one set of classes then 
> running against another isn't difficult. If you're compiling from source 
> it's tougher, but aren't you basically compiling at runtime at that point? 
> Couldn't you work around it changing your startup order (i.e. loading 
> LibGDX with some Java and then requiring your Clojure)?
>
>
> On 13 October 2013 04:54, Zach Oakes <zso...@gmail.com <javascript:>>wrote:
>
>> Compiling against mock classes is the other solution I've tried as well. 
>> I'm not sure how the real classes would take over once the program is run, 
>> and also it's a quite laborious and brittle solution since updates to the 
>> real classes would break the mock classes. Definitely interested in ideas 
>> others may have.
>>
>>
>> On Saturday, October 12, 2013 4:36:31 AM UTC-4, Colin Fleming wrote:
>>
>>> Yup, it's true. I suffer from this as well. When I'm compiling Cursive 
>>> normal compilation fails because a bunch of the IntelliJ classes assume the 
>>> IntelliJ platform is running and barf if it's not. I have an awful hack 
>>> which is to run the compilation within their test framework which sets up a 
>>> mock platform, but it's really ugly. I'd appreciate a clever workaround to 
>>> this too. The other thing I've considered is to create a set of API classes 
>>> to compile against which would be the standard classes with the static 
>>> initialisers stripped out with ASM or something. In fact you could strip 
>>> out everything but the signatures.
>>>
>>>
>>> On 12 October 2013 21:17, Wujek Srujek <wujek....@gmail.com> 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> 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
>>>>>
>>>>> 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
>>>>>
>>>>> For more options, visit this group at
>>>>> http://groups.google.com/**group/clojure?hl=en<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.
>>>>>
>>>>> For more options, visit 
>>>>> https://groups.google.com/**groups/opt_out<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 clo...@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+u...@**googlegroups.com
>>>>
>>>> For more options, visit this group at
>>>> http://groups.google.com/**group/clojure?hl=en<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.
>>>>
>>>> For more options, visit 
>>>> https://groups.google.com/**groups/opt_out<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 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