Fix sun.nio.ch import#598
Conversation
|
Sorry about that! I should have been more careful... Thanks for the pull request. Fixed and released in 4.8.133. I don't have any OSGi tests right now, so I wasn't able to catch this issue. How hard would it be to add an OSGi testcase? I don't know anything about OSGi. |
|
@lukehutch not sure about tests, but I was able to see this problem in real OSGi environment after the deployment. For my own bundles I use maven-bundle-plugin where you can specify an instruction like and the manifest file will be generated automatically based on the used libs on classpath. Optional deps are automatically imported as optional ones. Not sure whether the plugin you're using can do this automatically, but my suggestion is to just automate the manifest generation) |
|
Thanks for the tip, that's good to know. This wouldn't work here though, because the optional packages are all referred to in the ClassGraph code by name (using a string constant), using reflection at runtime. (That's the only way I could find to make these dependencies truly optional, without link errors etc.) I have had a couple of users inform me that some of the optional packages are not available in their OSGi runtime. I'm a big fan of automating everything that can be automated, but in this case, automation is also made more difficult because the name of the module containing an optional package needs to be listed in |
|
@lukehutch out of curiosity I tried replacing jar plugin to build the manifest file and got the following manifest Pay attention that in the process I found a few missing optional imports used in forName function(its usage is detected by the plugin automatically). '*' includes it as a required dep if not marked otherwise. May be this will help somehow ) |
Was broken in #597 @lukehutch