Skip to content

Commit 16fe055

Browse files
committed
revert clonable change
Signed-off-by: Kavindu Dodanduwa <kavindudodanduwa@gmail.com>
1 parent 47c752d commit 16fe055

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/main/java/dev/openfeature/sdk/ImmutableStructure.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public ImmutableStructure(Map<String, Value> attributes) {
4040
.collect(HashMap::new,
4141
(accumulated, entry) -> accumulated.put(entry.getKey(),
4242
Optional.ofNullable(entry.getValue())
43-
.map(Value::copy)
43+
.map(Value::clone)
4444
.orElse(null)),
4545
HashMap::putAll)));
4646
}
@@ -54,7 +54,7 @@ public Set<String> keySet() {
5454
@Override
5555
public Value getValue(String key) {
5656
Value value = this.attributes.get(key);
57-
return value != null ? value.copy() : null;
57+
return value != null ? value.clone() : null;
5858
}
5959

6060
/**
@@ -70,7 +70,7 @@ public Map<String, Value> asMap() {
7070
.collect(HashMap::new,
7171
(accumulated, entry) -> accumulated.put(entry.getKey(),
7272
Optional.ofNullable(entry.getValue())
73-
.map(Value::copy)
73+
.map(Value::clone)
7474
.orElse(null)),
7575
HashMap::putAll);
7676
}

src/main/java/dev/openfeature/sdk/Value.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
@ToString
2121
@EqualsAndHashCode
2222
@SuppressWarnings({"PMD.BeanMembersShouldSerialize", "checkstyle:MissingJavadocType", "checkstyle:NoFinalizer"})
23-
public class Value {
23+
public class Value implements Cloneable {
2424

2525
private final Object innerObject;
2626

@@ -262,12 +262,13 @@ public Instant asInstant() {
262262
}
263263

264264
/**
265-
* Perform a deep copy of this value.
265+
* Perform deep clone of value object.
266266
*
267267
* @return Value
268268
*/
269269
@SneakyThrows
270-
protected Value copy() {
270+
@Override
271+
protected Value clone() {
271272
if (this.isList()) {
272273
List<Value> copy = this.asList().stream().map(Value::new).collect(Collectors.toList());
273274
return new Value(copy);

0 commit comments

Comments
 (0)