-
Notifications
You must be signed in to change notification settings - Fork 121
Fix API tools slow down with multiple source folders sharing output #2202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
iloveeclipse
merged 1 commit into
eclipse-pde:master
from
jonahgraham:moaead/fix/issue-2197-api-tools-performance-regression
Jan 21, 2026
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,10 +15,10 @@ | |
|
|
||
| import java.util.ArrayList; | ||
| import java.util.List; | ||
| import java.util.Objects; | ||
| import java.util.Set; | ||
| import java.util.SortedSet; | ||
| import java.util.TreeSet; | ||
| import java.util.concurrent.CopyOnWriteArrayList; | ||
|
|
||
| import org.eclipse.core.resources.IContainer; | ||
| import org.eclipse.core.resources.IFile; | ||
|
|
@@ -50,9 +50,10 @@ public class ProjectTypeContainer extends ApiElement implements IApiTypeContaine | |
| private String[] fPackageNames; | ||
|
|
||
| /** | ||
| * Optional package fragment root for JDT-based package discovery | ||
| * Package fragment roots for JDT-based package discovery. Multiple roots | ||
| * may exist when several source folders share the same output location. | ||
| */ | ||
| private final IPackageFragmentRoot fPackageFragmentRoot; | ||
| private final List<IPackageFragmentRoot> fPackageFragmentRoots = new CopyOnWriteArrayList<>(); | ||
|
|
||
| /** | ||
| * Constructs an {@link IApiTypeContainer} rooted at the location with an | ||
|
|
@@ -67,7 +68,24 @@ public class ProjectTypeContainer extends ApiElement implements IApiTypeContaine | |
| public ProjectTypeContainer(IApiElement parent, IContainer container, IPackageFragmentRoot packageFragmentRoot) { | ||
| super(parent, IApiElement.API_TYPE_CONTAINER, container.getName()); | ||
| this.fRoot = container; | ||
| this.fPackageFragmentRoot = Objects.requireNonNull(packageFragmentRoot); | ||
| if (packageFragmentRoot != null) { | ||
| this.fPackageFragmentRoots.add(packageFragmentRoot); | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Adds an additional package fragment root to this container. This is used | ||
| * when multiple source folders share the same output location. | ||
| * | ||
| * @param root the package fragment root to add | ||
| * @since 1.3.400 | ||
| */ | ||
| public void addPackageFragmentRoot(IPackageFragmentRoot root) { | ||
| if (root != null && !fPackageFragmentRoots.contains(root)) { | ||
| fPackageFragmentRoots.add(root); | ||
| // Clear cached package names so they will be recomputed | ||
| fPackageNames = null; | ||
|
||
| } | ||
| } | ||
|
|
||
| @Override | ||
|
|
@@ -159,8 +177,10 @@ public IApiTypeRoot findTypeRoot(String qualifiedName) throws CoreException { | |
| public String[] getPackageNames() throws CoreException { | ||
| if (fPackageNames == null) { | ||
| SortedSet<String> names = new TreeSet<>(); | ||
| if (fPackageFragmentRoot.exists()) { | ||
| collectPackageNames(names, fPackageFragmentRoot); | ||
| for (IPackageFragmentRoot root : fPackageFragmentRoots) { | ||
| if (root.exists()) { | ||
| collectPackageNames(names, root); | ||
| } | ||
| } | ||
| fPackageNames = names.toArray(String[]::new); | ||
| } | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nullshould not be allowedThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have fixed this in #2203 - but FWIW @laeubi added the javadoc saying "may be
null" so it looks like @moaead simply implemented the code as it was javadoc. The PR removes the may be null from the javadoc too.@laeubi if you can review to make sure your original intentions are still intact that will be appreciated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code has undergone some refactoring so the javadoc was just wrong.