FasterXML / jackson-modules-java8

Set of support modules for Java 8 datatypes (Optionals, date/time) and features (parameter names)
Apache License 2.0
401 stars 117 forks source link

ParameterNamesModule 2.9.4 cannot deserialize objects compiled with `-parameters` #63

Closed bobtiernay-okta closed 6 years ago

bobtiernay-okta commented 6 years ago

Using jackson-module-parameter-names 2.9.4 I'm getting:

com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance of `Test$Person` (although at least one Creator exists): can only instantiate non-static inner class by using default, no-argument constructor
 at [Source: (String)"{"name":"Bob", "surname":"Tiernay"}"; line: 1, column: 2]
    @Test
    void testPersonDeserialization() throws IOException {
        final ObjectMapper mapper = new ObjectMapper()
                .registerModule(new ParameterNamesModule(JsonCreator.Mode.PROPERTIES));

        final Person actual = mapper.readValue("{\"name\":\"Bob\", \"surname\":\"Tiernay\"}", Person.class);

        assertThat(actual)
                .isEqualTo(new Person("Bob", "Tiernay"));
    }

    class Person {

        // mandatory fields
        private final String name;
        private final String surname;

        // optional fields
        private String nickname;

        // no annotations are required if preconditions are met (details below)
        public Person(String name, String surname) {

            this.name = name;
            this.surname = surname;
        }

        public String getName() {
            return name;
        }

        public String getSurname() {
            return surname;
        }

        public String getNickname() {

            return nickname;
        }

        public void setNickname(String nickname) {

            this.nickname = nickname;
        }
    }
cowtowncoder commented 6 years ago

Looks like you forgot to make inner class static? If so, make it static inner class: otherwise it can not be deserialized (since it requires reference to surrounding "parent" class, handled by compiler when instantiating).

bobtiernay-okta commented 6 years ago

I actually noticed this on a static class, but decided to use the example from the Wiki. But I will try again and report back.

bobtiernay-okta commented 6 years ago

