diff --git a/docs/changelog/90553.yaml b/docs/changelog/90553.yaml new file mode 100644 index 0000000000000..d6cfdbc48e4f3 --- /dev/null +++ b/docs/changelog/90553.yaml @@ -0,0 +1,5 @@ +pr: 90553 +summary: Upgrade XContent to Jackson 2.14.0 and enable Fast Double Parser +area: Infra/Core +type: enhancement +issues: [] diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml index f60511762044f..4c0f38b292d5a 100644 --- a/gradle/verification-metadata.xml +++ b/gradle/verification-metadata.xml @@ -244,6 +244,11 @@ + + + + + @@ -279,11 +284,21 @@ + + + + + + + + + + @@ -294,6 +309,11 @@ + + + + + diff --git a/libs/x-content/impl/build.gradle b/libs/x-content/impl/build.gradle index f7a7c6a173ee7..0588efe9889c5 100644 --- a/libs/x-content/impl/build.gradle +++ b/libs/x-content/impl/build.gradle @@ -10,7 +10,7 @@ apply plugin: 'elasticsearch.java' archivesBaseName = "x-content-impl" -String jacksonVersion = "2.13.2" +String jacksonVersion = "2.14.0" dependencies { compileOnly project(':libs:elasticsearch-core') @@ -36,6 +36,12 @@ tasks.named("dependencyLicenses").configure { mapping from: /jackson-.*/, to: 'jackson' } +// workaround for (/com/fasterxml/jackson/core/JsonFactory.class): warning: Cannot find annotation method +// 'value()' in type 'ServiceProvider': class file for aQute.bnd.annotation.spi.ServiceProvider not found +tasks.withType(JavaCompile).configureEach { + options.compilerArgs.add("-Xlint:-classfile") +} + // not published, so no need for javadoc tasks.named("javadoc").configure { enabled = false } diff --git a/libs/x-content/impl/src/main/java/org/elasticsearch/xcontent/provider/cbor/CborXContentImpl.java b/libs/x-content/impl/src/main/java/org/elasticsearch/xcontent/provider/cbor/CborXContentImpl.java index 7b06c0b4edaa7..1b2a6d02822ba 100644 --- a/libs/x-content/impl/src/main/java/org/elasticsearch/xcontent/provider/cbor/CborXContentImpl.java +++ b/libs/x-content/impl/src/main/java/org/elasticsearch/xcontent/provider/cbor/CborXContentImpl.java @@ -50,6 +50,7 @@ public static XContent cborXContent() { // Do not automatically close unclosed objects/arrays in com.fasterxml.jackson.dataformat.cbor.CBORGenerator#close() method cborFactory.configure(JsonGenerator.Feature.AUTO_CLOSE_JSON_CONTENT, false); cborFactory.configure(JsonParser.Feature.STRICT_DUPLICATE_DETECTION, true); + cborFactory.configure(JsonParser.Feature.USE_FAST_DOUBLE_PARSER, true); cborXContent = new CborXContentImpl(); } diff --git a/libs/x-content/impl/src/main/java/org/elasticsearch/xcontent/provider/json/JsonXContentImpl.java b/libs/x-content/impl/src/main/java/org/elasticsearch/xcontent/provider/json/JsonXContentImpl.java index c1fa4d9a39ce8..85890c87a3be0 100644 --- a/libs/x-content/impl/src/main/java/org/elasticsearch/xcontent/provider/json/JsonXContentImpl.java +++ b/libs/x-content/impl/src/main/java/org/elasticsearch/xcontent/provider/json/JsonXContentImpl.java @@ -51,6 +51,7 @@ public static final XContent jsonXContent() { // Do not automatically close unclosed objects/arrays in com.fasterxml.jackson.core.json.UTF8JsonGenerator#close() method jsonFactory.configure(JsonGenerator.Feature.AUTO_CLOSE_JSON_CONTENT, false); jsonFactory.configure(JsonParser.Feature.STRICT_DUPLICATE_DETECTION, true); + jsonFactory.configure(JsonParser.Feature.USE_FAST_DOUBLE_PARSER, true); jsonXContent = new JsonXContentImpl(); } diff --git a/libs/x-content/impl/src/main/java/org/elasticsearch/xcontent/provider/smile/SmileXContentImpl.java b/libs/x-content/impl/src/main/java/org/elasticsearch/xcontent/provider/smile/SmileXContentImpl.java index 31fb9d40066e6..46f8aeec20f29 100644 --- a/libs/x-content/impl/src/main/java/org/elasticsearch/xcontent/provider/smile/SmileXContentImpl.java +++ b/libs/x-content/impl/src/main/java/org/elasticsearch/xcontent/provider/smile/SmileXContentImpl.java @@ -52,6 +52,7 @@ public static XContent smileXContent() { // Do not automatically close unclosed objects/arrays in com.fasterxml.jackson.dataformat.smile.SmileGenerator#close() method smileFactory.configure(JsonGenerator.Feature.AUTO_CLOSE_JSON_CONTENT, false); smileFactory.configure(JsonParser.Feature.STRICT_DUPLICATE_DETECTION, true); + smileFactory.configure(JsonParser.Feature.USE_FAST_DOUBLE_PARSER, true); smileXContent = new SmileXContentImpl(); } diff --git a/libs/x-content/impl/src/main/java/org/elasticsearch/xcontent/provider/yaml/YamlXContentImpl.java b/libs/x-content/impl/src/main/java/org/elasticsearch/xcontent/provider/yaml/YamlXContentImpl.java index 232980c1e47c3..2d59b9588ab38 100644 --- a/libs/x-content/impl/src/main/java/org/elasticsearch/xcontent/provider/yaml/YamlXContentImpl.java +++ b/libs/x-content/impl/src/main/java/org/elasticsearch/xcontent/provider/yaml/YamlXContentImpl.java @@ -44,6 +44,7 @@ public static XContent yamlXContent() { static { yamlFactory = new YAMLFactory(); yamlFactory.configure(JsonParser.Feature.STRICT_DUPLICATE_DETECTION, true); + yamlFactory.configure(JsonParser.Feature.USE_FAST_DOUBLE_PARSER, true); yamlXContent = new YamlXContentImpl(); }