Uploaded image for project: 'Felix'
  1. Felix
  2. FELIX-907

Regression in latest BND code: negated exports are applied to private packages

    Details

      Description

      The latest version of the Bnd Tool has a bug where it combines the Export-Package instructions with the Private-Package instructions:

      all.putAll(replaceWitInstruction(getHeader(EXPORT_PACKAGE),
      EXPORT_PACKAGE));

      all.putAll(replaceWitInstruction(getHeader(PRIVATE_PACKAGE),
      PRIVATE_PACKAGE));

      this ordering means that any negated packages in Export-Package are erroneously applied to the list of packages in Private-Package.

      For example, when you have instructions like the following:

      <Export-Package>!org.foo.internal.,org.foo.</Export-Package>
      <Private-Package>org.foo.internal.*</Private-Package>

      the Bnd Tool will end up excluding the internal packages from the final bundle.

      Reversing the statements to be:

      all.putAll(replaceWitInstruction(getHeader(PRIVATE_PACKAGE),
      PRIVATE_PACKAGE));

      all.putAll(replaceWitInstruction(getHeader(EXPORT_PACKAGE),
      EXPORT_PACKAGE));

      appears to fix the problem, although you could then have problems with negated packages in the Private-Package affecting the Export-Package - but this is less likely.

      1. FELIX-907-20090129.patch
        0.8 kB
        Stuart McCulloch

        Activity

        Hide
        mcculls Stuart McCulloch added a comment -

        Closing as maven-bundle-plugin 2.0.0 has been released.

        Show
        mcculls Stuart McCulloch added a comment - Closing as maven-bundle-plugin 2.0.0 has been released.
        Hide
        pkriens Peter Kriens added a comment -

        I have fixed this in bnd-310. I have not used the given patch because it did not solve the problem in all cases (as you said). I now do them separately and then add the results. The tricky part was not to mess with the split package detecting logic.

        Show
        pkriens Peter Kriens added a comment - I have fixed this in bnd-310. I have not used the given patch because it did not solve the problem in all cases (as you said). I now do them separately and then add the results. The tricky part was not to mess with the split package detecting logic.
        Hide
        mcculls Stuart McCulloch added a comment -

        Proposed patch (this might not fix the problem completely)

        Show
        mcculls Stuart McCulloch added a comment - Proposed patch (this might not fix the problem completely)

          People

          • Assignee:
            pkriens Peter Kriens
            Reporter:
            mcculls Stuart McCulloch
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development