Skip to content

Commit 643be29

Browse files
committed
[refactor] Address further code-review from @reinhapa
1 parent 892f7bb commit 643be29

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

exist-core/src/main/java/org/exist/xquery/BindingExpression.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ public void analyze(final AnalyzeContextInfo contextInfo) throws XPathException
8383

8484
@Override
8585
public Sequence postEval(Sequence seq) throws XPathException {
86-
if (returnExpr instanceof FLWORClause) {
87-
seq = ((FLWORClause)returnExpr).postEval(seq);
86+
if (returnExpr instanceof FLWORClause flworClause) {
87+
seq = flworClause.postEval(seq);
8888
}
8989
return super.postEval(seq);
9090
}

exist-core/src/main/java/org/exist/xquery/CountClause.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ private boolean hasPreviousOrderByDescending() {
111111
case ORDERBY -> {
112112
return isDescending(((OrderByClause) prev).getOrderSpecs());
113113
}
114+
default -> prev = prev.getPreviousClause();
114115
}
115-
prev = prev.getPreviousClause();
116116
}
117117
return true;
118118
}
@@ -183,8 +183,8 @@ public Sequence eval(final Sequence contextSequence, final Item contextItem) thr
183183

184184
@Override
185185
public Sequence postEval(Sequence seq) throws XPathException {
186-
if (returnExpr instanceof FLWORClause) {
187-
seq = ((FLWORClause)returnExpr).postEval(seq);
186+
if (returnExpr instanceof FLWORClause flworClause) {
187+
seq = flworClause.postEval(seq);
188188
}
189189
return super.postEval(seq);
190190
}

exist-core/src/main/java/org/exist/xquery/GroupByClause.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,8 @@ public Sequence postEval(final Sequence seq) throws XPathException {
172172
context.popLocalVariables(mark, result);
173173
}
174174

175-
if (returnExpr instanceof FLWORClause) {
176-
result = ((FLWORClause) returnExpr).postEval(result);
175+
if (returnExpr instanceof FLWORClause flworClause) {
176+
result = flworClause.postEval(result);
177177
}
178178
result = super.postEval(result);
179179
return result;

exist-core/src/main/java/org/exist/xquery/OrderByClause.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ public Sequence postEval(Sequence seq) throws XPathException {
9595
orderedResult.sort();
9696
Sequence result = orderedResult;
9797

98-
if (getReturnExpression() instanceof FLWORClause) {
99-
result = ((FLWORClause) getReturnExpression()).postEval(result);
98+
if (getReturnExpression() instanceof FLWORClause flworClause) {
99+
result = flworClause.postEval(result);
100100
}
101101
return super.postEval(result);
102102
}

exist-core/src/main/java/org/exist/xquery/WhereClause.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ public Sequence eval(Sequence contextSequence, Item contextItem) throws XPathExc
133133
@Override
134134
public Sequence postEval(Sequence seq) throws XPathException {
135135
fastTrack = false;
136-
if (returnExpr instanceof FLWORClause) {
137-
seq = ((FLWORClause) returnExpr).postEval(seq);
136+
if (returnExpr instanceof FLWORClause flworClause) {
137+
seq = flworClause.postEval(seq);
138138
}
139139
return super.postEval(seq);
140140
}

0 commit comments

Comments
 (0)