gnodet-bot commented on code in PR #13997:
URL: https://github.com/apache/maven/pull/13997#discussion_r4573177067
##########
maven-artifact/src/main/java/org/apache/maven/artifact/versioning/VersionRange.java:
##########
@@ -46,13 +46,18 @@ public class VersionRange {
private VersionRange(ArtifactVersion recommendedVersion, List<Restriction>
restrictions) {
this.recommendedVersion = recommendedVersion;
- this.restrictions = restrictions;
+ this.restrictions = Collections.unmodifiableList(restrictions);
}
public ArtifactVersion getRecommendedVersion() {
return recommendedVersion;
}
+ /**
+ * Returns the restrictions defining this version range.
+ *
+ * @return the unmodifiable list of restrictions
Review Comment:
💡 **Minor:** The Javadoc correctly documents that the list is unmodifiable,
but it could also note that this is a defensive contract (the backing field is
always immutable since construction). Optional phrasing:
```suggestion
* @return an unmodifiable list of restrictions; never {@code null}
```
--
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]