Repository navigation
Conversation
Describe an additive framework hook that lets extensions contribute classes and resources after the bundle Search Order found nothing, as needed by Java SPI mediation (osgi/osgi#970). Signed-off-by: Christoph Läubrich <laeubi@laeubi-soft.de>
Define DelegationHook with findClass, findResource and findResources, consulted after the Search Order, with a refresh dependency instead of a wire. Signed-off-by: Christoph Läubrich <laeubi@laeubi-soft.de>
Add org.osgi.framework.hooks.delegation 1.0 with DelegationHook, a new specification chapter, and the additional last step in the Overall Search Order. Signed-off-by: Christoph Läubrich <laeubi@laeubi-soft.de>
This was referenced Nov 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add a Delegation Hook to the Core Framework
Adds
org.osgi.framework.hooks.delegation1.0 withDelegationHook.The framework consults it as a last step of the Overall Search Order, after nothing was found.
Hooks can only add classes and resources, never replace or hide what the wiring provides.
Motivation is osgi/osgi#970: extensions such as Java SPI mediation (osgi/osgi#372) need to contribute classes and resources across bundles without weaving or framework internals.
Commits
.design/requirements-970.md.design/design-970.mdDelegationHook), new specification chapter, and the search order paragraph in the module layer chapterKey points
findClassandfindResourceare used only if the search order found nothing;findResourcesresults are always appended.java.*or for packages the bundle imports, requires or exports.FrameworkEvent.ERROR.ServicePermission[DelegationHook, REGISTER]; extension bundles can register it from theirExtensionBundle-Activator.Open points
Implementation
Prototypes in both major open source frameworks show the feasibility:
It shows that the hook fits into
BundleLoaderand the dependency closure with small changes.It has not been exercised by tests yet.
It consults the hook at the end of the search order in
BundleWiringImpland tracks the provider as a plain, non-wire refresh dependency.It has a few focused tests for classes, resources, the dependency closure and failing hooks.