Yep, same result:

    @Test
    void testPersonDeserialization() throws IOException {
        System.out.println(ObjectMapper.class.getPackage().getImplementationVersion());
        System.out.println(ParameterNamesModule.class.getPackage().getImplementationVersion());

        final ObjectMapper mapper = new ObjectMapper()
                .registerModule(new ParameterNamesModule(JsonCreator.Mode.PROPERTIES));

        final Person actual = mapper.readValue("{\"name\":\"Bob\", \"surname\":\"Tiernay\"}", Person.class);

        assertThat(actual)
                .isEqualTo(new Person("Bob", "Tiernay"));
    }

    static class Person {
     ...
/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/bin/java -ea -Didea.test.cyclic.buffer.size=1048576 "-javaagent:/Applications/IntelliJ IDEA.app/Contents/lib/idea_rt.jar=64762:/Applications/IntelliJ IDEA.app/Contents/bin" -Dfile.encoding=UTF-8 -classpath "/Applications/IntelliJ IDEA.app/Contents/lib/idea_rt.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/junit/lib/junit-rt.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/junit/lib/junit5-rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/deploy.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/ext/cldrdata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/ext/dnsns.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/ext/jaccess.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/ext/jfxrt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/ext/localedata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/ext/nashorn.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/ext/sunec.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/ext/sunjce_provider.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/ext/sunpkcs11.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/ext/zipfs.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/javaws.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/jfxswt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/management-agent.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/plugin.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/lib/ant-javafx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/lib/dt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/lib/javafx-mx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/lib/jconsole.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/lib/packager.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/lib/sa-jdi.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/lib/tools.jar:/Users/btiernay/Workspaces/okta/sage/sage-logs/target/test-classes:/Users/btiernay/Workspaces/okta/sage/sage-logs/target/classes:/Users/btiernay/Workspaces/okta/sage/sage-common/target/classes:/Users/btiernay/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.9.3/jackson-core-2.9.3.jar:/Users/btiernay/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.9.3/jackson-databind-2.9.3.jar:/Users/btiernay/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.9.0/jackson-annotations-2.9.0.jar:/Users/btiernay/.m2/repository/com/amazonaws/aws-java-sdk-s3/1.10.28/aws-java-sdk-s3-1.10.28.jar:/Users/btiernay/.m2/repository/com/amazonaws/aws-java-sdk-kms/1.10.28/aws-java-sdk-kms-1.10.28.jar:/Users/btiernay/.m2/repository/com/amazonaws/aws-java-sdk-core/1.10.28/aws-java-sdk-core-1.10.28.jar:/Users/btiernay/.m2/repository/org/apache/httpcomponents/httpclient/4.4.1/httpclient-4.4.1.jar:/Users/btiernay/.m2/repository/org/apache/httpcomponents/httpcore/4.4.1/httpcore-4.4.1.jar:/Users/btiernay/.m2/repository/commons-codec/commons-codec/1.9/commons-codec-1.9.jar:/Users/btiernay/.m2/repository/com/okta/libraries/framework/geolocation/1.0.0-000169.000108.f43587d/geolocation-1.0.0-000169.000108.f43587d.jar:/Users/btiernay/.m2/repository/com/okta/libraries/framework/domain/1.0.56-d6cc687/domain-1.0.56-d6cc687.jar:/Users/btiernay/.m2/repository/commons-lang/commons-lang/2.4/commons-lang-2.4.jar:/Users/btiernay/.m2/repository/com/google/protobuf/protobuf-java/2.5.0/protobuf-java-2.5.0.jar:/Users/btiernay/.m2/repository/joda-time/joda-time/2.8.1/joda-time-2.8.1.jar:/Users/btiernay/.m2/repository/org/codehaus/jackson/jackson-mapper-asl/1.9.13/jackson-mapper-asl-1.9.13.jar:/Users/btiernay/.m2/repository/org/codehaus/jackson/jackson-core-asl/1.9.13/jackson-core-asl-1.9.13.jar:/Users/btiernay/.m2/repository/org/slf4j/slf4j-api/1.7.5/slf4j-api-1.7.5.jar:/Users/btiernay/.m2/repository/org/springframework/spring-context/5.0.3.RELEASE/spring-context-5.0.3.RELEASE.jar:/Users/btiernay/.m2/repository/org/springframework/spring-aop/5.0.3.RELEASE/spring-aop-5.0.3.RELEASE.jar:/Users/btiernay/.m2/repository/org/springframework/spring-beans/5.0.3.RELEASE/spring-beans-5.0.3.RELEASE.jar:/Users/btiernay/.m2/repository/org/springframework/spring-core/5.0.3.RELEASE/spring-core-5.0.3.RELEASE.jar:/Users/btiernay/.m2/repository/org/springframework/spring-jcl/5.0.3.RELEASE/spring-jcl-5.0.3.RELEASE.jar:/Users/btiernay/.m2/repository/org/springframework/spring-expression/5.0.3.RELEASE/spring-expression-5.0.3.RELEASE.jar:/Users/btiernay/.m2/repository/io/dropwizard/dropwizard-core/1.3.0/dropwizard-core-1.3.0.jar:/Users/btiernay/.m2/repository/io/dropwizard/dropwizard-util/1.3.0/dropwizard-util-1.3.0.jar:/Users/btiernay/.m2/repository/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2.jar:/Users/btiernay/.m2/repository/io/dropwizard/dropwizard-jackson/1.3.0/dropwizard-jackson-1.3.0.jar:/Users/btiernay/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-guava/2.9.4/jackson-datatype-guava-2.9.4.jar:/Users/btiernay/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.9.4/jackson-datatype-jsr310-2.9.4.jar:/Users/btiernay/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jdk8/2.9.4/jackson-datatype-jdk8-2.9.4.jar:/Users/btiernay/.m2/repository/com/fasterxml/jackson/module/jackson-module-parameter-names/2.9.4/jackson-module-parameter-names-2.9.4.jar:/Users/btiernay/.m2/repository/com/fasterxml/jackson/module/jackson-module-afterburner/2.9.4/jackson-module-afterburner-2.9.4.jar:/Users/btiernay/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-joda/2.9.4/jackson-datatype-joda-2.9.4.jar:/Users/btiernay/.m2/repository/io/dropwizard/dropwizard-validation/1.3.0/dropwizard-validation-1.3.0.jar:/Users/btiernay/.m2/repository/org/hibernate/hibernate-validator/5.4.2.Final/hibernate-validator-5.4.2.Final.jar:/Users/btiernay/.m2/repository/javax/validation/validation-api/1.1.0.Final/validation-api-1.1.0.Final.jar:/Users/btiernay/.m2/repository/org/jboss/logging/jboss-logging/3.3.0.Final/jboss-logging-3.3.0.Final.jar:/Users/btiernay/.m2/repository/com/fasterxml/classmate/1.3.1/classmate-1.3.1.jar:/Users/btiernay/.m2/repository/org/glassfish/javax.el/3.0.0/javax.el-3.0.0.jar:/Users/btiernay/.m2/repository/org/javassist/javassist/3.22.0-GA/javassist-3.22.0-GA.jar:/Users/btiernay/.m2/repository/io/dropwizard/dropwizard-configuration/1.3.0/dropwizard-configuration-1.3.0.jar:/Users/btiernay/.m2/repository/com/fasterxml/jackson/dataformat/jackson-dataformat-yaml/2.9.4/jackson-dataformat-yaml-2.9.4.jar:/Users/btiernay/.m2/repository/org/apache/commons/commons-text/1.2/commons-text-1.2.jar:/Users/btiernay/.m2/repository/io/dropwizard/dropwizard-logging/1.3.0/dropwizard-logging-1.3.0.jar:/Users/btiernay/.m2/repository/io/dropwizard/metrics/metrics-logback/4.0.2/metrics-logback-4.0.2.jar:/Users/btiernay/.m2/repository/org/slf4j/jul-to-slf4j/1.7.25/jul-to-slf4j-1.7.25.jar:/Users/btiernay/.m2/repository/org/slf4j/log4j-over-slf4j/1.7.25/log4j-over-slf4j-1.7.25.jar:/Users/btiernay/.m2/repository/org/slf4j/jcl-over-slf4j/1.7.25/jcl-over-slf4j-1.7.25.jar:/Users/btiernay/.m2/repository/org/eclipse/jetty/jetty-util/9.4.8.v20171121/jetty-util-9.4.8.v20171121.jar:/Users/btiernay/.m2/repository/io/dropwizard/dropwizard-metrics/1.3.0/dropwizard-metrics-1.3.0.jar:/Users/btiernay/.m2/repository/io/dropwizard/dropwizard-jersey/1.3.0/dropwizard-jersey-1.3.0.jar:/Users/btiernay/.m2/repository/org/glassfish/jersey/core/jersey-server/2.25.1/jersey-server-2.25.1.jar:/Users/btiernay/.m2/repository/org/glassfish/jersey/core/jersey-common/2.25.1/jersey-common-2.25.1.jar:/Users/btiernay/.m2/repository/org/glassfish/jersey/bundles/repackaged/jersey-guava/2.25.1/jersey-guava-2.25.1.jar:/Users/btiernay/.m2/repository/org/glassfish/hk2/osgi-resource-locator/1.0.1/osgi-resource-locator-1.0.1.jar:/Users/btiernay/.m2/repository/javax/ws/rs/javax.ws.rs-api/2.0.1/javax.ws.rs-api-2.0.1.jar:/Users/btiernay/.m2/repository/org/glassfish/jersey/media/jersey-media-jaxb/2.25.1/jersey-media-jaxb-2.25.1.jar:/Users/btiernay/.m2/repository/javax/annotation/javax.annotation-api/1.2/javax.annotation-api-1.2.jar:/Users/btiernay/.m2/repository/org/glassfish/hk2/hk2-api/2.5.0-b32/hk2-api-2.5.0-b32.jar:/Users/btiernay/.m2/repository/org/glassfish/hk2/hk2-utils/2.5.0-b32/hk2-utils-2.5.0-b32.jar:/Users/btiernay/.m2/repository/org/glassfish/hk2/external/aopalliance-repackaged/2.5.0-b32/aopalliance-repackaged-2.5.0-b32.jar:/Users/btiernay/.m2/repository/org/glassfish/hk2/external/javax.inject/2.5.0-b32/javax.inject-2.5.0-b32.jar:/Users/btiernay/.m2/repository/org/glassfish/hk2/hk2-locator/2.5.0-b32/hk2-locator-2.5.0-b32.jar:/Users/btiernay/.m2/repository/org/glassfish/jersey/ext/jersey-metainf-services/2.25.1/jersey-metainf-services-2.25.1.jar:/Users/btiernay/.m2/repository/org/glassfish/jersey/ext/jersey-bean-validation/2.25.1/jersey-bean-validation-2.25.1.jar:/Users/btiernay/.m2/repository/io/dropwizard/metrics/metrics-jersey2/4.0.2/metrics-jersey2-4.0.2.jar:/Users/btiernay/.m2/repository/com/fasterxml/jackson/jaxrs/jackson-jaxrs-json-provider/2.9.4/jackson-jaxrs-json-provider-2.9.4.jar:/Users/btiernay/.m2/repository/com/fasterxml/jackson/jaxrs/jackson-jaxrs-base/2.9.4/jackson-jaxrs-base-2.9.4.jar:/Users/btiernay/.m2/repository/com/fasterxml/jackson/module/jackson-module-jaxb-annotations/2.9.4/jackson-module-jaxb-annotations-2.9.4.jar:/Users/btiernay/.m2/repository/org/glassfish/jersey/containers/jersey-container-servlet/2.25.1/jersey-container-servlet-2.25.1.jar:/Users/btiernay/.m2/repository/org/glassfish/jersey/containers/jersey-container-servlet-core/2.25.1/jersey-container-servlet-core-2.25.1.jar:/Users/btiernay/.m2/repository/org/eclipse/jetty/jetty-server/9.4.8.v20171121/jetty-server-9.4.8.v20171121.jar:/Users/btiernay/.m2/repository/javax/servlet/javax.servlet-api/3.1.0/javax.servlet-api-3.1.0.jar:/Users/btiernay/.m2/repository/org/eclipse/jetty/jetty-io/9.4.8.v20171121/jetty-io-9.4.8.v20171121.jar:/Users/btiernay/.m2/repository/org/eclipse/jetty/jetty-webapp/9.4.8.v20171121/jetty-webapp-9.4.8.v20171121.jar:/Users/btiernay/.m2/repository/org/eclipse/jetty/jetty-xml/9.4.8.v20171121/jetty-xml-9.4.8.v20171121.jar:/Users/btiernay/.m2/repository/org/eclipse/jetty/jetty-continuation/9.4.8.v20171121/jetty-continuation-9.4.8.v20171121.jar:/Users/btiernay/.m2/repository/io/dropwizard/dropwizard-servlets/1.3.0/dropwizard-servlets-1.3.0.jar:/Users/btiernay/.m2/repository/io/dropwizard/metrics/metrics-annotation/4.0.2/metrics-annotation-4.0.2.jar:/Users/btiernay/.m2/repository/io/dropwizard/dropwizard-jetty/1.3.0/dropwizard-jetty-1.3.0.jar:/Users/btiernay/.m2/repository/io/dropwizard/metrics/metrics-jetty9/4.0.2/metrics-jetty9-4.0.2.jar:/Users/btiernay/.m2/repository/org/eclipse/jetty/jetty-servlet/9.4.8.v20171121/jetty-servlet-9.4.8.v20171121.jar:/Users/btiernay/.m2/repository/org/eclipse/jetty/jetty-security/9.4.8.v20171121/jetty-security-9.4.8.v20171121.jar:/Users/btiernay/.m2/repository/org/eclipse/jetty/jetty-servlets/9.4.8.v20171121/jetty-servlets-9.4.8.v20171121.jar:/Users/btiernay/.m2/repository/org/eclipse/jetty/jetty-http/9.4.8.v20171121/jetty-http-9.4.8.v20171121.jar:/Users/btiernay/.m2/repository/io/dropwizard/dropwizard-lifecycle/1.3.0/dropwizard-lifecycle-1.3.0.jar:/Users/btiernay/.m2/repository/io/dropwizard/metrics/metrics-core/4.0.2/metrics-core-4.0.2.jar:/Users/btiernay/.m2/repository/io/dropwizard/metrics/metrics-jvm/4.0.2/metrics-jvm-4.0.2.jar:/Users/btiernay/.m2/repository/io/dropwizard/metrics/metrics-jmx/4.0.2/metrics-jmx-4.0.2.jar:/Users/btiernay/.m2/repository/io/dropwizard/metrics/metrics-servlets/4.0.2/metrics-servlets-4.0.2.jar:/Users/btiernay/.m2/repository/io/dropwizard/metrics/metrics-json/4.0.2/metrics-json-4.0.2.jar:/Users/btiernay/.m2/repository/com/papertrail/profiler/1.0.2/profiler-1.0.2.jar:/Users/btiernay/.m2/repository/io/dropwizard/metrics/metrics-healthchecks/4.0.2/metrics-healthchecks-4.0.2.jar:/Users/btiernay/.m2/repository/io/dropwizard/dropwizard-request-logging/1.3.0/dropwizard-request-logging-1.3.0.jar:/Users/btiernay/.m2/repository/ch/qos/logback/logback-access/1.2.3/logback-access-1.2.3.jar:/Users/btiernay/.m2/repository/net/sourceforge/argparse4j/argparse4j/0.8.1/argparse4j-0.8.1.jar:/Users/btiernay/.m2/repository/org/eclipse/jetty/toolchain/setuid/jetty-setuid-java/1.0.3/jetty-setuid-java-1.0.3.jar:/Users/btiernay/.m2/repository/io/dropwizard/dropwizard-auth/1.3.0/dropwizard-auth-1.3.0.jar:/Users/btiernay/.m2/repository/com/unboundid/product/scim/scim-sdk/1.8.2/scim-sdk-1.8.2.jar:/Users/btiernay/.m2/repository/com/unboundid/components/json/1.0.0/json-1.0.0.jar:/Users/btiernay/.m2/repository/ch/hsr/geohash/1.1.0/geohash-1.1.0.jar:/Users/btiernay/.m2/repository/org/elasticsearch/elasticsearch/1.7.1/elasticsearch-1.7.1.jar:/Users/btiernay/.m2/repository/org/apache/lucene/lucene-core/4.10.4/lucene-core-4.10.4.jar:/Users/btiernay/.m2/repository/org/apache/lucene/lucene-analyzers-common/4.10.4/lucene-analyzers-common-4.10.4.jar:/Users/btiernay/.m2/repository/org/apache/lucene/lucene-queries/4.10.4/lucene-queries-4.10.4.jar:/Users/btiernay/.m2/repository/org/apache/lucene/lucene-memory/4.10.4/lucene-memory-4.10.4.jar:/Users/btiernay/.m2/repository/org/apache/lucene/lucene-highlighter/4.10.4/lucene-highlighter-4.10.4.jar:/Users/btiernay/.m2/repository/org/apache/lucene/lucene-queryparser/4.10.4/lucene-queryparser-4.10.4.jar:/Users/btiernay/.m2/repository/org/apache/lucene/lucene-sandbox/4.10.4/lucene-sandbox-4.10.4.jar:/Users/btiernay/.m2/repository/org/apache/lucene/lucene-suggest/4.10.4/lucene-suggest-4.10.4.jar:/Users/btiernay/.m2/repository/org/apache/lucene/lucene-misc/4.10.4/lucene-misc-4.10.4.jar:/Users/btiernay/.m2/repository/org/apache/lucene/lucene-join/4.10.4/lucene-join-4.10.4.jar:/Users/btiernay/.m2/repository/org/apache/lucene/lucene-grouping/4.10.4/lucene-grouping-4.10.4.jar:/Users/btiernay/.m2/repository/org/apache/lucene/lucene-spatial/4.10.4/lucene-spatial-4.10.4.jar:/Users/btiernay/.m2/repository/com/spatial4j/spatial4j/0.4.1/spatial4j-0.4.1.jar:/Users/btiernay/.m2/repository/org/antlr/antlr-runtime/3.5/antlr-runtime-3.5.jar:/Users/btiernay/.m2/repository/org/ow2/asm/asm/4.1/asm-4.1.jar:/Users/btiernay/.m2/repository/org/ow2/asm/asm-commons/4.1/asm-commons-4.1.jar:/Users/btiernay/.m2/repository/org/yaml/snakeyaml/1.12/snakeyaml-1.12.jar:/Users/btiernay/.m2/repository/org/projectlombok/lombok/1.16.20/lombok-1.16.20.jar:/Users/btiernay/.m2/repository/com/google/guava/guava/21.0/guava-21.0.jar:/Users/btiernay/.m2/repository/commons-beanutils/commons-beanutils/1.9.3/commons-beanutils-1.9.3.jar:/Users/btiernay/.m2/repository/commons-logging/commons-logging/1.2/commons-logging-1.2.jar:/Users/btiernay/.m2/repository/commons-collections/commons-collections/3.2.2/commons-collections-3.2.2.jar:/Users/btiernay/.m2/repository/com/opencsv/opencsv/3.7/opencsv-3.7.jar:/Users/btiernay/.m2/repository/org/apache/commons/commons-lang3/3.4/commons-lang3-3.4.jar:/Users/btiernay/.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar:/Users/btiernay/.m2/repository/ch/qos/logback/logback-core/1.2.3/logback-core-1.2.3.jar:/Users/btiernay/Workspaces/okta/sage/sage-common/target/test-classes:/Users/btiernay/.m2/repository/io/dropwizard/dropwizard-testing/1.3.0/dropwizard-testing-1.3.0.jar:/Users/btiernay/.m2/repository/org/objenesis/objenesis/2.6/objenesis-2.6.jar:/Users/btiernay/.m2/repository/org/glassfish/jersey/test-framework/providers/jersey-test-framework-provider-inmemory/2.25.1/jersey-test-framework-provider-inmemory-2.25.1.jar:/Users/btiernay/.m2/repository/org/glassfish/jersey/test-framework/jersey-test-framework-core/2.25.1/jersey-test-framework-core-2.25.1.jar:/Users/btiernay/.m2/repository/org/glassfish/jersey/core/jersey-client/2.25.1/jersey-client-2.25.1.jar:/Users/btiernay/.m2/repository/nl/jqno/equalsverifier/equalsverifier/2.4.2/equalsverifier-2.4.2.jar:/Users/btiernay/.m2/repository/com/google/code/findbugs/annotations/2.0.3/annotations-2.0.3.jar:/Users/btiernay/.m2/repository/org/junit/jupiter/junit-jupiter-engine/5.1.0/junit-jupiter-engine-5.1.0.jar:/Users/btiernay/.m2/repository/org/apiguardian/apiguardian-api/1.0.0/apiguardian-api-1.0.0.jar:/Users/btiernay/.m2/repository/org/junit/platform/junit-platform-engine/1.1.0/junit-platform-engine-1.1.0.jar:/Users/btiernay/.m2/repository/org/junit/platform/junit-platform-commons/1.1.0/junit-platform-commons-1.1.0.jar:/Users/btiernay/.m2/repository/org/opentest4j/opentest4j/1.0.0/opentest4j-1.0.0.jar:/Users/btiernay/.m2/repository/org/junit/jupiter/junit-jupiter-api/5.1.0/junit-jupiter-api-5.1.0.jar:/Users/btiernay/.m2/repository/org/junit/jupiter/junit-jupiter-params/5.1.0/junit-jupiter-params-5.1.0.jar:/Users/btiernay/.m2/repository/org/junit/vintage/junit-vintage-engine/5.1.0/junit-vintage-engine-5.1.0.jar:/Users/btiernay/.m2/repository/org/junit/platform/junit-platform-launcher/1.1.0/junit-platform-launcher-1.1.0.jar:/Users/btiernay/.m2/repository/junit/junit/4.12/junit-4.12.jar:/Users/btiernay/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar:/Users/btiernay/.m2/repository/org/assertj/assertj-core/3.9.0/assertj-core-3.9.0.jar:/Users/btiernay/.m2/repository/org/mockito/mockito-core/2.8.9/mockito-core-2.8.9.jar:/Users/btiernay/.m2/repository/net/bytebuddy/byte-buddy/1.6.14/byte-buddy-1.6.14.jar:/Users/btiernay/.m2/repository/net/bytebuddy/byte-buddy-agent/1.6.14/byte-buddy-agent-1.6.14.jar:/Users/btiernay/.m2/repository/net/javacrumbs/json-unit/json-unit/1.28.1/json-unit-1.28.1.jar:/Users/btiernay/.m2/repository/net/javacrumbs/json-unit/json-unit-core/1.28.1/json-unit-core-1.28.1.jar:/Users/btiernay/.m2/repository/net/javacrumbs/json-unit/json-unit-fluent/1.28.1/json-unit-fluent-1.28.1.jar" com.intellij.rt.execution.junit.JUnitStarter -ideVersion5 -junit5 com.okta.sage.logs.resources.request.ListResponseTest,testPersonDeserialization
objc[20262]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/bin/java (0x102f594c0) and /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/libinstrument.dylib (0x102fe54e0). One of the two will be used. Which one is undefined.
2.9.3
2.9.4

com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of `com.okta.sage.logs.resources.request.ListResponseTest$Person` (no Creators, like default construct, exist): cannot deserialize from Object value (no delegate- or property-based Creator)
 at [Source: (String)"{"name":"Bob", "surname":"Tiernay"}"; line: 1, column: 2]

    at com.fasterxml.jackson.databind.exc.InvalidDefinitionException.from(InvalidDefinitionException.java:67)
    at com.fasterxml.jackson.databind.DeserializationContext.reportBadDefinition(DeserializationContext.java:1451)
    at com.fasterxml.jackson.databind.DeserializationContext.handleMissingInstantiator(DeserializationContext.java:1027)
    at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.deserializeFromObjectUsingNonDefault(BeanDeserializerBase.java:1275)
    at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:325)
    at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:159)
    at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4001)
    at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2992)
    at com.okta.sage.logs.resources.request.ListResponseTest.testPersonDeserialization(ListResponseTest.java:52)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:436)
    at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:115)
    at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$6(TestMethodTestDescriptor.java:170)
    at org.junit.jupiter.engine.execution.ThrowableCollector.execute(ThrowableCollector.java:40)
    at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:166)
    at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:113)
    at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:58)
    at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$3(HierarchicalTestExecutor.java:112)
    at org.junit.platform.engine.support.hierarchical.SingleTestExecutor.executeSafely(SingleTestExecutor.java:66)
    at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.executeRecursively(HierarchicalTestExecutor.java:108)
    at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.execute(HierarchicalTestExecutor.java:79)
    at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$2(HierarchicalTestExecutor.java:120)
    at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
    at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
    at java.util.Iterator.forEachRemaining(Iterator.java:116)
    at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
    at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
    at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
    at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$3(HierarchicalTestExecutor.java:120)
    at org.junit.platform.engine.support.hierarchical.SingleTestExecutor.executeSafely(SingleTestExecutor.java:66)
    at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.executeRecursively(HierarchicalTestExecutor.java:108)
    at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.execute(HierarchicalTestExecutor.java:79)
    at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$2(HierarchicalTestExecutor.java:120)
    at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
    at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
    at java.util.Iterator.forEachRemaining(Iterator.java:116)
    at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
    at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
    at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
    at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$3(HierarchicalTestExecutor.java:120)
    at org.junit.platform.engine.support.hierarchical.SingleTestExecutor.executeSafely(SingleTestExecutor.java:66)
    at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.executeRecursively(HierarchicalTestExecutor.java:108)
    at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.execute(HierarchicalTestExecutor.java:79)
    at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:55)
    at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:43)
    at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:170)
    at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:154)
    at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:90)
    at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:74)
    at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
    at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
    at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)

