Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Changes log
- Reuse an instance of Random class in RandomUtils. Issue #1487.
- Complete test classes. Issue #1490.
- Avoid non-short-circuit logic in FileClientHelper. Issue #1495.
- Drop the implementations of the clone method. Issue #1498.

- 2.7 Milestone 2 (29-06-2025)
- Misc
Expand Down
5 changes: 2 additions & 3 deletions org.restlet/src/main/java/org/restlet/data/Reference.java
Original file line number Diff line number Diff line change
Expand Up @@ -638,16 +638,15 @@ public Reference addSegment(String value) {
return this;
}

@Override
public Reference clone() {
public Reference copy() {
final Reference newRef = new Reference();

if (this.baseRef == null) {
newRef.baseRef = null;
} else if (equals(this.baseRef)) {
newRef.baseRef = newRef;
} else {
newRef.baseRef = this.baseRef.clone();
newRef.baseRef = this.baseRef.copy();
}

newRef.fragmentIndex = this.fragmentIndex;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

/** {@inheritDoc} */
@Override
public Object clone() {
public Object clone() throws UnsupportedOperationException {

Check failure on line 38 in org.restlet/src/main/java/org/restlet/engine/util/ImmutableDate.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this "clone" implementation; use a copy constructor or copy factory instead.

See more on https://sonarcloud.io/project/issues?id=restlet_restlet-framework-java&issues=AZzPBb8kCzAhNf-zwObT&open=AZzPBb8kCzAhNf-zwObT&pullRequest=1499

Check warning on line 38 in org.restlet/src/main/java/org/restlet/engine/util/ImmutableDate.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use super.clone() to create and seed the cloned instance to be returned.

See more on https://sonarcloud.io/project/issues?id=restlet_restlet-framework-java&issues=AZzPBb8kCzAhNf-zwObS&open=AZzPBb8kCzAhNf-zwObS&pullRequest=1499
throw new UnsupportedOperationException("ImmutableDate is immutable");
}

Expand Down