You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix IllegalArgumentException with duplicate natures
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.
Copy file name to clipboardExpand all lines: resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/ProjectDescription.java
+2-1Lines changed: 2 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -24,6 +24,7 @@
24
24
importjava.util.Collection;
25
25
importjava.util.Collections;
26
26
importjava.util.HashMap;
27
+
importjava.util.HashSet;
27
28
importjava.util.LinkedHashSet;
28
29
importjava.util.LinkedList;
29
30
importjava.util.List;
@@ -581,7 +582,7 @@ public boolean hasPrivateChanges(ProjectDescription description) {
581
582
returntrue;
582
583
}
583
584
// has natures changed?
584
-
if (!Set.of(natures).equals(Set.of(description.natures))) {
585
+
if (!newHashSet<>(Arrays.asList(natures)).equals(newHashSet<>(Arrays.asList(description.natures)))) {
0 commit comments