transformer icon indicating copy to clipboard operation
transformer copied to clipboard

Output rules for Export/Import package

Open bjhargrave opened this issue 4 years ago • 1 comments

From @tjwatson

With OSGi there is a concern about package versions when an exported package uses one of the renamed packages. For example, consider the following export from a Bundle X:

Export-Package: some.api; uses:="javax.servlet"; version="1.0"

Here javax.servlet is renamed to jakarata.servlet and the package some.api has types from javax.servlet in its API signature.

When transforming bundle X the transformer must transform the Export-Package for some.api to:

Export-Package: some.api; uses:="jakarta.servlet"; version="2.0"

Here the uses directive needed to be updated, but also the major version of the package should be updated because some.api had a breaking change with the rename of javax.servlet->jakarta.servlet.

We need to ensure this version transformation occurs when the transformer detects that a used packages (as specified by the uses:= directive). In addition we also need a way to output a future rule that this package some.api had a major version change due to a transformation. This information then can be used when transforming a later bundle that imports the some.api package:

Import-Package: some.api; version="[1.0, 2.0)"

If a bundle being transformed has the above import the transformed import should use a range that included the major version bump included with the transformed export:

Import-Package: some.api; version="[2.0, 3.0)"

The assumption is that the importing bundles will be transformed after the exporting bundles and the output of the transformer on the exporter can be used to feed the new rule for range transformation to the later transformation of the importing bundles.

bjhargrave avatar Jun 02 '20 20:06 bjhargrave

We also need to pay attention to the range of the import. If the range is narrow (provider type) "[1.3,1.4)" then the replacement import range must also be narrow "[2.0,2.1)".

bjhargrave avatar Jun 02 '20 20:06 bjhargrave

This issue has been automatically marked as stale because it has not had recent activity. Given the limited bandwidth of the team, it will be automatically closed if no further activity occurs. If you feel this is something you could contribute, please have a look at our Contributor Guide. Thank you for your contribution.

github-actions[bot] avatar Sep 15 '22 04:09 github-actions[bot]

This issue has been automatically closed due to inactivity. If you can reproduce this or if you have a good use case for this feature, please feel free to reopen the issue with steps to reproduce, a quick explanation of your use case or a high-quality pull request.

github-actions[bot] avatar Oct 07 '22 03:10 github-actions[bot]