You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a problem with the last version of Lombok (1.18.12).
The @JsonProperty of the field is copied to the generated setter by Lombok, and that causes an error when an annotation @JacksonXmlProperty also exists on that field.
Here is an example:
import org.junit.Test;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import lombok.Getter;
import lombok.Setter;
public class LombokTest {
@Test
public void test() throws JsonProcessingException {
MyClass myClass = new MyClass();
XmlMapper xmlMapper = new XmlMapper();
String xml = xmlMapper.writeValueAsString(myClass);
}
}
@Getter
@Setter
class MyClass {
@JacksonXmlProperty(localName = "MY_FIELD")
@JsonProperty("my_field")
private String myField;
}
It causes the following error: java.lang.IllegalStateException: Conflicting/ambiguous property name definitions (implicit name 'myField'): found multiple explicit names: [{}MY_FIELD, my_field], but also implicit accessor: [method MyClass#getMyField(0 params)][visible=true,ignore=false,explicitName=false]
In 1.18.6 we did not have this error because the annotation @JsonProperty was not added tothe setter in the generated code.
The text was updated successfully, but these errors were encountered:
JulienHoueix
changed the title
[BUG]
[BUG] Lombok with Jackson - @JsonProperty added to the generate setter causes error
May 8, 2020
JulienHoueix
changed the title
[BUG] Lombok with Jackson - @JsonProperty added to the generate setter causes error
[BUG] Lombok with Jackson - @JsonProperty added to the generated setter causes error
May 8, 2020
Hello,
I have a problem with the last version of Lombok (1.18.12).
The @JsonProperty of the field is copied to the generated setter by Lombok, and that causes an error when an annotation @JacksonXmlProperty also exists on that field.
Here is an example:
It causes the following error:
java.lang.IllegalStateException: Conflicting/ambiguous property name definitions (implicit name 'myField'): found multiple explicit names: [{}MY_FIELD, my_field], but also implicit accessor: [method MyClass#getMyField(0 params)][visible=true,ignore=false,explicitName=false]
In 1.18.6 we did not have this error because the annotation @JsonProperty was not added tothe setter in the generated code.
I guess it is related to #1981
The text was updated successfully, but these errors were encountered: