Skip to content

Commit fc0c0ab

Browse files
authored
Issue #1498: Deprecate the implementations of the clone method. (#1500)
1 parent 0e1a03a commit fc0c0ab

3 files changed

Lines changed: 13 additions & 4 deletions

File tree

changes.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ Changes log
55
- Bugs fixed
66
- Reuse an instance of Random class in RandomUtils. Issue #1487.
77
- Complete test classes. Issue #1490.
8-
- Avoid non-short-circuit logic in FileClientHelper. Issue #1495.
9-
-
8+
- Deprecate the implementations of the clone method. Issue #1498.
9+
- Avoid non-short-circuit logic in FileClientHelper. Issue #1495.
10+
1011
- 2.6.0 (29-06-2025)
1112

1213
- 2.6 Release Candidate 2 (21-06-2025)

org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/ImmutableDate.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public ImmutableDate(Date date) {
3838

3939
/** {@inheritDoc} */
4040
@Override
41-
public Object clone() {
41+
public Object clone() throws UnsupportedOperationException {
4242
throw new UnsupportedOperationException("ImmutableDate is immutable");
4343
}
4444

org.restlet.java/org.restlet/src/main/java/org/restlet/data/Reference.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -638,16 +638,24 @@ public Reference addSegment(String value) {
638638
return this;
639639
}
640640

641+
/**
642+
* @deprecated Use the {@code copy} method instead.
643+
*/
641644
@Override
645+
@Deprecated
642646
public Reference clone() {
647+
return copy();
648+
}
649+
650+
public Reference copy() {
643651
final Reference newRef = new Reference();
644652

645653
if (this.baseRef == null) {
646654
newRef.baseRef = null;
647655
} else if (equals(this.baseRef)) {
648656
newRef.baseRef = newRef;
649657
} else {
650-
newRef.baseRef = this.baseRef.clone();
658+
newRef.baseRef = this.baseRef.copy();
651659
}
652660

653661
newRef.fragmentIndex = this.fragmentIndex;

0 commit comments

Comments
 (0)