Process finished with exit code 255
bobtiernay-okta commented 6 years ago

Hmm, okay something is up:

        final Constructor<?> constructor = Person.class.getConstructors()[0];
        for (Parameter p :  constructor.getParameters()) {
            System.out.println(p.getName());
        }

prints:

arg0
arg1

I guess we can close this ticket :)

bobtiernay-okta commented 6 years ago

Ok interesting. After ensuring my IDE settings matched the console, I got the test to pass. However, if I change the Person class to look like this:

    private static final class Person {

        private final Map<String, Object> debugData;

        public Person(Map<String, Object> debugData) {
            this.debugData = debugData;
        }

    }

It fails:

    @Test
    void testPersonDeserialization() throws IOException {
        System.out.println(ObjectMapper.class.getPackage().getImplementationVersion());
        System.out.println(ParameterNamesModule.class.getPackage().getImplementationVersion());

        final Constructor<?> constructor = Person.class.getConstructors()[0];
        for (Parameter p :  constructor.getParameters()) {
            System.out.println(p.getName());
        }

        final ObjectMapper mapper = new ObjectMapper()
                .registerModule(new ParameterNamesModule(JsonCreator.Mode.PROPERTIES));

        final Person actual = mapper.readValue("{\"debugData\":{\"x\":1}}", Person.class);

        assertThat(actual)
                .isEqualTo(new Person(ImmutableMap.of("x", 1)));
    }
