Fix performance issue and infinite loop in classpath computation#2204
Fix performance issue and infinite loop in classpath computation#2204vogella wants to merge 2 commits intoeclipse-pde:masterfrom
Conversation
|
Please add meaningful title and descriptions see https://github.com/eclipse-platform/.github/blob/main/CONTRIBUTING.md#using-draft-pull-requests before opening draft PRs. |
Test Results 147 files ±0 147 suites ±0 36m 6s ⏱️ +42s For more details on these failures, see this check. Results for commit 23f8aac. ± Comparison against base commit 0bfeb26. ♻️ This comment has been updated with latest results. |
d023d5c to
6bc9ca3
Compare
6bc9ca3 to
6bf6825
Compare
6790616 to
f170c65
Compare
| } | ||
|
|
||
| Map<BundleDescription, List<Rule>> map = retrieveVisiblePackagesFromState(desc); | ||
| Map<BundleDescription, Set<Rule>> map = retrieveVisiblePackagesFromState(desc); |
There was a problem hiding this comment.
As order is important we should use a SequencedSet as generic here to make it clear also at all other places...
There was a problem hiding this comment.
The actual classes used in the details is LinkedHashSet. Other places use Set.of() will be problematic.
There was a problem hiding this comment.
Set.of() remains anywhere in the relevant context, every map value is now a new LinkedHashSet<>(). The current state is consistent and the compiler agrees with it (clean build verified earlier).
f170c65 to
834c24b
Compare
| if (junitBundle.getVersion().compareTo(JUNIT_5_9) < 0) { | ||
| // JUnit 5.8 and below bundles don't have specific version requirements that we can use | ||
| junitRequirements = collectRequirements( | ||
| JUNIT5_RUNTIME_PLUGINS.stream().map(id -> PluginRegistry.findModel(id, BELOW_JUNIT_5_9))); |
There was a problem hiding this comment.
JUNIT5_RUNTIME_PLUGINS is unstable set, stream of it is unstable too, and at line 618 we iterate over for (BundleDescription desc : junitRequirements)
There was a problem hiding this comment.
Not a bug introduced here, but should be fixed
|
By the way I'm not sure if order in general matters for these rules, and maybe JDT even do not care at all in wich case we can simply use a |
bdbd6fa to
21a81c3
Compare
c4112eb to
1cac8bc
Compare
|
I do not see a new warning in https://ci.eclipse.org/pde/job/eclipse.pde/job/master/146/eclipse/ |
|
I guess is this one: the method newRequiredBundle(String, VersionRange, boolean, boolean) from the type IBundleProjectService has been deprecated since |
vogella
left a comment
There was a problem hiding this comment.
The Compiler check is failing because of 1 new deprecation warning in ChainedReexportPerformanceTest.java at line 166:
The method newRequiredBundle(String, VersionRange, boolean, boolean) from the type IBundleProjectService has been deprecated since version 3.19 (removal in 2026-09 or later) and marked for removal
The issue is that passing null as the second argument makes the compiler resolve to the deprecated overload (which takes org.eclipse.osgi.service.resolver.VersionRange) instead of the non-deprecated one (which takes org.osgi.framework.VersionRange).
Fix: cast null to org.osgi.framework.VersionRange:
IRequiredBundleDescription mainReq = service.newRequiredBundle(CHAIN_PREFIX + (BUNDLE_CHAIN_DEPTH - 1), (VersionRange) null, false, true);and add this import:
import org.osgi.framework.VersionRange;bacb601 to
34acbe1
Compare
Optimize access rule accumulation in RequiredPluginsClasspathContainer by using Set<Rule> instead of List<Rule> to avoid O(N) containment checks during insertion, which was causing O(N^2) complexity for plug-ins with many re-exported packages. Add a recursion guard in findExportedPackages to prevent infinite loops when processing cyclic re-exports in implicit or secondary dependencies. Add two tests: - RequiredPluginsClasspathContainerPerformanceTest: verifies that classpath computation finishes quickly even when secondary dependencies form a cyclic re-export graph. - ChainedReexportPerformanceTest: verifies performance in a chained re-export scenario to ensure no O(N^2) scaling. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Cast null to VersionRange (org.osgi.framework) to resolve to the non-deprecated overload of IBundleProjectService.newRequiredBundle(). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
34acbe1 to
23f8aac
Compare
Optimize access rule accumulation by using Set instead of List to avoid O(N) containment checks during insertion, which was causing O(N^2) complexity for plug-ins with many re-exported packages.
Additionally, add a recursion guard in findExportedPackages to prevent infinite loops when processing cyclic re-exports in implicit or secondary dependencies.