querydsl / codegen

Java/Scala Code generation tool
Apache License 2.0
23 stars 22 forks source link

EvaluatorFactory has a hard dependency on URLClassLoader (OSGi-incompatible) #7

Closed petercgrant closed 12 years ago

petercgrant commented 12 years ago

I had problems running querydsl-collections on ServiceMix because the EvaluatorFactory in mysema/codegen has a hard dependency on URLClassLoader. OSGi containers use bundle class loaders, which aren't compatible with URLClassLoaders. I have developed a patch to extract the EvaluatorFactory interface and have written a new implementation that uses ECJ (Eclipse Compiler for Java). It will work with any ClassLoader. I have also written patches to convert mysema/querydsl/querydsl-codegen and mysema/querydsl/querydsl-collections to use this new factory. These patches meet my needs with a hard-coded implementation in the DefaultEvaluatorFactory, but if there are any preferences for how to make the implementation configurable, please let me know and I'll shoot over the patches.

timowest commented 12 years ago

Yes, better compatibility with OSGi would be nice. The classloader inspection logic is ugly, but I couldn't find a better way to provide the classpath elements to the standard compiler.

An alternative version which uses ECJ would be a good addition.

petercgrant commented 12 years ago

Any word on if/when the patch for this will be integrated?

timowest commented 12 years ago

Sorry for the delay, I will try to make it this week.

timowest commented 12 years ago

Released in 0.5.2

timowest commented 12 years ago

Querydsl support is tracked here https://github.com/mysema/querydsl/issues/206