Skip to content

Commit 75f9388

Browse files
committed
compiler warnings
1 parent 490615d commit 75f9388

File tree

5 files changed

+15
-13
lines changed

5 files changed

+15
-13
lines changed

json-java21-jsonpath/src/main/java/json/java21/jsonpath/JsonPathAst.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@
44
import java.util.Objects;
55

66
/// AST representation for JsonPath expressions.
7-
/// Based on the JSONPath specification from https://goessner.net/articles/JsonPath/
7+
/// Based on the JSONPath specification from [...](https://goessner.net/articles/JsonPath/)
88
///
99
/// A JsonPath expression is a sequence of path segments starting from root ($).
1010
/// Each segment can be:
11-
/// - PropertyAccess: access a named property (e.g., .store or ['store'])
12-
/// - ArrayIndex: access array element by index (e.g., [0] or [-1])
13-
/// - ArraySlice: slice array with start:end:step (e.g., [0:2] or [::2])
14-
/// - Wildcard: match all children (e.g., .* or [*])
11+
/// - PropertyAccess: access a named property (e.g., .store or \['store'\])
12+
/// - ArrayIndex: access array element by index (e.g., \[0\] or \[-1\])
13+
/// - ArraySlice: slice array with start:end:step (e.g., \[0:2\] or \[::2\])
14+
/// - Wildcard: match all children (e.g., .* or \[*\])
1515
/// - RecursiveDescent: search all descendants (e.g., ..author)
16-
/// - Filter: filter by predicate (e.g., [?(@.isbn)] or [?(@.price<10)])
17-
/// - Union: multiple indices or names (e.g., [0,1] or ['a','b'])
18-
/// - ScriptExpression: computed index (e.g., [(@.length-1)])
16+
/// - Filter: filter by predicate (e.g., \[?(@.isbn)\] or \[?(@.price<10)\])
17+
/// - Union: multiple indices or names (e.g., \[0,1\] or \['a','b'\])
18+
/// - ScriptExpression: computed index (e.g., \[(@.length-1)\])
1919
sealed interface JsonPathAst {
2020

2121
/// Root element ($) - the starting point of all JsonPath expressions
@@ -80,7 +80,7 @@ record Union(List<Segment> selectors) implements Segment {
8080
}
8181
}
8282

83-
/// Script expression for computed index: [(@.length-1)]
83+
/// Script expression for computed index: \[(@.length-1)\]
8484
record ScriptExpression(String script) implements Segment {
8585
public ScriptExpression {
8686
Objects.requireNonNull(script, "script must not be null");
@@ -116,7 +116,7 @@ record ComparisonFilter(
116116
}
117117
}
118118

119-
/// Logical combination of filters: &&, ||, !
119+
/// Logical combination of filters: "&&", "||", "!"
120120
record LogicalFilter(
121121
FilterExpression left,
122122
LogicalOp op,

json-java21-jsonpath/src/main/java/json/java21/jsonpath/JsonPathParseException.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
package json.java21.jsonpath;
22

3+
import java.io.Serial;
4+
35
/// Exception thrown when a JsonPath expression cannot be parsed.
46
/// This is a runtime exception as JsonPath parsing failures are typically programming errors.
57
public class JsonPathParseException extends RuntimeException {
68

9+
@Serial
710
private static final long serialVersionUID = 1L;
811

912
private final int position;

json-java21-jsonpath/src/main/java/json/java21/jsonpath/JsonPathParser.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package json.java21.jsonpath;
22

33
import java.util.ArrayList;
4-
import java.util.List;
54
import java.util.Objects;
65
import java.util.logging.Logger;
76

json-java21-jsonpath/src/test/java/json/java21/jsonpath/JsonPathAstTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ void testFilter() {
9595
LOG.info(() -> "TEST: testFilter");
9696
final var filter = new JsonPathAst.Filter(
9797
new JsonPathAst.ExistsFilter(
98-
new JsonPathAst.PropertyPath(List.of("isbn"))
98+
new JsonPathAst.PropertyPath(List.of("ISBN"))
9999
)
100100
);
101101
assertThat(filter.expression()).isInstanceOf(JsonPathAst.ExistsFilter.class);

json-java21-jsonpath/src/test/java/json/java21/jsonpath/JsonPathFilterEvaluationTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ void testComplexNestedLogic() {
157157
}
158158

159159
// Helper to extract integer field for assertions
160-
private int asInt(JsonValue v, String key) {
160+
private int asInt(JsonValue v, @SuppressWarnings("SameParameterValue") String key) {
161161
if (v instanceof jdk.sandbox.java.util.json.JsonObject obj) {
162162
return (int) obj.members().get(key).toLong();
163163
}

0 commit comments

Comments
 (0)