/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/bin/java -ea -Didea.test.cyclic.buffer.size=1048576 "-javaagent:/Applications/IntelliJ IDEA.app/Contents/lib/idea_rt.jar=65486:/Applications/IntelliJ IDEA.app/Contents/bin" -Dfile.encoding=UTF-8 -classpath "/Applications/IntelliJ IDEA.app/Contents/lib/idea_rt.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/junit/lib/junit-rt.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/junit/lib/junit5-rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/deploy.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/ext/cldrdata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/ext/dnsns.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/ext/jaccess.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/ext/jfxrt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/ext/localedata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/ext/nashorn.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/ext/sunec.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/ext/sunjce_provider.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/ext/sunpkcs11.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/ext/zipfs.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/javaws.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/jfxswt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/management-agent.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/plugin.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/lib/ant-javafx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/lib/dt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/lib/javafx-mx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/lib/jconsole.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/lib/packager.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/lib/sa-jdi.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/lib/tools.jar:/Users/btiernay/Workspaces/okta/sage/sage-logs/target/test-classes:/Users/btiernay/Workspaces/okta/sage/sage-logs/target/classes:/Users/btiernay/Workspaces/okta/sage/sage-common/target/classes:/Users/btiernay/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.9.3/jackson-core-2.9.3.jar:/Users/btiernay/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.9.3/jackson-databind-2.9.3.jar:/Users/btiernay/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.9.0/jackson-annotations-2.9.0.jar:/Users/btiernay/.m2/repository/com/amazonaws/aws-java-sdk-s3/1.10.28/aws-java-sdk-s3-1.10.28.jar:/Users/btiernay/.m2/repository/com/amazonaws/aws-java-sdk-kms/1.10.28/aws-java-sdk-kms-1.10.28.jar:/Users/btiernay/.m2/repository/com/amazonaws/aws-java-sdk-core/1.10.28/aws-java-sdk-core-1.10.28.jar:/Users/btiernay/.m2/repository/org/apache/httpcomponents/httpclient/4.4.1/httpclient-4.4.1.jar:/Users/btiernay/.m2/repository/org/apache/httpcomponents/httpcore/4.4.1/httpcore-4.4.1.jar:/Users/btiernay/.m2/repository/commons-codec/commons-codec/1.9/commons-codec-1.9.jar:/Users/btiernay/.m2/repository/com/okta/libraries/framework/geolocation/1.0.0-000169.000108.f43587d/geolocation-1.0.0-000169.000108.f43587d.jar:/Users/btiernay/.m2/repository/com/okta/libraries/framework/domain/1.0.56-d6cc687/domain-1.0.56-d6cc687.jar:/Users/btiernay/.m2/repository/commons-lang/commons-lang/2.4/commons-lang-2.4.jar:/Users/btiernay/.m2/repository/com/google/protobuf/protobuf-java/2.5.0/protobuf-java-2.5.0.jar:/Users/btiernay/.m2/repository/joda-time/joda-time/2.8.1/joda-time-2.8.1.jar:/Users/btiernay/.m2/repository/org/codehaus/jackson/jackson-mapper-asl/1.9.13/jackson-mapper-asl-1.9.13.jar:/Users/btiernay/.m2/repository/org/codehaus/jackson/jackson-core-asl/1.9.13/jackson-core-asl-1.9.13.jar:/Users/btiernay/.m2/repository/org/slf4j/slf4j-api/1.7.5/slf4j-api-1.7.5.jar:/Users/btiernay/.m2/repository/org/springframework/spring-context/5.0.3.RELEASE/spring-context-5.0.3.RELEASE.jar:/Users/btiernay/.m2/repository/org/springframework/spring-aop/5.0.3.RELEASE/spring-aop-5.0.3.RELEASE.jar:/Users/btiernay/.m2/repository/org/springframework/spring-beans/5.0.3.RELEASE/spring-beans-5.0.3.RELEASE.jar:/Users/btiernay/.m2/repository/org/springframework/spring-core/5.0.3.RELEASE/spring-core-5.0.3.RELEASE.jar:/Users/btiernay/.m2/repository/org/springframework/spring-jcl/5.0.3.RELEASE/spring-jcl-5.0.3.RELEASE.jar:/Users/btiernay/.m2/repository/org/springframework/spring-expression/5.0.3.RELEASE/spring-expression-5.0.3.RELEASE.jar:/Users/btiernay/.m2/repository/io/dropwizard/dropwizard-core/1.3.0/dropwizard-core-1.3.0.jar:/Users/btiernay/.m2/repository/io/dropwizard/dropwizard-util/1.3.0/dropwizard-util-1.3.0.jar:/Users/btiernay/.m2/repository/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2.jar:/Users/btiernay/.m2/repository/io/dropwizard/dropwizard-jackson/1.3.0/dropwizard-jackson-1.3.0.jar:/Users/btiernay/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-guava/2.9.4/jackson-datatype-guava-2.9.4.jar:/Users/btiernay/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.9.4/jackson-datatype-jsr310-2.9.4.jar:/Users/btiernay/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jdk8/2.9.4/jackson-datatype-jdk8-2.9.4.jar:/Users/btiernay/.m2/repository/com/fasterxml/jackson/module/jackson-module-parameter-names/2.9.4/jackson-module-parameter-names-2.9.4.jar:/Users/btiernay/.m2/repository/com/fasterxml/jackson/module/jackson-module-afterburner/2.9.4/jackson-module-afterburner-2.9.4.jar:/Users/btiernay/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-joda/2.9.4/jackson-datatype-joda-2.9.4.jar:/Users/btiernay/.m2/repository/io/dropwizard/dropwizard-validation/1.3.0/dropwizard-validation-1.3.0.jar:/Users/btiernay/.m2/repository/org/hibernate/hibernate-validator/5.4.2.Final/hibernate-validator-5.4.2.Final.jar:/Users/btiernay/.m2/repository/javax/validation/validation-api/1.1.0.Final/validation-api-1.1.0.Final.jar:/Users/btiernay/.m2/repository/org/jboss/logging/jboss-logging/3.3.0.Final/jboss-logging-3.3.0.Final.jar:/Users/btiernay/.m2/repository/com/fasterxml/classmate/1.3.1/classmate-1.3.1.jar:/Users/btiernay/.m2/repository/org/glassfish/javax.el/3.0.0/javax.el-3.0.0.jar:/Users/btiernay/.m2/repository/org/javassist/javassist/3.22.0-GA/javassist-3.22.0-GA.jar:/Users/btiernay/.m2/repository/io/dropwizard/dropwizard-configuration/1.3.0/dropwizard-configuration-1.3.0.jar:/Users/btiernay/.m2/repository/com/fasterxml/jackson/dataformat/jackson-dataformat-yaml/2.9.4/jackson-dataformat-yaml-2.9.4.jar:/Users/btiernay/.m2/repository/org/apache/commons/commons-text/1.2/commons-text-1.2.jar:/Users/btiernay/.m2/repository/io/dropwizard/dropwizard-logging/1.3.0/dropwizard-logging-1.3.0.jar:/Users/btiernay/.m2/repository/io/dropwizard/metrics/metrics-logback/4.0.2/metrics-logback-4.0.2.jar:/Users/btiernay/.m2/repository/org/slf4j/jul-to-slf4j/1.7.25/jul-to-slf4j-1.7.25.jar:/Users/btiernay/.m2/repository/org/slf4j/log4j-over-slf4j/1.7.25/log4j-over-slf4j-1.7.25.jar:/Users/btiernay/.m2/repository/org/slf4j/jcl-over-slf4j/1.7.25/jcl-over-slf4j-1.7.25.jar:/Users/btiernay/.m2/repository/org/eclipse/jetty/jetty-util/9.4.8.v20171121/jetty-util-9.4.8.v20171121.jar:/Users/btiernay/.m2/repository/io/dropwizard/dropwizard-metrics/1.3.0/dropwizard-metrics-1.3.0.jar:/Users/btiernay/.m2/repository/io/dropwizard/dropwizard-jersey/1.3.0/dropwizard-jersey-1.3.0.jar:/Users/btiernay/.m2/repository/org/glassfish/jersey/core/jersey-server/2.25.1/jersey-server-2.25.1.jar:/Users/btiernay/.m2/repository/org/glassfish/jersey/core/jersey-common/2.25.1/jersey-common-2.25.1.jar:/Users/btiernay/.m2/repository/org/glassfish/jersey/bundles/repackaged/jersey-guava/2.25.1/jersey-guava-2.25.1.jar:/Users/btiernay/.m2/repository/org/glassfish/hk2/osgi-resource-locator/1.0.1/osgi-resource-locator-1.0.1.jar:/Users/btiernay/.m2/repository/javax/ws/rs/javax.ws.rs-api/2.0.1/javax.ws.rs-api-2.0.1.jar:/Users/btiernay/.m2/repository/org/glassfish/jersey/media/jersey-media-jaxb/2.25.1/jersey-media-jaxb-2.25.1.jar:/Users/btiernay/.m2/repository/javax/annotation/javax.annotation-api/1.2/javax.annotation-api-1.2.jar:/Users/btiernay/.m2/repository/org/glassfish/hk2/hk2-api/2.5.0-b32/hk2-api-2.5.0-b32.jar:/Users/btiernay/.m2/repository/org/glassfish/hk2/hk2-utils/2.5.0-b32/hk2-utils-2.5.0-b32.jar:/Users/btiernay/.m2/repository/org/glassfish/hk2/external/aopalliance-repackaged/2.5.0-b32/aopalliance-repackaged-2.5.0-b32.jar:/Users/btiernay/.m2/repository/org/glassfish/hk2/external/javax.inject/2.5.0-b32/javax.inject-2.5.0-b32.jar:/Users/btiernay/.m2/repository/org/glassfish/hk2/hk2-locator/2.5.0-b32/hk2-locator-2.5.0-b32.jar:/Users/btiernay/.m2/repository/org/glassfish/jersey/ext/jersey-metainf-services/2.25.1/jersey-metainf-services-2.25.1.jar:/Users/btiernay/.m2/repository/org/glassfish/jersey/ext/jersey-bean-validation/2.25.1/jersey-bean-validation-2.25.1.jar:/Users/btiernay/.m2/repository/io/dropwizard/metrics/metrics-jersey2/4.0.2/metrics-jersey2-4.0.2.jar:/Users/btiernay/.m2/repository/com/fasterxml/jackson/jaxrs/jackson-jaxrs-json-provider/2.9.4/jackson-jaxrs-json-provider-2.9.4.jar:/Users/btiernay/.m2/repository/com/fasterxml/jackson/jaxrs/jackson-jaxrs-base/2.9.4/jackson-jaxrs-base-2.9.4.jar:/Users/btiernay/.m2/repository/com/fasterxml/jackson/module/jackson-module-jaxb-annotations/2.9.4/jackson-module-jaxb-annotations-2.9.4.jar:/Users/btiernay/.m2/repository/org/glassfish/jersey/containers/jersey-container-servlet/2.25.1/jersey-container-servlet-2.25.1.jar:/Users/btiernay/.m2/repository/org/glassfish/jersey/containers/jersey-container-servlet-core/2.25.1/jersey-container-servlet-core-2.25.1.jar:/Users/btiernay/.m2/repository/org/eclipse/jetty/jetty-server/9.4.8.v20171121/jetty-server-9.4.8.v20171121.jar:/Users/btiernay/.m2/repository/javax/servlet/javax.servlet-api/3.1.0/javax.servlet-api-3.1.0.jar:/Users/btiernay/.m2/repository/org/eclipse/jetty/jetty-io/9.4.8.v20171121/jetty-io-9.4.8.v20171121.jar:/Users/btiernay/.m2/repository/org/eclipse/jetty/jetty-webapp/9.4.8.v20171121/jetty-webapp-9.4.8.v20171121.jar:/Users/btiernay/.m2/repository/org/eclipse/jetty/jetty-xml/9.4.8.v20171121/jetty-xml-9.4.8.v20171121.jar:/Users/btiernay/.m2/repository/org/eclipse/jetty/jetty-continuation/9.4.8.v20171121/jetty-continuation-9.4.8.v20171121.jar:/Users/btiernay/.m2/repository/io/dropwizard/dropwizard-servlets/1.3.0/dropwizard-servlets-1.3.0.jar:/Users/btiernay/.m2/repository/io/dropwizard/metrics/metrics-annotation/4.0.2/metrics-annotation-4.0.2.jar:/Users/btiernay/.m2/repository/io/dropwizard/dropwizard-jetty/1.3.0/dropwizard-jetty-1.3.0.jar:/Users/btiernay/.m2/repository/io/dropwizard/metrics/metrics-jetty9/4.0.2/metrics-jetty9-4.0.2.jar:/Users/btiernay/.m2/repository/org/eclipse/jetty/jetty-servlet/9.4.8.v20171121/jetty-servlet-9.4.8.v20171121.jar:/Users/btiernay/.m2/repository/org/eclipse/jetty/jetty-security/9.4.8.v20171121/jetty-security-9.4.8.v20171121.jar:/Users/btiernay/.m2/repository/org/eclipse/jetty/jetty-servlets/9.4.8.v20171121/jetty-servlets-9.4.8.v20171121.jar:/Users/btiernay/.m2/repository/org/eclipse/jetty/jetty-http/9.4.8.v20171121/jetty-http-9.4.8.v20171121.jar:/Users/btiernay/.m2/repository/io/dropwizard/dropwizard-lifecycle/1.3.0/dropwizard-lifecycle-1.3.0.jar:/Users/btiernay/.m2/repository/io/dropwizard/metrics/metrics-core/4.0.2/metrics-core-4.0.2.jar:/Users/btiernay/.m2/repository/io/dropwizard/metrics/metrics-jvm/4.0.2/metrics-jvm-4.0.2.jar:/Users/btiernay/.m2/repository/io/dropwizard/metrics/metrics-jmx/4.0.2/metrics-jmx-4.0.2.jar:/Users/btiernay/.m2/repository/io/dropwizard/metrics/metrics-servlets/4.0.2/metrics-servlets-4.0.2.jar:/Users/btiernay/.m2/repository/io/dropwizard/metrics/metrics-json/4.0.2/metrics-json-4.0.2.jar:/Users/btiernay/.m2/repository/com/papertrail/profiler/1.0.2/profiler-1.0.2.jar:/Users/btiernay/.m2/repository/io/dropwizard/metrics/metrics-healthchecks/4.0.2/metrics-healthchecks-4.0.2.jar:/Users/btiernay/.m2/repository/io/dropwizard/dropwizard-request-logging/1.3.0/dropwizard-request-logging-1.3.0.jar:/Users/btiernay/.m2/repository/ch/qos/logback/logback-access/1.2.3/logback-access-1.2.3.jar:/Users/btiernay/.m2/repository/net/sourceforge/argparse4j/argparse4j/0.8.1/argparse4j-0.8.1.jar:/Users/btiernay/.m2/repository/org/eclipse/jetty/toolchain/setuid/jetty-setuid-java/1.0.3/jetty-setuid-java-1.0.3.jar:/Users/btiernay/.m2/repository/io/dropwizard/dropwizard-auth/1.3.0/dropwizard-auth-1.3.0.jar:/Users/btiernay/.m2/repository/com/unboundid/product/scim/scim-sdk/1.8.2/scim-sdk-1.8.2.jar:/Users/btiernay/.m2/repository/com/unboundid/components/json/1.0.0/json-1.0.0.jar:/Users/btiernay/.m2/repository/ch/hsr/geohash/1.1.0/geohash-1.1.0.jar:/Users/btiernay/.m2/repository/org/elasticsearch/elasticsearch/1.7.1/elasticsearch-1.7.1.jar:/Users/btiernay/.m2/repository/org/apache/lucene/lucene-core/4.10.4/lucene-core-4.10.4.jar:/Users/btiernay/.m2/repository/org/apache/lucene/lucene-analyzers-common/4.10.4/lucene-analyzers-common-4.10.4.jar:/Users/btiernay/.m2/repository/org/apache/lucene/lucene-queries/4.10.4/lucene-queries-4.10.4.jar:/Users/btiernay/.m2/repository/org/apache/lucene/lucene-memory/4.10.4/lucene-memory-4.10.4.jar:/Users/btiernay/.m2/repository/org/apache/lucene/lucene-highlighter/4.10.4/lucene-highlighter-4.10.4.jar:/Users/btiernay/.m2/repository/org/apache/lucene/lucene-queryparser/4.10.4/lucene-queryparser-4.10.4.jar:/Users/btiernay/.m2/repository/org/apache/lucene/lucene-sandbox/4.10.4/lucene-sandbox-4.10.4.jar:/Users/btiernay/.m2/repository/org/apache/lucene/lucene-suggest/4.10.4/lucene-suggest-4.10.4.jar:/Users/btiernay/.m2/repository/org/apache/lucene/lucene-misc/4.10.4/lucene-misc-4.10.4.jar:/Users/btiernay/.m2/repository/org/apache/lucene/lucene-join/4.10.4/lucene-join-4.10.4.jar:/Users/btiernay/.m2/repository/org/apache/lucene/lucene-grouping/4.10.4/lucene-grouping-4.10.4.jar:/Users/btiernay/.m2/repository/org/apache/lucene/lucene-spatial/4.10.4/lucene-spatial-4.10.4.jar:/Users/btiernay/.m2/repository/com/spatial4j/spatial4j/0.4.1/spatial4j-0.4.1.jar:/Users/btiernay/.m2/repository/org/antlr/antlr-runtime/3.5/antlr-runtime-3.5.jar:/Users/btiernay/.m2/repository/org/ow2/asm/asm/4.1/asm-4.1.jar:/Users/btiernay/.m2/repository/org/ow2/asm/asm-commons/4.1/asm-commons-4.1.jar:/Users/btiernay/.m2/repository/org/yaml/snakeyaml/1.12/snakeyaml-1.12.jar:/Users/btiernay/.m2/repository/org/projectlombok/lombok/1.16.20/lombok-1.16.20.jar:/Users/btiernay/.m2/repository/com/google/guava/guava/21.0/guava-21.0.jar:/Users/btiernay/.m2/repository/commons-beanutils/commons-beanutils/1.9.3/commons-beanutils-1.9.3.jar:/Users/btiernay/.m2/repository/commons-logging/commons-logging/1.2/commons-logging-1.2.jar:/Users/btiernay/.m2/repository/commons-collections/commons-collections/3.2.2/commons-collections-3.2.2.jar:/Users/btiernay/.m2/repository/com/opencsv/opencsv/3.7/opencsv-3.7.jar:/Users/btiernay/.m2/repository/org/apache/commons/commons-lang3/3.4/commons-lang3-3.4.jar:/Users/btiernay/.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar:/Users/btiernay/.m2/repository/ch/qos/logback/logback-core/1.2.3/logback-core-1.2.3.jar:/Users/btiernay/Workspaces/okta/sage/sage-common/target/test-classes:/Users/btiernay/.m2/repository/io/dropwizard/dropwizard-testing/1.3.0/dropwizard-testing-1.3.0.jar:/Users/btiernay/.m2/repository/org/objenesis/objenesis/2.6/objenesis-2.6.jar:/Users/btiernay/.m2/repository/org/glassfish/jersey/test-framework/providers/jersey-test-framework-provider-inmemory/2.25.1/jersey-test-framework-provider-inmemory-2.25.1.jar:/Users/btiernay/.m2/repository/org/glassfish/jersey/test-framework/jersey-test-framework-core/2.25.1/jersey-test-framework-core-2.25.1.jar:/Users/btiernay/.m2/repository/org/glassfish/jersey/core/jersey-client/2.25.1/jersey-client-2.25.1.jar:/Users/btiernay/.m2/repository/nl/jqno/equalsverifier/equalsverifier/2.4.2/equalsverifier-2.4.2.jar:/Users/btiernay/.m2/repository/com/google/code/findbugs/annotations/2.0.3/annotations-2.0.3.jar:/Users/btiernay/.m2/repository/org/junit/jupiter/junit-jupiter-engine/5.1.0/junit-jupiter-engine-5.1.0.jar:/Users/btiernay/.m2/repository/org/apiguardian/apiguardian-api/1.0.0/apiguardian-api-1.0.0.jar:/Users/btiernay/.m2/repository/org/junit/platform/junit-platform-engine/1.1.0/junit-platform-engine-1.1.0.jar:/Users/btiernay/.m2/repository/org/junit/platform/junit-platform-commons/1.1.0/junit-platform-commons-1.1.0.jar:/Users/btiernay/.m2/repository/org/opentest4j/opentest4j/1.0.0/opentest4j-1.0.0.jar:/Users/btiernay/.m2/repository/org/junit/jupiter/junit-jupiter-api/5.1.0/junit-jupiter-api-5.1.0.jar:/Users/btiernay/.m2/repository/org/junit/jupiter/junit-jupiter-params/5.1.0/junit-jupiter-params-5.1.0.jar:/Users/btiernay/.m2/repository/org/junit/vintage/junit-vintage-engine/5.1.0/junit-vintage-engine-5.1.0.jar:/Users/btiernay/.m2/repository/org/junit/platform/junit-platform-launcher/1.1.0/junit-platform-launcher-1.1.0.jar:/Users/btiernay/.m2/repository/junit/junit/4.12/junit-4.12.jar:/Users/btiernay/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar:/Users/btiernay/.m2/repository/org/assertj/assertj-core/3.9.0/assertj-core-3.9.0.jar:/Users/btiernay/.m2/repository/org/mockito/mockito-core/2.8.9/mockito-core-2.8.9.jar:/Users/btiernay/.m2/repository/net/bytebuddy/byte-buddy/1.6.14/byte-buddy-1.6.14.jar:/Users/btiernay/.m2/repository/net/bytebuddy/byte-buddy-agent/1.6.14/byte-buddy-agent-1.6.14.jar:/Users/btiernay/.m2/repository/net/javacrumbs/json-unit/json-unit/1.28.1/json-unit-1.28.1.jar:/Users/btiernay/.m2/repository/net/javacrumbs/json-unit/json-unit-core/1.28.1/json-unit-core-1.28.1.jar:/Users/btiernay/.m2/repository/net/javacrumbs/json-unit/json-unit-fluent/1.28.1/json-unit-fluent-1.28.1.jar" com.intellij.rt.execution.junit.JUnitStarter -ideVersion5 -junit5 com.okta.sage.logs.resources.request.ListResponseTest,testPersonDeserialization
objc[20654]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/bin/java (0x1045af4c0) and /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/libinstrument.dylib (0x10564e4e0). One of the two will be used. Which one is undefined.
2.9.3
2.9.4
debugData

