Re: Class Loader Issue - Using Clojure for Annotation Processing

2014-12-28 Thread Frankie Sardo
Apologies for resurrecting the thread but I wanted to add a link to a 
minimalistic example that reproduces the issue, if anybody comes across it:

https://github.com/frankiesardo/annotation-processing

On Friday, December 12, 2014 7:46:07 PM UTC, Frankie Sardo wrote:

 Hi all,
 I'd like to use Clojure for processing Java annotations at compile time. 
 (Particularly useful for Android)

 https://github.com/frankiesardo/icepick/blob/clojure/src/icepick/core.clj

 I'm extending javax.annotation.processing.AbstractProcessor, I can create 
 the generated class, I can test it fine. Everything works well. 
 But when I'm actually using it by packaging the jar with META-INF/services 
 the compiler throws an ExceptionInInitializerError.

 I've been reading about the issues with Clojure and ServiceLoader 
 http://blog.mattiasholmqvist.se/?p=631 but it's not clear to me how I can 
 make the java compiler initialise my generated class right. I tried forcing 
 the context class loader to false 

 (alter-var-root #'*use-context-classloader* (constantly false)) 

 as some discussion here mentioned it 
 https://groups.google.com/forum/#!topic/clojure/gRhD0HOwFGc but it 
 doesn't seem to do anything.

 I found it very natural to write annotation processing with Clojure and it 
 would be a shame giving up. I lack the knowledge to tackle this problem 
 deep down and I wonder if you guys have any wisdom to share?

 Cheers
 Frankie




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


Class Loader Issue - Using Clojure for Annotation Processing

2014-12-12 Thread Frankie Sardo
Hi all,
I'd like to use Clojure for processing Java annotations at compile time. 
(Particularly useful for Android)

https://github.com/frankiesardo/icepick/blob/clojure/src/icepick/core.clj

I'm extending javax.annotation.processing.AbstractProcessor, I can create 
the generated class, I can test it fine. Everything works well. 
But when I'm actually using it by packaging the jar with META-INF/services 
the compiler throws an ExceptionInInitializerError.

I've been reading about the issues with Clojure and 
ServiceLoader http://blog.mattiasholmqvist.se/?p=631 but it's not clear to 
me how I can make the java compiler initialise my generated class right. I 
tried forcing the context class loader to false 

(alter-var-root #'*use-context-classloader* (constantly false)) 

as some discussion here mentioned it 
https://groups.google.com/forum/#!topic/clojure/gRhD0HOwFGc but it doesn't 
seem to do anything.

I found it very natural to write annotation processing with Clojure and it 
would be a shame giving up. I lack the knowledge to tackle this problem 
deep down and I wonder if you guys have any wisdom to share?

Cheers
Frankie


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