From 8be4b0ffe6b5e5f89e8bb3d94e87d0aa98dc5aeb Mon Sep 17 00:00:00 2001 From: Jan Rieke Date: Sun, 16 Feb 2020 15:17:20 +0100 Subject: @Jacksonized: modify builders that they can be used by Jackson --- .../jackson/annotation/JsonIgnoreProperties.java | 12 +++++ .../databind/annotation/JsonDeserialize.java | 12 +++++ .../databind/annotation/JsonPOJOBuilder.java | 10 ++++ .../after-delombok/BuilderDefaultsWarnings.java | 3 ++ .../after-delombok/BuilderSingularNoAuto.java | 1 + .../BuilderSingularNoAutoWithSetterPrefix.java | 1 + .../after-delombok/JacksonizedBuilderComplex.java | 55 ++++++++++++++++++++++ .../after-delombok/JacksonizedBuilderSimple.java | 50 ++++++++++++++++++++ .../JacksonizedSuperBuilderSimple.java | 55 ++++++++++++++++++++++ ...JacksonizedSuperBuilderWithJsonDeserialize.java | 48 +++++++++++++++++++ .../after-ecj/JacksonizedBuilderComplex.java | 44 +++++++++++++++++ .../after-ecj/JacksonizedBuilderSimple.java | 38 +++++++++++++++ .../after-ecj/JacksonizedSuperBuilderSimple.java | 44 +++++++++++++++++ ...JacksonizedSuperBuilderWithJsonDeserialize.java | 36 ++++++++++++++ .../resource/before/JacksonizedBuilderComplex.java | 10 ++++ .../resource/before/JacksonizedBuilderSimple.java | 12 +++++ .../before/JacksonizedSuperBuilderSimple.java | 12 +++++ ...JacksonizedSuperBuilderWithJsonDeserialize.java | 6 +++ ...edSuperBuilderWithJsonDeserialize.java.messages | 1 + ...edSuperBuilderWithJsonDeserialize.java.messages | 1 + 20 files changed, 451 insertions(+) create mode 100644 test/stubs/com/fasterxml/jackson/annotation/JsonIgnoreProperties.java create mode 100644 test/stubs/com/fasterxml/jackson/databind/annotation/JsonDeserialize.java create mode 100644 test/stubs/com/fasterxml/jackson/databind/annotation/JsonPOJOBuilder.java create mode 100644 test/transform/resource/after-delombok/JacksonizedBuilderComplex.java create mode 100644 test/transform/resource/after-delombok/JacksonizedBuilderSimple.java create mode 100644 test/transform/resource/after-delombok/JacksonizedSuperBuilderSimple.java create mode 100644 test/transform/resource/after-delombok/JacksonizedSuperBuilderWithJsonDeserialize.java create mode 100644 test/transform/resource/after-ecj/JacksonizedBuilderComplex.java create mode 100644 test/transform/resource/after-ecj/JacksonizedBuilderSimple.java create mode 100644 test/transform/resource/after-ecj/JacksonizedSuperBuilderSimple.java create mode 100644 test/transform/resource/after-ecj/JacksonizedSuperBuilderWithJsonDeserialize.java create mode 100644 test/transform/resource/before/JacksonizedBuilderComplex.java create mode 100644 test/transform/resource/before/JacksonizedBuilderSimple.java create mode 100644 test/transform/resource/before/JacksonizedSuperBuilderSimple.java create mode 100644 test/transform/resource/before/JacksonizedSuperBuilderWithJsonDeserialize.java create mode 100644 test/transform/resource/messages-delombok/JacksonizedSuperBuilderWithJsonDeserialize.java.messages create mode 100644 test/transform/resource/messages-ecj/JacksonizedSuperBuilderWithJsonDeserialize.java.messages (limited to 'test') diff --git a/test/stubs/com/fasterxml/jackson/annotation/JsonIgnoreProperties.java b/test/stubs/com/fasterxml/jackson/annotation/JsonIgnoreProperties.java new file mode 100644 index 00000000..c90ef914 --- /dev/null +++ b/test/stubs/com/fasterxml/jackson/annotation/JsonIgnoreProperties.java @@ -0,0 +1,12 @@ +package com.fasterxml.jackson.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target({ElementType.ANNOTATION_TYPE, ElementType.TYPE, ElementType.METHOD, ElementType.FIELD}) +@Retention(RetentionPolicy.RUNTIME) +public @interface JsonIgnoreProperties { + public boolean ignoreUnknown() default false; +} diff --git a/test/stubs/com/fasterxml/jackson/databind/annotation/JsonDeserialize.java b/test/stubs/com/fasterxml/jackson/databind/annotation/JsonDeserialize.java new file mode 100644 index 00000000..0964f82c --- /dev/null +++ b/test/stubs/com/fasterxml/jackson/databind/annotation/JsonDeserialize.java @@ -0,0 +1,12 @@ +package com.fasterxml.jackson.databind.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target({ElementType.ANNOTATION_TYPE, ElementType.METHOD, ElementType.FIELD, ElementType.TYPE, ElementType.PARAMETER}) +@Retention(RetentionPolicy.RUNTIME) +public @interface JsonDeserialize { + public Class builder() default Void.class; +} diff --git a/test/stubs/com/fasterxml/jackson/databind/annotation/JsonPOJOBuilder.java b/test/stubs/com/fasterxml/jackson/databind/annotation/JsonPOJOBuilder.java new file mode 100644 index 00000000..4906dc58 --- /dev/null +++ b/test/stubs/com/fasterxml/jackson/databind/annotation/JsonPOJOBuilder.java @@ -0,0 +1,10 @@ +package com.fasterxml.jackson.databind.annotation; + +import java.lang.annotation.*; + +@Target({ElementType.ANNOTATION_TYPE, ElementType.TYPE}) +@Retention(RetentionPolicy.RUNTIME) +public @interface JsonPOJOBuilder { + public String buildMethodName() default "build"; + public String withPrefix() default "with"; +} diff --git a/test/transform/resource/after-delombok/BuilderDefaultsWarnings.java b/test/transform/resource/after-delombok/BuilderDefaultsWarnings.java index 3c84c71b..ae865570 100644 --- a/test/transform/resource/after-delombok/BuilderDefaultsWarnings.java +++ b/test/transform/resource/after-delombok/BuilderDefaultsWarnings.java @@ -1,3 +1,5 @@ +import lombok.Builder; +@Builder public class BuilderDefaultsWarnings { long x = System.currentTimeMillis(); final int y = 5; @@ -78,6 +80,7 @@ public class BuilderDefaultsWarnings { } class NoBuilderButHasDefaults { private final long z = 5; + @Builder public NoBuilderButHasDefaults() { } @java.lang.SuppressWarnings("all") diff --git a/test/transform/resource/after-delombok/BuilderSingularNoAuto.java b/test/transform/resource/after-delombok/BuilderSingularNoAuto.java index ba6ddc52..4c9de174 100644 --- a/test/transform/resource/after-delombok/BuilderSingularNoAuto.java +++ b/test/transform/resource/after-delombok/BuilderSingularNoAuto.java @@ -1,4 +1,5 @@ import java.util.List; +@lombok.Builder class BuilderSingularNoAuto { private List things; private List widgets; diff --git a/test/transform/resource/after-delombok/BuilderSingularNoAutoWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderSingularNoAutoWithSetterPrefix.java index 857348d3..48b396eb 100644 --- a/test/transform/resource/after-delombok/BuilderSingularNoAutoWithSetterPrefix.java +++ b/test/transform/resource/after-delombok/BuilderSingularNoAutoWithSetterPrefix.java @@ -1,4 +1,5 @@ import java.util.List; +@lombok.Builder(setterPrefix = "with") class BuilderSingularNoAutoWithSetterPrefix { private List things; private List widgets; diff --git a/test/transform/resource/after-delombok/JacksonizedBuilderComplex.java b/test/transform/resource/after-delombok/JacksonizedBuilderComplex.java new file mode 100644 index 00000000..30f6b9af --- /dev/null +++ b/test/transform/resource/after-delombok/JacksonizedBuilderComplex.java @@ -0,0 +1,55 @@ +//CONF: lombok.builder.className = Test*Name +import java.util.List; +@com.fasterxml.jackson.databind.annotation.JsonDeserialize(builder = JacksonizedBuilderComplex.TestVoidName.class) +class JacksonizedBuilderComplex { + private static void testVoidWithGenerics(T number, int arg2, String arg3, JacksonizedBuilderComplex selfRef) { + } + @java.lang.SuppressWarnings("all") + @com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder(withPrefix = "with", buildMethodName = "execute") + public static class TestVoidName { + @java.lang.SuppressWarnings("all") + private T number; + @java.lang.SuppressWarnings("all") + private int arg2; + @java.lang.SuppressWarnings("all") + private String arg3; + @java.lang.SuppressWarnings("all") + private JacksonizedBuilderComplex selfRef; + @java.lang.SuppressWarnings("all") + TestVoidName() { + } + @java.lang.SuppressWarnings("all") + public JacksonizedBuilderComplex.TestVoidName withNumber(final T number) { + this.number = number; + return this; + } + @java.lang.SuppressWarnings("all") + public JacksonizedBuilderComplex.TestVoidName withArg2(final int arg2) { + this.arg2 = arg2; + return this; + } + @java.lang.SuppressWarnings("all") + public JacksonizedBuilderComplex.TestVoidName withArg3(final String arg3) { + this.arg3 = arg3; + return this; + } + @java.lang.SuppressWarnings("all") + public JacksonizedBuilderComplex.TestVoidName withSelfRef(final JacksonizedBuilderComplex selfRef) { + this.selfRef = selfRef; + return this; + } + @java.lang.SuppressWarnings("all") + public void execute() { + JacksonizedBuilderComplex.testVoidWithGenerics(this.number, this.arg2, this.arg3, this.selfRef); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "JacksonizedBuilderComplex.TestVoidName(number=" + this.number + ", arg2=" + this.arg2 + ", arg3=" + this.arg3 + ", selfRef=" + this.selfRef + ")"; + } + } + @java.lang.SuppressWarnings("all") + public static JacksonizedBuilderComplex.TestVoidName builder() { + return new JacksonizedBuilderComplex.TestVoidName(); + } +} \ No newline at end of file diff --git a/test/transform/resource/after-delombok/JacksonizedBuilderSimple.java b/test/transform/resource/after-delombok/JacksonizedBuilderSimple.java new file mode 100644 index 00000000..bd79df90 --- /dev/null +++ b/test/transform/resource/after-delombok/JacksonizedBuilderSimple.java @@ -0,0 +1,50 @@ +import java.util.List; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +@JsonIgnoreProperties(ignoreUnknown = true) +@com.fasterxml.jackson.databind.annotation.JsonDeserialize(builder = JacksonizedBuilderSimple.JacksonizedBuilderSimpleBuilder.class) +class JacksonizedBuilderSimple { + private final int noshow = 0; + private final int yes; + private List also; + private int $butNotMe; + @java.lang.SuppressWarnings("all") + JacksonizedBuilderSimple(final int yes, final List also) { + this.yes = yes; + this.also = also; + } + @java.lang.SuppressWarnings("all") + @JsonIgnoreProperties(ignoreUnknown = true) + @com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder(withPrefix = "", buildMethodName = "build") + protected static class JacksonizedBuilderSimpleBuilder { + @java.lang.SuppressWarnings("all") + private int yes; + @java.lang.SuppressWarnings("all") + private List also; + @java.lang.SuppressWarnings("all") + JacksonizedBuilderSimpleBuilder() { + } + @java.lang.SuppressWarnings("all") + public JacksonizedBuilderSimple.JacksonizedBuilderSimpleBuilder yes(final int yes) { + this.yes = yes; + return this; + } + @java.lang.SuppressWarnings("all") + public JacksonizedBuilderSimple.JacksonizedBuilderSimpleBuilder also(final List also) { + this.also = also; + return this; + } + @java.lang.SuppressWarnings("all") + public JacksonizedBuilderSimple build() { + return new JacksonizedBuilderSimple(this.yes, this.also); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "JacksonizedBuilderSimple.JacksonizedBuilderSimpleBuilder(yes=" + this.yes + ", also=" + this.also + ")"; + } + } + @java.lang.SuppressWarnings("all") + protected static JacksonizedBuilderSimple.JacksonizedBuilderSimpleBuilder builder() { + return new JacksonizedBuilderSimple.JacksonizedBuilderSimpleBuilder(); + } +} diff --git a/test/transform/resource/after-delombok/JacksonizedSuperBuilderSimple.java b/test/transform/resource/after-delombok/JacksonizedSuperBuilderSimple.java new file mode 100644 index 00000000..7fd3f8dc --- /dev/null +++ b/test/transform/resource/after-delombok/JacksonizedSuperBuilderSimple.java @@ -0,0 +1,55 @@ +public class JacksonizedSuperBuilderSimple { + @com.fasterxml.jackson.annotation.JsonIgnoreProperties(ignoreUnknown = true) + @com.fasterxml.jackson.databind.annotation.JsonDeserialize(builder = JacksonizedSuperBuilderSimple.Parent.ParentBuilderImpl.class) + public static class Parent { + int field1; + @java.lang.SuppressWarnings("all") + public static abstract class ParentBuilder> { + @java.lang.SuppressWarnings("all") + private int field1; + @java.lang.SuppressWarnings("all") + protected abstract B self(); + @java.lang.SuppressWarnings("all") + public abstract C build(); + @java.lang.SuppressWarnings("all") + public B field1(final int field1) { + this.field1 = field1; + return self(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "JacksonizedSuperBuilderSimple.Parent.ParentBuilder(field1=" + this.field1 + ")"; + } + } + @java.lang.SuppressWarnings("all") + @com.fasterxml.jackson.annotation.JsonIgnoreProperties(ignoreUnknown = true) + @com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder(withPrefix = "", buildMethodName = "build") + static final class ParentBuilderImpl extends JacksonizedSuperBuilderSimple.Parent.ParentBuilder { + @java.lang.SuppressWarnings("all") + private ParentBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected JacksonizedSuperBuilderSimple.Parent.ParentBuilderImpl self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public JacksonizedSuperBuilderSimple.Parent build() { + return new JacksonizedSuperBuilderSimple.Parent(this); + } + } + @java.lang.SuppressWarnings("all") + protected Parent(final JacksonizedSuperBuilderSimple.Parent.ParentBuilder b) { + this.field1 = b.field1; + } + @java.lang.SuppressWarnings("all") + public static JacksonizedSuperBuilderSimple.Parent.ParentBuilder builder() { + return new JacksonizedSuperBuilderSimple.Parent.ParentBuilderImpl(); + } + } + public static void test() { + Parent x = Parent.builder().field1(5).build(); + } +} diff --git a/test/transform/resource/after-delombok/JacksonizedSuperBuilderWithJsonDeserialize.java b/test/transform/resource/after-delombok/JacksonizedSuperBuilderWithJsonDeserialize.java new file mode 100644 index 00000000..df52db33 --- /dev/null +++ b/test/transform/resource/after-delombok/JacksonizedSuperBuilderWithJsonDeserialize.java @@ -0,0 +1,48 @@ +@lombok.experimental.SuperBuilder +@com.fasterxml.jackson.databind.annotation.JsonDeserialize +public class JacksonizedSuperBuilderWithJsonDeserialize { + int field1; + @java.lang.SuppressWarnings("all") + public static abstract class JacksonizedSuperBuilderWithJsonDeserializeBuilder> { + @java.lang.SuppressWarnings("all") + private int field1; + @java.lang.SuppressWarnings("all") + protected abstract B self(); + @java.lang.SuppressWarnings("all") + public abstract C build(); + @java.lang.SuppressWarnings("all") + public B field1(final int field1) { + this.field1 = field1; + return self(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "JacksonizedSuperBuilderWithJsonDeserialize.JacksonizedSuperBuilderWithJsonDeserializeBuilder(field1=" + this.field1 + ")"; + } + } + @java.lang.SuppressWarnings("all") + private static final class JacksonizedSuperBuilderWithJsonDeserializeBuilderImpl extends JacksonizedSuperBuilderWithJsonDeserialize.JacksonizedSuperBuilderWithJsonDeserializeBuilder { + @java.lang.SuppressWarnings("all") + private JacksonizedSuperBuilderWithJsonDeserializeBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected JacksonizedSuperBuilderWithJsonDeserialize.JacksonizedSuperBuilderWithJsonDeserializeBuilderImpl self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public JacksonizedSuperBuilderWithJsonDeserialize build() { + return new JacksonizedSuperBuilderWithJsonDeserialize(this); + } + } + @java.lang.SuppressWarnings("all") + protected JacksonizedSuperBuilderWithJsonDeserialize(final JacksonizedSuperBuilderWithJsonDeserialize.JacksonizedSuperBuilderWithJsonDeserializeBuilder b) { + this.field1 = b.field1; + } + @java.lang.SuppressWarnings("all") + public static JacksonizedSuperBuilderWithJsonDeserialize.JacksonizedSuperBuilderWithJsonDeserializeBuilder builder() { + return new JacksonizedSuperBuilderWithJsonDeserialize.JacksonizedSuperBuilderWithJsonDeserializeBuilderImpl(); + } +} \ No newline at end of file diff --git a/test/transform/resource/after-ecj/JacksonizedBuilderComplex.java b/test/transform/resource/after-ecj/JacksonizedBuilderComplex.java new file mode 100644 index 00000000..8a06b34b --- /dev/null +++ b/test/transform/resource/after-ecj/JacksonizedBuilderComplex.java @@ -0,0 +1,44 @@ +import java.util.List; +import lombok.Builder; +import lombok.extern.jackson.Jacksonized; +@com.fasterxml.jackson.databind.annotation.JsonDeserialize(builder = JacksonizedBuilderComplex.TestVoidName.class) class JacksonizedBuilderComplex { + public static @java.lang.SuppressWarnings("all") @com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder(withPrefix = "with",buildMethodName = "execute") class TestVoidName { + private @java.lang.SuppressWarnings("all") T number; + private @java.lang.SuppressWarnings("all") int arg2; + private @java.lang.SuppressWarnings("all") String arg3; + private @java.lang.SuppressWarnings("all") JacksonizedBuilderComplex selfRef; + @java.lang.SuppressWarnings("all") TestVoidName() { + super(); + } + public @java.lang.SuppressWarnings("all") JacksonizedBuilderComplex.TestVoidName withNumber(final T number) { + this.number = number; + return this; + } + public @java.lang.SuppressWarnings("all") JacksonizedBuilderComplex.TestVoidName withArg2(final int arg2) { + this.arg2 = arg2; + return this; + } + public @java.lang.SuppressWarnings("all") JacksonizedBuilderComplex.TestVoidName withArg3(final String arg3) { + this.arg3 = arg3; + return this; + } + public @java.lang.SuppressWarnings("all") JacksonizedBuilderComplex.TestVoidName withSelfRef(final JacksonizedBuilderComplex selfRef) { + this.selfRef = selfRef; + return this; + } + public @java.lang.SuppressWarnings("all") void execute() { + JacksonizedBuilderComplex.testVoidWithGenerics(this.number, this.arg2, this.arg3, this.selfRef); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((((((("JacksonizedBuilderComplex.TestVoidName(number=" + this.number) + ", arg2=") + this.arg2) + ", arg3=") + this.arg3) + ", selfRef=") + this.selfRef) + ")"); + } + } + JacksonizedBuilderComplex() { + super(); + } + private static @Jacksonized @Builder(buildMethodName = "execute",setterPrefix = "with") void testVoidWithGenerics(T number, int arg2, String arg3, JacksonizedBuilderComplex selfRef) { + } + public static @java.lang.SuppressWarnings("all") JacksonizedBuilderComplex.TestVoidName builder() { + return new JacksonizedBuilderComplex.TestVoidName(); + } +} diff --git a/test/transform/resource/after-ecj/JacksonizedBuilderSimple.java b/test/transform/resource/after-ecj/JacksonizedBuilderSimple.java new file mode 100644 index 00000000..2e0a4e0c --- /dev/null +++ b/test/transform/resource/after-ecj/JacksonizedBuilderSimple.java @@ -0,0 +1,38 @@ +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +@lombok.extern.jackson.Jacksonized @JsonIgnoreProperties(ignoreUnknown = true) @lombok.Builder(access = lombok.AccessLevel.PROTECTED) @com.fasterxml.jackson.databind.annotation.JsonDeserialize(builder = JacksonizedBuilderSimple.JacksonizedBuilderSimpleBuilder.class) class JacksonizedBuilderSimple { + protected static @java.lang.SuppressWarnings("all") @JsonIgnoreProperties(ignoreUnknown = true) @com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder(withPrefix = "",buildMethodName = "build") class JacksonizedBuilderSimpleBuilder { + private @java.lang.SuppressWarnings("all") int yes; + private @java.lang.SuppressWarnings("all") List also; + @java.lang.SuppressWarnings("all") JacksonizedBuilderSimpleBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") JacksonizedBuilderSimple.JacksonizedBuilderSimpleBuilder yes(final int yes) { + this.yes = yes; + return this; + } + public @java.lang.SuppressWarnings("all") JacksonizedBuilderSimple.JacksonizedBuilderSimpleBuilder also(final List also) { + this.also = also; + return this; + } + public @java.lang.SuppressWarnings("all") JacksonizedBuilderSimple build() { + return new JacksonizedBuilderSimple(this.yes, this.also); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("JacksonizedBuilderSimple.JacksonizedBuilderSimpleBuilder(yes=" + this.yes) + ", also=") + this.also) + ")"); + } + } + private final int noshow = 0; + private final int yes; + private List also; + private int $butNotMe; + @java.lang.SuppressWarnings("all") JacksonizedBuilderSimple(final int yes, final List also) { + super(); + this.yes = yes; + this.also = also; + } + protected static @java.lang.SuppressWarnings("all") JacksonizedBuilderSimple.JacksonizedBuilderSimpleBuilder builder() { + return new JacksonizedBuilderSimple.JacksonizedBuilderSimpleBuilder(); + } +} diff --git a/test/transform/resource/after-ecj/JacksonizedSuperBuilderSimple.java b/test/transform/resource/after-ecj/JacksonizedSuperBuilderSimple.java new file mode 100644 index 00000000..8227162a --- /dev/null +++ b/test/transform/resource/after-ecj/JacksonizedSuperBuilderSimple.java @@ -0,0 +1,44 @@ +public class JacksonizedSuperBuilderSimple { + public static @lombok.extern.jackson.Jacksonized @lombok.experimental.SuperBuilder @com.fasterxml.jackson.annotation.JsonIgnoreProperties(ignoreUnknown = true) @com.fasterxml.jackson.databind.annotation.JsonDeserialize(builder = JacksonizedSuperBuilderSimple.Parent.ParentBuilderImpl.class) class Parent { + public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder> { + private @java.lang.SuppressWarnings("all") int field1; + public ParentBuilder() { + super(); + } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); + public @java.lang.SuppressWarnings("all") B field1(final int field1) { + this.field1 = field1; + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("JacksonizedSuperBuilderSimple.Parent.ParentBuilder(field1=" + this.field1) + ")"); + } + } + static final @java.lang.SuppressWarnings("all") @com.fasterxml.jackson.annotation.JsonIgnoreProperties(ignoreUnknown = true) @com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder(withPrefix = "",buildMethodName = "build") class ParentBuilderImpl extends JacksonizedSuperBuilderSimple.Parent.ParentBuilder { + private ParentBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") JacksonizedSuperBuilderSimple.Parent.ParentBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") JacksonizedSuperBuilderSimple.Parent build() { + return new JacksonizedSuperBuilderSimple.Parent(this); + } + } + int field1; + protected @java.lang.SuppressWarnings("all") Parent(final JacksonizedSuperBuilderSimple.Parent.ParentBuilder b) { + super(); + this.field1 = b.field1; + } + public static @java.lang.SuppressWarnings("all") JacksonizedSuperBuilderSimple.Parent.ParentBuilder builder() { + return new JacksonizedSuperBuilderSimple.Parent.ParentBuilderImpl(); + } + } + public JacksonizedSuperBuilderSimple() { + super(); + } + public static void test() { + Parent x = Parent.builder().field1(5).build(); + } +} \ No newline at end of file diff --git a/test/transform/resource/after-ecj/JacksonizedSuperBuilderWithJsonDeserialize.java b/test/transform/resource/after-ecj/JacksonizedSuperBuilderWithJsonDeserialize.java new file mode 100644 index 00000000..a5677275 --- /dev/null +++ b/test/transform/resource/after-ecj/JacksonizedSuperBuilderWithJsonDeserialize.java @@ -0,0 +1,36 @@ +public @lombok.extern.jackson.Jacksonized @lombok.experimental.SuperBuilder @com.fasterxml.jackson.databind.annotation.JsonDeserialize class JacksonizedSuperBuilderWithJsonDeserialize { + public static abstract @java.lang.SuppressWarnings("all") class JacksonizedSuperBuilderWithJsonDeserializeBuilder> { + private @java.lang.SuppressWarnings("all") int field1; + public JacksonizedSuperBuilderWithJsonDeserializeBuilder() { + super(); + } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); + public @java.lang.SuppressWarnings("all") B field1(final int field1) { + this.field1 = field1; + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("JacksonizedSuperBuilderWithJsonDeserialize.JacksonizedSuperBuilderWithJsonDeserializeBuilder(field1=" + this.field1) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class JacksonizedSuperBuilderWithJsonDeserializeBuilderImpl extends JacksonizedSuperBuilderWithJsonDeserialize.JacksonizedSuperBuilderWithJsonDeserializeBuilder { + private JacksonizedSuperBuilderWithJsonDeserializeBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") JacksonizedSuperBuilderWithJsonDeserialize.JacksonizedSuperBuilderWithJsonDeserializeBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") JacksonizedSuperBuilderWithJsonDeserialize build() { + return new JacksonizedSuperBuilderWithJsonDeserialize(this); + } + } + int field1; + protected @java.lang.SuppressWarnings("all") JacksonizedSuperBuilderWithJsonDeserialize(final JacksonizedSuperBuilderWithJsonDeserialize.JacksonizedSuperBuilderWithJsonDeserializeBuilder b) { + super(); + this.field1 = b.field1; + } + public static @java.lang.SuppressWarnings("all") JacksonizedSuperBuilderWithJsonDeserialize.JacksonizedSuperBuilderWithJsonDeserializeBuilder builder() { + return new JacksonizedSuperBuilderWithJsonDeserialize.JacksonizedSuperBuilderWithJsonDeserializeBuilderImpl(); + } +} \ No newline at end of file diff --git a/test/transform/resource/before/JacksonizedBuilderComplex.java b/test/transform/resource/before/JacksonizedBuilderComplex.java new file mode 100644 index 00000000..dec1cd3b --- /dev/null +++ b/test/transform/resource/before/JacksonizedBuilderComplex.java @@ -0,0 +1,10 @@ +//CONF: lombok.builder.className = Test*Name +import java.util.List; +import lombok.Builder; +import lombok.extern.jackson.Jacksonized; + +class JacksonizedBuilderComplex { + @Jacksonized + @Builder(buildMethodName = "execute", setterPrefix = "with") + private static void testVoidWithGenerics(T number, int arg2, String arg3, JacksonizedBuilderComplex selfRef) {} +} diff --git a/test/transform/resource/before/JacksonizedBuilderSimple.java b/test/transform/resource/before/JacksonizedBuilderSimple.java new file mode 100644 index 00000000..6da015ec --- /dev/null +++ b/test/transform/resource/before/JacksonizedBuilderSimple.java @@ -0,0 +1,12 @@ +import java.util.List; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; + +@lombok.extern.jackson.Jacksonized +@JsonIgnoreProperties(ignoreUnknown = true) +@lombok.Builder(access = lombok.AccessLevel.PROTECTED) +class JacksonizedBuilderSimple { + private final int noshow = 0; + private final int yes; + private List also; + private int $butNotMe; +} diff --git a/test/transform/resource/before/JacksonizedSuperBuilderSimple.java b/test/transform/resource/before/JacksonizedSuperBuilderSimple.java new file mode 100644 index 00000000..1e3bd0fc --- /dev/null +++ b/test/transform/resource/before/JacksonizedSuperBuilderSimple.java @@ -0,0 +1,12 @@ +public class JacksonizedSuperBuilderSimple { + @lombok.extern.jackson.Jacksonized + @lombok.experimental.SuperBuilder + @com.fasterxml.jackson.annotation.JsonIgnoreProperties(ignoreUnknown = true) + public static class Parent { + int field1; + } + + public static void test() { + Parent x = Parent.builder().field1(5).build(); + } +} diff --git a/test/transform/resource/before/JacksonizedSuperBuilderWithJsonDeserialize.java b/test/transform/resource/before/JacksonizedSuperBuilderWithJsonDeserialize.java new file mode 100644 index 00000000..0c80d1a6 --- /dev/null +++ b/test/transform/resource/before/JacksonizedSuperBuilderWithJsonDeserialize.java @@ -0,0 +1,6 @@ +@lombok.extern.jackson.Jacksonized +@lombok.experimental.SuperBuilder +@com.fasterxml.jackson.databind.annotation.JsonDeserialize +public class JacksonizedSuperBuilderWithJsonDeserialize { + int field1; +} diff --git a/test/transform/resource/messages-delombok/JacksonizedSuperBuilderWithJsonDeserialize.java.messages b/test/transform/resource/messages-delombok/JacksonizedSuperBuilderWithJsonDeserialize.java.messages new file mode 100644 index 00000000..5c69304f --- /dev/null +++ b/test/transform/resource/messages-delombok/JacksonizedSuperBuilderWithJsonDeserialize.java.messages @@ -0,0 +1 @@ +1 @JsonDeserialize already exists on class. Either delete @JsonDeserialize, or remove @Jacksonized and manually configure Jackson. \ No newline at end of file diff --git a/test/transform/resource/messages-ecj/JacksonizedSuperBuilderWithJsonDeserialize.java.messages b/test/transform/resource/messages-ecj/JacksonizedSuperBuilderWithJsonDeserialize.java.messages new file mode 100644 index 00000000..5c69304f --- /dev/null +++ b/test/transform/resource/messages-ecj/JacksonizedSuperBuilderWithJsonDeserialize.java.messages @@ -0,0 +1 @@ +1 @JsonDeserialize already exists on class. Either delete @JsonDeserialize, or remove @Jacksonized and manually configure Jackson. \ No newline at end of file -- cgit