Add generic BREE support for modern Java versions and reject invalid BREEs#163
Add generic BREE support for modern Java versions and reject invalid BREEs#163
Conversation
Co-authored-by: laeubi <1331477+laeubi@users.noreply.github.com>
Co-authored-by: laeubi <1331477+laeubi@users.noreply.github.com>
Co-authored-by: laeubi <1331477+laeubi@users.noreply.github.com>
Co-authored-by: laeubi <1331477+laeubi@users.noreply.github.com>
|
@copilot please investigate what can be the reason that we get UNKOWN as an EE as indicated in eclipse-tycho/tycho#5446 where we see the error
|
Co-authored-by: laeubi <1331477+laeubi@users.noreply.github.com>
I've investigated the issue and found the root cause of the Problem: The BREE parsing code in Solution: Added validation in
This prevents bundles with invalid BREEs from being published with Testing: Added |
The BREE parsing in
BundleDescriptionBuilderalready handles modern Java versions generically via OSGiVersion.parseVersion(), which accepts both dotted versions (1.8) and simple integers (25). This PR adds documentation, validation, and tests to clarify this behavior, ensure forward compatibility, and prevent invalid BREE values.Changes
Documentation (
BundleDescriptionBuilder.java)getOSGiEENameVersionexplaining support for legacy (J2SE-1.4), dotted (JavaSE-1.8), and modern (JavaSE-11, 17, 21, 25+) BREE formatscreateOSGiEERequirementFiltershowing OSGi filter generation for modern versionsValidation (
BundleDescriptionBuilder.java)createOSGiEERequirementFilterto reject invalid BREEs like "UNKNOWN" or "UNSPECIFIED"osgi.ee=UNKNOWNrequirements as reported in Tycho fails to resolve JavaSE-25 eclipse-tycho/tycho#5446Test Coverage (
BundlesActionTest.java)testJavaSE25BREE()andtestJavaSE21BREE()for modern versionstestVariousJavaSEBREEFormats()covering JavaSE-11/17/21/25/1.8 and J2SE-1.4testFutureJavaVersionBREEs()verifying JavaSE-30/50/100 forward compatibilitytestInvalidBREEsRejected()to verify invalid BREEs like "UNKNOWN" are properly rejectedExamples
Valid BREE: A bundle with
Bundle-RequiredExecutionEnvironment: JavaSE-25generates the OSGi filter:Invalid BREE: A bundle with an invalid BREE like
UNKNOWNwill now throw a clear error:This prevents the creation of invalid requirements like
osgi.ee=UNKNOWNand ensures bundles fail fast with clear error messages during publishing rather than causing cryptic resolution failures later.Original prompt
💡 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.