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

   Backport of #13995, requested in 
https://github.com/apache/maven/pull/13995#pullrequestreview-5903194708.
   
   VersionRange caches shared instances but exposes their mutable restriction 
lists. Clearing a returned list can change later version-range checks for every 
caller using that cached specification.
   
   Make the private constructor responsible for the unmodifiable view, document 
getRestrictions(), and remove the redundant wrapping in restrict(). Attempts to 
mutate these lists now throw UnsupportedOperationException. Cache reuse and 
version-selection behavior are otherwise preserved.
   
   The tests cover four cached specification forms, cloned ranges, 
intersections, and literal versions. They use Java 8-compatible APIs and the 
module's existing JUnit dependency. The cache and clone regressions fail before 
the fix.
   
   Validation on JDK 17 with Maven 3.10.0:
   
       mvn -B -ntp -pl :maven-artifact -am verify
   
   Passed: 38 unit tests and one module integration test, with no failures, 
errors, or skips. Both selected reactor modules, Checkstyle, Spotless, and RAT 
passed. The full Maven reactor and core integration-test suite were not run.
   
   A Jira reference is pending; I do not yet have an Apache Jira account.
   
   ---
   
   - [x] I hereby declare this contribution to be licensed under the [Apache 
License Version 2.0, January 2004](https://www.apache.org/licenses/LICENSE-2.0)
   - [ ] I hereby declare that I have filed an [Apache Individual Contributor 
License Agreement](https://www.apache.org/licenses/icla.pdf).


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