Skip to content

Commit 721a170

Browse files
Add @UpdateForV10 to AbstractObjectParser.declareInt
Adds an `@UpdateForV10` annotation to the `AbstractObjectParser .declareInt` method and assigns it to the Distributed Coordination 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 6db05d4 commit 721a170

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

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

Lines changed: 2 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

@@ -245,6 +246,7 @@ public void declareLongOrNull(BiConsumer<Value, Long> consumer, long nullValue,
245246
);
246247
}
247248

249+
@UpdateForV10(owner = UpdateForV10.Owner.DISTRIBUTED_COORDINATION) // Prevent non-integer arguments (floats, doubles, stringified floats and doubles)
248250
public void declareInt(BiConsumer<Value, Integer> consumer, ParseField field) {
249251
// Using a method reference here angers some compilers
250252
declareField(consumer, p -> p.intValue(), field, ValueType.INT);

0 commit comments

Comments
 (0)