gnodet opened a new pull request, #12867:
URL: https://github.com/apache/maven/pull/12867

   ## Summary
   
   - Switched `alreadyPlannedExecutions` from `Set<MojoDescriptor>` / 
`Collection<MojoDescriptor>` to `Set<String>` using `MojoDescriptor.getId()` 
(`groupId:artifactId:version:goal`) in all forked execution cycle detection 
paths
   - Updated the `LifecycleExecutionPlanCalculator` interface and its 
implementations/stubs accordingly
   - Added a test verifying that string-based cycle detection correctly 
identifies cloned `MojoDescriptor` instances (as produced by the plugin 
descriptor cache)
   
   ## Motivation
   
   `DefaultPluginDescriptorCache` clones `PluginDescriptor` (and all its 
`MojoDescriptor` objects) on every cache retrieval. This means 
independently-loaded descriptors for the same plugin are always different 
object instances. While `MojoDescriptor` does override `equals()`/`hashCode()`, 
relying on mutable object equality inside a `HashSet` is fragile — if any 
identity field (`groupId`, `artifactId`, `version`, `goal`) is modified after 
insertion, the set lookup silently fails, allowing infinite recursion in forked 
lifecycle calculation.
   
   String keys are immutable and make the comparison semantics explicit, 
eliminating any risk of identity mismatch across cloned descriptor instances.
   
   ## Test plan
   
   - [x] New unit test 
`MojoDescriptorTest.idBasedCycleDetectionWithClonedDescriptors` verifies that 
two independently-created `MojoDescriptor` instances with the same plugin 
coordinates and goal produce the same `getId()` key and are correctly detected 
as duplicates in a `HashSet<String>`
   - [x] All 612 existing maven-core tests pass
   - [x] Full reactor build (`mvn verify -DskipTests`) succeeds
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
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]

Reply via email to