Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[don't merge without broader conversation] Fix scalar coerscion tests by disabling afterburner #974

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
client:
autoDeserialize:

receiveBooleanExample:
- '{"value":0}' # jackson is casting 0 -> false and 1 -> true... MapperFeature.ALLOW_COERCION_OF_SCALARS);) in 2.9 will save us
- '{"value":"true"}' # jackson is casting 0 -> false and 1 -> true... MapperFeature.ALLOW_COERCION_OF_SCALARS);) in 2.9 will save us

receiveStringExample:
- '{"value":8}' # jackson coerces things to other types
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's interesting that this is still allowed even with ALLOW_COERCION_OF_SCALARS on

receiveIntegerExample:
- '{"value":"12"}' # jackson coerces things to other types

receiveSetStringExample:
- '{"value":["a","a"]}' # client turns this into a set of ["a"] without error
Expand Down
1 change: 0 additions & 1 deletion conjure-java-jackson-serialization/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ apply from: "${rootDir}/gradle/publish-jar.gradle"
dependencies {
compile "com.fasterxml.jackson.core:jackson-databind"
compile "com.fasterxml.jackson.datatype:jackson-datatype-guava"
compile "com.fasterxml.jackson.module:jackson-module-afterburner"
compile "com.fasterxml.jackson.datatype:jackson-datatype-jdk8"
compile "com.fasterxml.jackson.datatype:jackson-datatype-jsr310"
compile "com.fasterxml.jackson.dataformat:jackson-dataformat-cbor"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import com.fasterxml.jackson.datatype.guava.GuavaModule;
import com.fasterxml.jackson.datatype.jdk8.Jdk8Module;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import com.fasterxml.jackson.module.afterburner.AfterburnerModule;

public final class ObjectMappers {

Expand Down Expand Up @@ -85,7 +84,7 @@ public static ObjectMapper newCborServerObjectMapper() {
/**
* Configures provided ObjectMapper with default modules and settings.
* <p>
* Modules: Guava, JDK7, JDK8, Afterburner, JavaTime
* Modules: Guava, JDK7, JDK8, JavaTime
* <p>
* Settings:
* <ul>
Expand All @@ -100,7 +99,6 @@ public static ObjectMapper withDefaultModules(ObjectMapper mapper) {
.registerModule(new GuavaModule())
.registerModule(new ShimJdk7Module())
.registerModule(new Jdk8Module().configureAbsentsAsNulls(true))
.registerModule(newSafeForNewJdksAfterburnerModule())
.registerModule(new JavaTimeModule())
.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
.disable(DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE)
Expand All @@ -110,12 +108,4 @@ public static ObjectMapper withDefaultModules(ObjectMapper mapper) {
.disable(MapperFeature.ALLOW_COERCION_OF_SCALARS)
.disable(DeserializationFeature.ACCEPT_FLOAT_AS_INT);
}

private static AfterburnerModule newSafeForNewJdksAfterburnerModule() {
AfterburnerModule afterburner = new AfterburnerModule();
// stops production of warnings about illegal reflective access on JDK9+
// https://github.com/FasterXML/jackson-modules-base/issues/37
afterburner.setUseValueClassLoader(false);
return afterburner;
}
}
1 change: 0 additions & 1 deletion conjure-java-jersey-server/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ dependencies {

implementation project(':conjure-java-jackson-serialization')
implementation "com.fasterxml.jackson.jaxrs:jackson-jaxrs-cbor-provider"
implementation "com.fasterxml.jackson.module:jackson-module-afterburner"
implementation "com.jcraft:jzlib"
implementation "com.palantir.safe-logging:safe-logging"
implementation "com.palantir.tracing:tracing-jersey"
Expand Down
2 changes: 1 addition & 1 deletion versions.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.9.7 (3 constraints: 34232
com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.9.7 (1 constraints: b0086a7e)
com.fasterxml.jackson.jaxrs:jackson-jaxrs-base:2.9.7 (1 constraints: 3d175124)
com.fasterxml.jackson.jaxrs:jackson-jaxrs-cbor-provider:2.9.7 (1 constraints: b0086a7e)
com.fasterxml.jackson.module:jackson-module-afterburner:2.9.7 (2 constraints: 571513c9)
com.fasterxml.jackson.module:jackson-module-afterburner:2.9.7 (1 constraints: a80c4f09)
com.fasterxml.jackson.module:jackson-module-jaxb-annotations:2.9.7 (1 constraints: 3d175124)
com.fasterxml.jackson.module:jackson-module-paranamer:2.9.7 (1 constraints: e0154600)
com.fasterxml.jackson.module:jackson-module-scala_2.11:2.9.7 (1 constraints: b0086a7e)
Expand Down