elharo opened a new issue, #12592:
URL: https://github.com/apache/maven/issues/12592
# MojoExecutor: Cycle detection broken by object identity in forked
executions
**Found in:** maven-4.0.x branch
**File:**
`impl/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecycleExecutionPlanCalculator.java`
(line 333)
**Severity:** High
## Description
The `alreadyPlannedExecutions` is a `HashSet<MojoDescriptor>`.
`MojoDescriptor` instances loaded via `pluginManager.getMojoDescriptor()` at
line 318 are **new objects** that won't match any existing entries in the set:
```java
if (!alreadyPlannedExecutions.contains(forkedExecution.getMojoDescriptor()))
{
calculateForkedExecutions(forkedExecution, session, project,
alreadyPlannedExecutions);
...
}
```
Since `MojoDescriptor` doesn't override `equals()`/`hashCode()` (or uses
default Object identity), the cycle detection guard **will never skip a forked
mojo**, allowing infinite recursion if a mojo forks a lifecycle that includes
itself. This can cause a `StackOverflowError` during build plan calculation.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]