Skip to content

Commit 0d47046

Browse files
committed
refactor(internal): Use record pattern in RequestContext.equals
Replaces the named pattern variable with full record-pattern destructuring per Sonar's java21 hint, so the components are pulled out by name instead of dereferenced via other.body etc.
1 parent 9f1845d commit 0d47046

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

src/main/java/com/retailsvc/http/internal/RequestContext.java

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,17 @@ public boolean equals(Object o) {
2121
if (this == o) {
2222
return true;
2323
}
24-
if (!(o instanceof RequestContext other)) {
25-
return false;
26-
}
27-
return Arrays.equals(body, other.body)
28-
&& Objects.equals(parsedBody, other.parsedBody)
29-
&& Objects.equals(operationId, other.operationId)
30-
&& Objects.equals(pathParameters, other.pathParameters);
24+
return o
25+
instanceof
26+
RequestContext(
27+
byte[] otherBody,
28+
Object otherParsedBody,
29+
String otherOperationId,
30+
Map<String, String> otherPathParameters)
31+
&& Arrays.equals(body, otherBody)
32+
&& Objects.equals(parsedBody, otherParsedBody)
33+
&& Objects.equals(operationId, otherOperationId)
34+
&& Objects.equals(pathParameters, otherPathParameters);
3135
}
3236

3337
@Override

0 commit comments

Comments
 (0)