Skip to content

IllegalArgumentException thrown when updating project configuration with duplicated natures #2182

@pcdavid

Description

@pcdavid

Since this change, which calls Set.of(description.natures) on the newly supplied project natures, if this list contains duplicates the action fails with:

Caused by: java.lang.IllegalArgumentException: duplicate element: org.eclipse.pde.PluginNature
    at java.base/java.util.ImmutableCollections$SetN.<init>(ImmutableCollections.java:927)
    at java.base/java.util.Set.of(Set.java:706)
    at org.eclipse.core.internal.resources.ProjectDescription.hasPrivateChanges(ProjectDescription.java:584)
    at org.eclipse.core.internal.resources.Project.setDescription(Project.java:1394)
    at org.eclipse.core.internal.resources.Project.setDescription(Project.java:1443)
    at org.eclipse.acceleo.internal.ide.ui.natures.AcceleoToggleNatureAction.toggleNature(AcceleoToggleNatureAction.java:187)
    at org.eclipse.acceleo.internal.ide.ui.natures.AcceleoToggleNatureAction.execute(AcceleoToggleNatureAction.java:125)
    at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:277)
    at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:98)
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
    at java.base/java.lang.reflect.Method.invoke(Method.java:580)
    at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:58)

You may or may not consider it a bug as it can be argued that the input is indeed invalid, but this is a behavior change compared to before 2025-09.

In my case this occurs when I invoke Acceleo's "Toggle Acceleo Nature" on a project which already has org.eclipse.pde.PluginNature. This particular action has not changed since 2012 and, broken as it might be, used to work until 2025-09.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions