Skip to content

Commit 932d51c

Browse files
Add @UpdateForV10 to AbstractObjectParser methods (elastic#130738)
Add @UpdateForV10 to AbstractObjectParser.declareInt Adds an `@UpdateForV10` annotation to the `AbstractObjectParser .declareInt` method and assigns it to the Core Infra team. This method needs to throw an `IllegalArgumentException` for non-integer values being passed, such as floats, doubles, and stringified floats and doubles.
1 parent 8f64184 commit 932d51c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

libs/x-content/src/main/java/org/elasticsearch/xcontent/AbstractObjectParser.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
package org.elasticsearch.xcontent;
1111

1212
import org.elasticsearch.core.CheckedFunction;
13+
import org.elasticsearch.core.UpdateForV10;
1314
import org.elasticsearch.xcontent.ObjectParser.NamedObjectParser;
1415
import org.elasticsearch.xcontent.ObjectParser.ValueType;
1516

@@ -230,11 +231,13 @@ public void declareDoubleOrNull(BiConsumer<Value, Double> consumer, double nullV
230231
);
231232
}
232233

234+
@UpdateForV10(owner = UpdateForV10.Owner.CORE_INFRA) // https://github.com/elastic/elasticsearch/issues/130797
233235
public void declareLong(BiConsumer<Value, Long> consumer, ParseField field) {
234236
// Using a method reference here angers some compilers
235237
declareField(consumer, p -> p.longValue(), field, ValueType.LONG);
236238
}
237239

240+
@UpdateForV10(owner = UpdateForV10.Owner.CORE_INFRA) // https://github.com/elastic/elasticsearch/issues/130797
238241
public void declareLongOrNull(BiConsumer<Value, Long> consumer, long nullValue, ParseField field) {
239242
// Using a method reference here angers some compilers
240243
declareField(
@@ -245,6 +248,7 @@ public void declareLongOrNull(BiConsumer<Value, Long> consumer, long nullValue,
245248
);
246249
}
247250

251+
@UpdateForV10(owner = UpdateForV10.Owner.CORE_INFRA) // https://github.com/elastic/elasticsearch/issues/130797
248252
public void declareInt(BiConsumer<Value, Integer> consumer, ParseField field) {
249253
// Using a method reference here angers some compilers
250254
declareField(consumer, p -> p.intValue(), field, ValueType.INT);
@@ -253,6 +257,7 @@ public void declareInt(BiConsumer<Value, Integer> consumer, ParseField field) {
253257
/**
254258
* Declare an integer field that parses explicit {@code null}s in the json to a default value.
255259
*/
260+
@UpdateForV10(owner = UpdateForV10.Owner.CORE_INFRA) // https://github.com/elastic/elasticsearch/issues/130797
256261
public void declareIntOrNull(BiConsumer<Value, Integer> consumer, int nullValue, ParseField field) {
257262
declareField(
258263
consumer,
@@ -320,10 +325,12 @@ public void declareFloatArray(BiConsumer<Value, List<Float>> consumer, ParseFiel
320325
declareFieldArray(consumer, (p, c) -> p.floatValue(), field, ValueType.FLOAT_ARRAY);
321326
}
322327

328+
@UpdateForV10(owner = UpdateForV10.Owner.CORE_INFRA) // https://github.com/elastic/elasticsearch/issues/130797
323329
public void declareLongArray(BiConsumer<Value, List<Long>> consumer, ParseField field) {
324330
declareFieldArray(consumer, (p, c) -> p.longValue(), field, ValueType.LONG_ARRAY);
325331
}
326332

333+
@UpdateForV10(owner = UpdateForV10.Owner.CORE_INFRA) // https://github.com/elastic/elasticsearch/issues/130797
327334
public void declareIntArray(BiConsumer<Value, List<Integer>> consumer, ParseField field) {
328335
declareFieldArray(consumer, (p, c) -> p.intValue(), field, ValueType.INT_ARRAY);
329336
}

0 commit comments

Comments
 (0)