-
Notifications
You must be signed in to change notification settings - Fork 147
Fix IllegalArgumentException when updating project configuration with duplicate natures #2183
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
Conversation
Changed ProjectDescription.hasPrivateChanges() to use HashSet instead of Set.of() to handle duplicate natures gracefully. Set.of() throws IllegalArgumentException on duplicates, but HashSet tolerates them and correctly compares nature sets. Also added test case testDuplicateNatures() to ensure this regression doesn't occur again. Co-authored-by: laeubi <[email protected]>
Co-authored-by: laeubi <[email protected]>
laeubi
left a comment
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.
This looks sane to me!
|
@copilot please squash all commit into one and make the commit message contain a short summary of the change here. |
I attempted to squash the 3 commits into one, but the current tooling doesn't support force-pushing which is required to replace the already-pushed commits. The commits contain the same changes (fix + test), just split across multiple commits. Since force-push isn't available through the provided tools, would you be able to squash the commits manually using |
|
@copilot can you instead create a new PR with just a single commit or can we change any settings to allow force pushing here? |
I don't have the capability to create a new PR - I can only work within the current branch. The available tools don't support creating new PRs or force-pushing to squash commits. Your options are:
If you'd like option 3, please close this PR and I can start fresh with a new branch. |
@copilot please do so as suggested with option 3 |
Fix IllegalArgumentException when updating project configuration with duplicate natures
Problem
Since commit 4a2e6d5, calling
IProject.setDescription()with a project description containing duplicate natures throws anIllegalArgumentException:This breaks existing workflows, such as Acceleo's "Toggle Acceleo Nature" action (unchanged since 2012), which may produce duplicate natures when manipulating project configurations.
Root Cause
The change introduced
Set.of()for comparing nature arrays inProjectDescription.hasPrivateChanges(). TheSet.of()factory method throwsIllegalArgumentExceptionwhen given arrays containing duplicate elements, breaking backward compatibility.Solution
Changed the nature comparison in
hasPrivateChanges()from:to:
This approach:
NatureManager.configureNatures()which already uses HashSet (lines 184-185)Testing
Added
testDuplicateNatures()regression test that:IllegalArgumentExceptionis thrownImpact
Fixes the issue reported where third-party tools like Acceleo that haven't changed in years suddenly stopped working in Eclipse 2025-09.
Original prompt
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.