6
6
* | __/\ V /| | || (_| | |_| | |_) |
7
7
* \___| \_/ |_|\__\__,_|____/|____/
8
8
*
9
- * Copyright (c) 2023-2024
9
+ * Copyright (c) 2023-2025
10
10
*
11
11
* Licensed under the Business Source License, Version 1.1 (the "License");
12
12
* you may not use this file except in compliance with the License.
@@ -197,12 +197,13 @@ public Query normalizeQuery() {
197
197
* @deprecated use {@link #normalizeQuery(UnaryOperator, UnaryOperator, UnaryOperator, UnaryOperator)}, this method
198
198
* is here only to maintain backward compatibility
199
199
*/
200
+ @ SuppressWarnings ("rawtypes" )
200
201
@ Deprecated
201
202
@ Nonnull
202
203
public Query normalizeQuery (
203
- @ Nullable UnaryOperator <FilterConstraint > filterConstraintTranslator ,
204
- @ Nullable UnaryOperator <OrderConstraint > orderConstraintTranslator ,
205
- @ Nullable UnaryOperator <RequireConstraint > requireConstraintTranslator
204
+ @ Nullable UnaryOperator <Constraint > filterConstraintTranslator ,
205
+ @ Nullable UnaryOperator <Constraint > orderConstraintTranslator ,
206
+ @ Nullable UnaryOperator <Constraint > requireConstraintTranslator
206
207
) {
207
208
return normalizeQuery (
208
209
null ,
@@ -218,19 +219,22 @@ public Query normalizeQuery(
218
219
* from the query, all query containers that are {@link ConstraintContainer#isNecessary()} are removed
219
220
* and their contents are propagated to their parent.
220
221
*/
222
+ /* we need to use raw types because constraint of type A might contain constraints of type B */
223
+ /* i.e. require constraint might contain filtering constraints etc. */
224
+ @ SuppressWarnings ("rawtypes" )
221
225
@ Nonnull
222
226
public Query normalizeQuery (
223
- @ Nullable UnaryOperator <HeadConstraint > headConstraintTranslator ,
224
- @ Nullable UnaryOperator <FilterConstraint > filterConstraintTranslator ,
225
- @ Nullable UnaryOperator <OrderConstraint > orderConstraintTranslator ,
226
- @ Nullable UnaryOperator <RequireConstraint > requireConstraintTranslator
227
+ @ Nullable UnaryOperator <Constraint > headConstraintTranslator ,
228
+ @ Nullable UnaryOperator <Constraint > filterConstraintTranslator ,
229
+ @ Nullable UnaryOperator <Constraint > orderConstraintTranslator ,
230
+ @ Nullable UnaryOperator <Constraint > requireConstraintTranslator
227
231
) {
228
232
// avoid costly normalization on already normalized query
229
233
if (normalized ) {
230
234
return this ;
231
235
}
232
236
233
- final HeadConstraint normalizedHead = this .head == null ? null : purify (this .head , headConstraintTranslator );
237
+ final HeadConstraint normalizedHead = this .head == null ? null : ( HeadConstraint ) purify (this .head , headConstraintTranslator );
234
238
final FilterBy normalizedFilter = this .filterBy == null ? null : (FilterBy ) purify (this .filterBy , filterConstraintTranslator );
235
239
final OrderBy normalizedOrder = this .orderBy == null ? null : (OrderBy ) purify (this .orderBy , orderConstraintTranslator );
236
240
final Require normalizedRequire = this .require == null ? null : (Require ) purify (this .require , requireConstraintTranslator );
@@ -263,8 +267,11 @@ public StringWithParameters toStringWithParameterExtraction() {
263
267
return PrettyPrintingVisitor .toStringWithParameterExtraction (this );
264
268
}
265
269
270
+ /* we need to use raw types because constraint of type A might contain constraints of type B */
271
+ /* i.e. require constraint might contain filtering constraints etc. */
266
272
@ Nullable
267
- private static <T extends Constraint <T >> T purify (@ Nonnull T constraint , @ Nullable UnaryOperator <T > translator ) {
273
+ @ SuppressWarnings ({"unchecked" , "rawtypes" })
274
+ private static Constraint purify (@ Nonnull Constraint constraint , @ Nullable UnaryOperator <Constraint > translator ) {
268
275
return QueryPurifierVisitor .purify (constraint , translator );
269
276
}
270
277
0 commit comments