com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of `com.okta.sage.logs.resources.request.ListResponseTest$Person` (no Creators, like default construct, exist): cannot deserialize from Object value (no delegate- or property-based Creator)
 at [Source: (String)"{"debugData":{"x":1}}"; line: 1, column: 2]

    at com.fasterxml.jackson.databind.exc.InvalidDefinitionException.from(InvalidDefinitionException.java:67)
    at com.fasterxml.jackson.databind.DeserializationContext.reportBadDefinition(DeserializationContext.java:1451)
    at com.fasterxml.jackson.databind.DeserializationContext.handleMissingInstantiator(DeserializationContext.java:1027)
    at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.deserializeFromObjectUsingNonDefault(BeanDeserializerBase.java:1275)
    at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:325)
    at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:159)
    at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4001)
    at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2992)
    at com.okta.sage.logs.resources.request.ListResponseTest.testPersonDeserialization(ListResponseTest.java:62)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:436)
    at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:115)
    at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$6(TestMethodTestDescriptor.java:170)
    at org.junit.jupiter.engine.execution.ThrowableCollector.execute(ThrowableCollector.java:40)
    at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:166)
    at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:113)
    at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:58)
    at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$3(HierarchicalTestExecutor.java:112)
    at org.junit.platform.engine.support.hierarchical.SingleTestExecutor.executeSafely(SingleTestExecutor.java:66)
    at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.executeRecursively(HierarchicalTestExecutor.java:108)
    at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.execute(HierarchicalTestExecutor.java:79)
    at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$2(HierarchicalTestExecutor.java:120)
    at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
    at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
    at java.util.Iterator.forEachRemaining(Iterator.java:116)
    at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
    at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
    at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
    at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$3(HierarchicalTestExecutor.java:120)
    at org.junit.platform.engine.support.hierarchical.SingleTestExecutor.executeSafely(SingleTestExecutor.java:66)
    at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.executeRecursively(HierarchicalTestExecutor.java:108)
    at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.execute(HierarchicalTestExecutor.java:79)
    at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$2(HierarchicalTestExecutor.java:120)
    at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
    at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
    at java.util.Iterator.forEachRemaining(Iterator.java:116)
    at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
    at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
    at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
    at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$3(HierarchicalTestExecutor.java:120)
    at org.junit.platform.engine.support.hierarchical.SingleTestExecutor.executeSafely(SingleTestExecutor.java:66)
    at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.executeRecursively(HierarchicalTestExecutor.java:108)
    at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.execute(HierarchicalTestExecutor.java:79)
    at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:55)
    at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:43)
    at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:170)
    at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:154)
    at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:90)
    at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:74)
    at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
    at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
    at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)

