Skip to content

Reduce API surface in bundledescription package#164

Draft
Copilot wants to merge 4 commits intomasterfrom
copilot/check-unnecessary-code-bd-builder
Draft

Reduce API surface in bundledescription package#164
Copilot wants to merge 4 commits intomasterfrom
copilot/check-unnecessary-code-bd-builder

Conversation

Copy link

Copilot AI commented Oct 26, 2025

BundleDescriptionBuilder was migrated from a larger codebase with methods and constants left unnecessarily exposed. Only createBundleDescription() is called externally by BundlesAction.

Changes

Visibility reductions

  • Made 2 public methods private: addImportPackages, checkImportExportSyntax
  • Made 11 package-level helper methods private: createRequiredBundle, createExportPackages, addExportPackages, getDirectives, getAttributes, createHostSpecification, convertBREEs, getOSGiEENameVersion, createOSGiRequires, createOSGiCapabilities (2 overloads)
  • Made 4 package-level constants private: DEFINED_BSN_DIRECTIVES, DEFINED_BSN_MATCHING_ATTRS, GENERIC_REQUIRE, GENERIC_CAPABILITY

Bug fix

  • Corrected StateMsg bundle name reference from org.eclipse.osgi.internal.resolver.StateMessages to org.eclipse.equinox.internal.p2.publisher.eclipse.bundledescription.StateMessages

The package remains internal (not exported). Constants used by other classes in the package (NAME, FRIENDS_DIRECTIVE, INTERNAL_DIRECTIVE, etc.) remain package-visible.

Original prompt

Check for uneccesary code in org/eclipse/equinox/internal/p2/publisher/eclipse/bundledescription

the BundleDescriptionBuilder was added with commit d84b569 an migrated from a much larger codebase, we already tried to strip it down but there is maybe more to do.

So it should be analyzed if we can further strip down the code as it is only used internally in BundlesAction


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits October 26, 2025 05:43
- Changed addImportPackages from public to private (only used internally)
- Changed checkImportExportSyntax from public to private (only used internally)
- Fixed StateMsg to reference correct bundle name path for StateMessages.properties

Co-authored-by: laeubi <1331477+laeubi@users.noreply.github.com>
Changed multiple package-level static helper methods to private since they are only used within BundleDescriptionBuilder:
- createRequiredBundle
- createExportPackages
- addExportPackages
- getDirectives
- getAttributes
- createHostSpecification
- convertBREEs
- getOSGiEENameVersion
- createOSGiRequires
- createOSGiCapabilities (both overloads)

Co-authored-by: laeubi <1331477+laeubi@users.noreply.github.com>
Changed package-level constants to private since they are only used within BundleDescriptionBuilder:
- DEFINED_BSN_DIRECTIVES
- DEFINED_BSN_MATCHING_ATTRS
- GENERIC_REQUIRE
- GENERIC_CAPABILITY

Co-authored-by: laeubi <1331477+laeubi@users.noreply.github.com>
Copilot AI changed the title [WIP] Analyze and remove unnecessary code in BundleDescriptionBuilder Reduce API surface in bundledescription package Oct 26, 2025
Copilot AI requested a review from laeubi October 26, 2025 05:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants