tbitonti / jakartaee-prototype

Other
0 stars 9 forks source link

Output rules for Export/Import package #120

Open tjwatson opened 4 years ago

tjwatson commented 4 years ago

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 commented 4 years ago

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)".