In our fragment support we currently attach the fragment's VFS root to OSGiClassLoaderPolicy . The related discussion is Initial support for Fragments
Although this works for most of the use cases we cover, it doe not work for JBOSGI-346
The bundle's local packages are considered after its imports. If an attached fragment imports a package, that package hides the bundle's local package with the same name.
// Bundle-SymbolicName: simple-hostA // Private-Package: org.jboss.test.osgi.fragments.hostA, org.jboss.test.osgi.fragments.subA // Bundle-SymbolicName: simple-hostB // Export-Package: org.jboss.test.osgi.fragments.subA // Private-Package: org.jboss.test.osgi.fragments.hostB // Bundle-SymbolicName: simple-fragB // Import-Package: org.jboss.test.osgi.fragments.subA // Fragment-Host: simple-hostA hostA.loadClass(subA) is expected to come from hostB
What is the proper way to modify a host's policy when a fragment attaches/detaches?
Perhaps we can do this similar to the WildcardDelegateLoader.