In order to properly support OSGi, we need to use a combination of ideas.
- Packages and modules should be as coherent as possible. This makes bundling them into bundles and services significantly easier. Plus, it's a good idea anyway.
- Use Felix SCR annotations in order to support more advanced OSGi concepts without requiring an explicit dependency on OSGi. This way, the annotations can be discarded or ignored by non-OSGi environments.
- Provide more bundles. The core bundles, while a good start, could be further modularized.
- Don't rely on class loader hacks. Instead, methods that need to use a class loader should always include a ClassLoader parameter. Class loader hacks can be used in centralized locations as a fallback mechanism where no advanced class loaders are provided.