-
Notifications
You must be signed in to change notification settings - Fork 211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use Java's ServiceLoader instead of org.codehaus.commons.compiler.properties #209
Comments
The workaround is to call It would |
Hey Vladimir, I replaced "org.codehaus.commons.compiler.properties" with Java's However, for exactly that reason I'm afraid that the change won't fix your issue - please test! |
Ping |
It looks like For now, I rely on |
In any case, it is probably worth adding the following bnd instructions so janino.jar does expose services via OSGi mediators (if mediator is available at all) <Provide-Capability>osgi.serviceloader;osgi.serviceloader="org.codehaus.commons.compiler.ICompilerFactory"</Provide-Capability>
<Require-Capability>osgi.extender;filter:="(&(osgi.extender=osgi.serviceloader.registrar)(version>=1.0)(!(version>=2.0)))"</Require-Capability> |
Hey Vladimir, |
--- a/janino/pom.xml
+++ b/janino/pom.xml
@@ -65,6 +65,8 @@
<instructions>
<Export-Package>org.codehaus.janino, org.codehaus.janino.samples, org.codehaus.janino.tools, org.codehaus.janino.util, org.codehaus.janino.util.resource</Export-Package>
<Require-Bundle>org.codehaus.janino.commons-compiler</Require-Bundle>
+ <Provide-Capability>osgi.serviceloader;osgi.serviceloader="org.codehaus.commons.compiler.ICompilerFactory"</Provide-Capability>
+ <Require-Capability>osgi.extender;filter:="(&(osgi.extender=osgi.serviceloader.registrar)(version>=1.0)(!(version>=2.0)))"</Require-Capability>
</instructions>
</configuration>
</plugin> It adds the relevant headers to the manifest, however, I can't test it. |
Ok, I just merged your untested patch, hoping that it doesn't break anybody's code. Is there really no way you can test it? |
I think pax-exam can help with testing. I test pgjdbc as follows: https://github.com/pgjdbc/pgjdbc/tree/master/pgjdbc-osgi-test/src/test |
I'm trying to run janino in OSGi environment (Eclipse plugin), and I am facing <<No implementation of org.codehaus.commons.compiler could be loaded. Typically, you'd have "janino.jar", or "commons-compiler-jdk.jar", or both on the classpath, and use the "ClassLoader.getSystemClassLoader" to load them>>
Here's the code that calls
getDefaultCompilerFactory
: https://github.com/apache/calcite/blob/816edd1fa1a1d6af7e72416d791eb01d8c66b6ea/core/src/main/java/org/apache/calcite/rel/metadata/JaninoRelMetadataProvider.java#L151-L154Frankly speaking I have no idea why janino uses its own
properties
resource file to select the implementation, however, it looks like Java'sServiceLoader
would do exactly that in a more standard way.ServiceLoader
is supported for Java's Modules, and it is supported by OSGi, so I guess it should be less hassle for everybody if janino usedServiceLoader
.WDYT?
Here's the reproducer: vlsi/mat-calcite-plugin#31
The text was updated successfully, but these errors were encountered: