Merge pull request #4024 from ralemanc/master

Fix Jacksonized stops generating JsonProperty/JsonIgnore after first manual annotation (fluent=true)
This commit is contained in:
Reinier Zwitserloot authored and GitHub committed 2026-04-21 22:35:38 +02:00
commit b68af6e415
7 files changed
+155 -8

No files matched your search

+1
View File
@@ -47,6 +47,7 @@ Philipp Eichhorn <peichhor@web.de>
Philippe Charles <philippe.charles@nbb.be>
Pim van der Loos <pimvanderloos@gmail.com>
Rabea Gransberger <rgra@users.noreply.github.com>
Rafael Alemañ Cabrera <2362816+ralemanc@users.noreply.github.com>
Raul Wißfeld <Rawi01@users.noreply.github.com>
Reinier Zwitserloot <reinier@zwitserloot.com>
Rob Stryker <rob@oxbeef.net>
@@ -193,10 +193,11 @@ public class HandleJacksonized extends EclipseAnnotationHandler<Jacksonized> {
// Add @JsonProperty to all fields. It will be automatically copied to the getter/setters later.
for (EclipseNode eclipseNode : tdNode.down()) {
if (eclipseNode.getKind() == Kind.FIELD) {
if (hasAnnotation(eclipseNode, JacksonAnnotationType.JSON_PROPERTY2) ||
if (hasAnnotation(eclipseNode, JacksonAnnotationType.JSON_PROPERTY2) ||
hasAnnotation(eclipseNode, JacksonAnnotationType.JSON_IGNORE2)) {
return;
} else if (eclipseNode.isTransient()) {
continue;
}
if (eclipseNode.isTransient()) {
createJsonIgnoreForField(eclipseNode, annotationNode);
} else {
createJsonPropertyForField(eclipseNode, annotationNode);
@@ -118,9 +118,9 @@ public class HandleJacksonized extends JavacAnnotationHandler<Jacksonized> {
if (javacNode.getKind() == Kind.FIELD) {
if (hasAnnotation(javacNode, JacksonAnnotationType.JSON_PROPERTY2) ||
hasAnnotation(javacNode, JacksonAnnotationType.JSON_IGNORE2)) {
return;
} else if (javacNode.isTransient()) {
continue;
}
if (javacNode.isTransient()) {
createJsonIgnoreForField(javacNode, annotationNode);
} else {
createJsonPropertyForField(javacNode, annotationNode);
@@ -0,0 +1,82 @@
import com.fasterxml.jackson.annotation.JsonProperty;
@com.fasterxml.jackson.databind.annotation.JsonDeserialize(builder = JacksonizedBuilderFluent.JacksonizedBuilderFluentBuilder.class)
@tools.jackson.databind.annotation.JsonDeserialize(builder = JacksonizedBuilderFluent.JacksonizedBuilderFluentBuilder.class)
public class JacksonizedBuilderFluent {
@com.fasterxml.jackson.annotation.JsonProperty("fieldName1")
private String fieldName1;
@JsonProperty("FieldName2")
private String fieldName2;
@com.fasterxml.jackson.annotation.JsonProperty("fieldName3")
private String fieldName3;
@java.lang.SuppressWarnings("all")
@lombok.Generated
JacksonizedBuilderFluent(final String fieldName1, final String fieldName2, final String fieldName3) {
this.fieldName1 = fieldName1;
this.fieldName2 = fieldName2;
this.fieldName3 = fieldName3;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
@com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder(withPrefix = "", buildMethodName = "build")
@tools.jackson.databind.annotation.JsonPOJOBuilder(withPrefix = "", buildMethodName = "build")
public static class JacksonizedBuilderFluentBuilder {
@java.lang.SuppressWarnings("all")
@lombok.Generated
private String fieldName1;
@java.lang.SuppressWarnings("all")
@lombok.Generated
private String fieldName2;
@java.lang.SuppressWarnings("all")
@lombok.Generated
private String fieldName3;
@java.lang.SuppressWarnings("all")
@lombok.Generated
JacksonizedBuilderFluentBuilder() {
}
/**
* @return {@code this}.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public JacksonizedBuilderFluent.JacksonizedBuilderFluentBuilder fieldName1(final String fieldName1) {
this.fieldName1 = fieldName1;
return this;
}
/**
* @return {@code this}.
*/
@JsonProperty("FieldName2")
@java.lang.SuppressWarnings("all")
@lombok.Generated
public JacksonizedBuilderFluent.JacksonizedBuilderFluentBuilder fieldName2(final String fieldName2) {
this.fieldName2 = fieldName2;
return this;
}
/**
* @return {@code this}.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public JacksonizedBuilderFluent.JacksonizedBuilderFluentBuilder fieldName3(final String fieldName3) {
this.fieldName3 = fieldName3;
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public JacksonizedBuilderFluent build() {
return new JacksonizedBuilderFluent(this.fieldName1, this.fieldName2, this.fieldName3);
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
@lombok.Generated
public java.lang.String toString() {
return "JacksonizedBuilderFluent.JacksonizedBuilderFluentBuilder(fieldName1=" + this.fieldName1 + ", fieldName2=" + this.fieldName2 + ", fieldName3=" + this.fieldName3 + ")";
}
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public static JacksonizedBuilderFluent.JacksonizedBuilderFluentBuilder builder() {
return new JacksonizedBuilderFluent.JacksonizedBuilderFluentBuilder();
}
}
@@ -5,7 +5,7 @@ public @lombok.extern.jackson.Jacksonized @lombok.experimental.Accessors(fluent
public JacksonizedAccessorsTransient() {
super();
}
public @java.lang.SuppressWarnings("all") @lombok.Generated int intValue() {
public @com.fasterxml.jackson.annotation.JsonIgnore @java.lang.SuppressWarnings("all") @lombok.Generated int intValue() {
return this.intValue;
}
public @com.fasterxml.jackson.annotation.JsonIgnore @java.lang.SuppressWarnings("all") @lombok.Generated long longValue() {
@@ -17,7 +17,7 @@ public @lombok.extern.jackson.Jacksonized @lombok.experimental.Accessors(fluent
/**
* @return {@code this}.
*/
public @java.lang.SuppressWarnings("all") @lombok.Generated JacksonizedAccessorsTransient intValue(final int intValue) {
public @com.fasterxml.jackson.annotation.JsonIgnore @java.lang.SuppressWarnings("all") @lombok.Generated JacksonizedAccessorsTransient intValue(final int intValue) {
this.intValue = intValue;
return this;
}
@@ -0,0 +1,50 @@
import com.fasterxml.jackson.annotation.JsonProperty;
public @lombok.extern.jackson.Jacksonized @lombok.experimental.Accessors(fluent = true) @lombok.Builder @com.fasterxml.jackson.databind.annotation.JsonDeserialize(builder = JacksonizedBuilderFluent.JacksonizedBuilderFluentBuilder.class) @tools.jackson.databind.annotation.JsonDeserialize(builder = JacksonizedBuilderFluent.JacksonizedBuilderFluentBuilder.class) class JacksonizedBuilderFluent {
public static @java.lang.SuppressWarnings("all") @lombok.Generated @com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder(withPrefix = "",buildMethodName = "build") @tools.jackson.databind.annotation.JsonPOJOBuilder(withPrefix = "",buildMethodName = "build") class JacksonizedBuilderFluentBuilder {
private @java.lang.SuppressWarnings("all") @lombok.Generated String fieldName1;
private @java.lang.SuppressWarnings("all") @lombok.Generated String fieldName2;
private @java.lang.SuppressWarnings("all") @lombok.Generated String fieldName3;
@java.lang.SuppressWarnings("all") @lombok.Generated JacksonizedBuilderFluentBuilder() {
super();
}
/**
* @return {@code this}.
*/
public @java.lang.SuppressWarnings("all") @lombok.Generated JacksonizedBuilderFluent.JacksonizedBuilderFluentBuilder fieldName1(final String fieldName1) {
this.fieldName1 = fieldName1;
return this;
}
/**
* @return {@code this}.
*/
public @JsonProperty("FieldName2") @java.lang.SuppressWarnings("all") @lombok.Generated JacksonizedBuilderFluent.JacksonizedBuilderFluentBuilder fieldName2(final String fieldName2) {
this.fieldName2 = fieldName2;
return this;
}
/**
* @return {@code this}.
*/
public @java.lang.SuppressWarnings("all") @lombok.Generated JacksonizedBuilderFluent.JacksonizedBuilderFluentBuilder fieldName3(final String fieldName3) {
this.fieldName3 = fieldName3;
return this;
}
public @java.lang.SuppressWarnings("all") @lombok.Generated JacksonizedBuilderFluent build() {
return new JacksonizedBuilderFluent(this.fieldName1, this.fieldName2, this.fieldName3);
}
public @java.lang.Override @java.lang.SuppressWarnings("all") @lombok.Generated java.lang.String toString() {
return (((((("JacksonizedBuilderFluent.JacksonizedBuilderFluentBuilder(fieldName1=" + this.fieldName1) + ", fieldName2=") + this.fieldName2) + ", fieldName3=") + this.fieldName3) + ")");
}
}
private @com.fasterxml.jackson.annotation.JsonProperty("fieldName1") String fieldName1;
private @JsonProperty("FieldName2") String fieldName2;
private @com.fasterxml.jackson.annotation.JsonProperty("fieldName3") String fieldName3;
@java.lang.SuppressWarnings("all") @lombok.Generated JacksonizedBuilderFluent(final String fieldName1, final String fieldName2, final String fieldName3) {
super();
this.fieldName1 = fieldName1;
this.fieldName2 = fieldName2;
this.fieldName3 = fieldName3;
}
public static @java.lang.SuppressWarnings("all") @lombok.Generated JacksonizedBuilderFluent.JacksonizedBuilderFluentBuilder builder() {
return new JacksonizedBuilderFluent.JacksonizedBuilderFluentBuilder();
}
}
@@ -0,0 +1,13 @@
//CONF: lombok.jacksonized.jacksonVersion += 2
//CONF: lombok.jacksonized.jacksonVersion += 3
import com.fasterxml.jackson.annotation.JsonProperty;
@lombok.extern.jackson.Jacksonized
@lombok.experimental.Accessors(fluent=true)
@lombok.Builder
public class JacksonizedBuilderFluent {
private String fieldName1;
@JsonProperty("FieldName2")
private String fieldName2;
private String fieldName3;
}