Seems like it doesn't like maps. Thoughts?

cowtowncoder commented 6 years ago

In this case the problem is that single-argument constructors are inherently ambiguous: without explicit annotations (mode of @JsonCreator; or, explicit argument name with @JsonProperty; or property-indicating @CreatorProperties) it is not possibly to determine intent -- as such Creator is probably not detected at all. With 2 arguments delegating option is not available so auto-detection possible.

Actually even in 1-argument case, detection can proceed with one condition: there is already a property with same name as creator parameter. So if you had a getter, detection would probably occur (or setter). But since private field is not visible with default settings.

I would personally just explicit annotate the creator in this case; either with @JsonCreator or naming the argument.

bobtiernay-okta commented 6 years ago

Thanks for the detailed breakdown. To give some context, I'm trying to see if Java 8 parameters can be used to solve this issue: https://github.com/rzwitserloot/lombok/issues/1563

But since a single argument constructor is ambiguous (to be honest, its still unclear as to why), then it seems like this approach cannot be used.

cowtowncoder commented 6 years ago

@bobtiernay-okta Single-argument case is fundamentally ambiguous, in general, because JSON Object case could, in general be mapped to either delegate type (which can take Object), or contain single property to map to named property. Deserializer does not know anything more about input (for example, how many properties does JSON Object have -- it's streaming, and only START_OBJECT observed at the point where decision made), or details of types that delegate/property deserializer accepts (both may in fact accept Objects).

As an example, we could have

public class Wrapper {
    public Wrapper(Map<String,Object> a) {
         // what does `a` actually get?
    }
}

given JSON

{ "a" : {
       "value" : 3
   }
}

and the question here is: should a, given contain {"a":{"value":3}} (delegating) or {"value":3} (property-based)? Which one is intended behavior.

So fundamentally I feel that my attempts at adding more heuristics have been counter-productive, and had I absolutely required annotation, never auto-detect, life might be easier for everyone.