Skip to content

Commit bc59f62

Browse files
committed
Fix PMD warnings of using == and !=
`ANY_VALUE` should use reference equality, but it also doesn't override .equals so this doesn't really make a difference, but is less surprising to readers. The comparison in the logging was unnecessary, the toString for `ANY_VALUE` is `*any*` which works just as well.
1 parent 50a9fed commit bc59f62

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/provider/foundationdb/keyspace/DirectoryLayerDirectory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ protected boolean isValueValid(@Nullable Object value) {
156156
// despite comments saying that the resolved value should be allowed.
157157
if (value instanceof String) {
158158
// If this directory has a constant value, check that the provided value matches it
159-
return getValue() == KeySpaceDirectory.ANY_VALUE || Objects.equals(getValue(), value);
159+
return Objects.equals(getValue(), KeySpaceDirectory.ANY_VALUE) || Objects.equals(getValue(), value);
160160
}
161161
return false;
162162
}

fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/provider/foundationdb/keyspace/KeySpaceDirectory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ protected void validateValue(@Nullable Object value) {
189189
LogMessageKeys.EXPECTED_TYPE, getKeyType(),
190190
LogMessageKeys.ACTUAL, value,
191191
"actual_type", value == null ? "null" : value.getClass().getName(),
192-
"expected_value", getValue() != KeySpaceDirectory.ANY_VALUE ? getValue() : "any");
192+
"expected_value", getValue());
193193
}
194194
}
195195

0 commit comments

Comments
 (0)