From 5243f5ec36bf0f1644c987ebd1432ef8509f659d Mon Sep 17 00:00:00 2001 From: iamdanfox Date: Tue, 3 Jul 2018 14:37:48 +0100 Subject: [PATCH] Remove unnecessary @JsonUnwrapped constructor annotation (#26) Follow-up to https://github.com/palantir/conjure-java/pull/22 --- .../java/com/palantir/product/UnionTypeExample.java | 2 +- .../java/com/palantir/conjure/java/types/UnionGenerator.java | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/conjure-java-core/src/integrationInput/java/com/palantir/product/UnionTypeExample.java b/conjure-java-core/src/integrationInput/java/com/palantir/product/UnionTypeExample.java index 4e40bbcd7..56cffd4dd 100644 --- a/conjure-java-core/src/integrationInput/java/com/palantir/product/UnionTypeExample.java +++ b/conjure-java-core/src/integrationInput/java/com/palantir/product/UnionTypeExample.java @@ -26,7 +26,7 @@ public final class UnionTypeExample { @JsonUnwrapped private final Union union; @JsonCreator - private UnionTypeExample(@JsonUnwrapped Union union) { + private UnionTypeExample(Union union) { Objects.requireNonNull(union, "union must not be null"); this.union = union; } diff --git a/conjure-java-core/src/main/java/com/palantir/conjure/java/types/UnionGenerator.java b/conjure-java-core/src/main/java/com/palantir/conjure/java/types/UnionGenerator.java index 5cb28982d..3660e3650 100644 --- a/conjure-java-core/src/main/java/com/palantir/conjure/java/types/UnionGenerator.java +++ b/conjure-java-core/src/main/java/com/palantir/conjure/java/types/UnionGenerator.java @@ -138,9 +138,7 @@ private static MethodSpec generateConstructor(TypeMapper typeMapper, ClassName u return MethodSpec.constructorBuilder() .addModifiers(Modifier.PRIVATE) .addAnnotation(AnnotationSpec.builder(JsonCreator.class).build()) - .addParameter(ParameterSpec.builder(unionClass.nestedClass("Union"), UNION_FIELD_NAME) - .addAnnotation(JsonUnwrapped.class) - .build()) + .addParameter(ParameterSpec.builder(unionClass.nestedClass("Union"), UNION_FIELD_NAME).build()) .addStatement(Expressions.requireNonNull(UNION_FIELD_NAME, "union must not be null")) .addStatement("this.$1L = $1L", UNION_FIELD_NAME) .build();