Details
-
Bug
-
Resolution: Fixed
-
Medium
-
4.2
-
4.02
-
Description
DefaultComponentClassManager's newInstance(className) currently instantiates and autowires an instance of the given class name with the follow steps
- Load the class using JIRA's non-OSGi classloader, and if found, autowire via Pico container
- Ask plugin system's PluginsClassLoader to load the given class.
- Then ask PluginsClassLoader which plugin was able to load the class (PluginsClassLoader will return the first plugin that it finds able to load the class)
- Ask the found plugin to instantiate and autowire an instance of the class (Note that the plugin is wrapped within an AbstractDelegatingPlugin, which implements AutowireCapablePlugin, so it will always go to the option to cast it to AutowireCapablePlugin and autowire it).
However, the plugins that can load the class are not necessary the plugin that exports the class and is able to autowire it, such as:
- another plugin that happens to statically import the package of the given class
- any OSGi bundle that has DynamicImport-Package to import a wide range of packages including that of the given class. In our case, the OSGi Compendium bundle, which has the header "DynamicImport-Package: *"