Guys,

I've come across an annoying issue that has cost me some tie - so I thought 
I would post it in case anyone else has the same problem or a better 
solution - or perhaps I am just doing it wrong :-) ?

If I had more time I would write a testcase and try to reduce it further but 
I haven't :-(

It manifests itself thus :

You define an interface Foo in xxx/foo.clj

You gen-class a class Bar which expects a Foo in its construction.

In yyy/Bar.clj :
I :use xxx.foo
I :import xxx.foo,Foo
I specify xxx.foo..Foo's canonical name in the :constructor description.

Yet, and this is the interesting bit, on my netbook I always get a 
compilation error - "ClassNotFound xxx.foo.Foo". Whilst on my desktop and 
other machines on which I have tried the compilation it proceeds with no 
problem.

I briefly compared JDK, Maven and Clojure versions on all the boxes that I 
tested this on - the netbook (on which the problem occurs) had the same 
versions as the other machines. All were using a clean git tree of the 
project in question.

I can work around the problem by declaring that the constructor expects 
Object, then using a ^Foo type hint in the definition of the -init function 
- so I know that this can happily see Foo.

Is it possible that there is some sort of race condition going on ? That 
Bar's constructor has failed to express its dependency on Foo somehow and 
that it it just luck that on faster multicore machines Foo is compiled in 
time to be seen at Bar's constructor's compilation time ? whereas on slower 
single core machines like my netbook, it is not ?

Its taken quite a while to reduce it to this, as the problem moves around as 
code changes etc and only manifests itself on one of the machines with which 
I work... but if there is interest I may be able to reduce it further.

thanks for your time,

Jules


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

Reply via email to