test: Add Jackson 3 test cases and version ambiguity warnings

Add JacksonizedAccessorsJackson3 test case verifying that @Jacksonized
with jacksonVersion=3 emits the correct annotations.

Add expected warning messages for tests that have both Jackson 2 and 3
on the classpath without explicit version configuration, and fix
JacksonizedSuperBuilderWithJsonDeserialize message expectations.
This commit is contained in:
Sebastian Mandrean authored and Reinier Zwitserloot committed 2026-04-22 00:49:30 +02:00
1 parent 45e72e241a
commit e6567b6621
8 files changed
+192

No files matched your search

@@ -0,0 +1,109 @@
//version 8: Jackson deps are at least Java7+.
//CONF: lombok.jacksonized.jacksonVersion += 3
class JacksonizedAccessorsJackson3 {
@com.fasterxml.jackson.annotation.JsonProperty("name")
private String name;
@com.fasterxml.jackson.annotation.JsonProperty("age")
private int age;
@com.fasterxml.jackson.annotation.JsonIgnore
private transient String password;
@java.lang.SuppressWarnings("all")
@lombok.Generated
public JacksonizedAccessorsJackson3() {
}
@com.fasterxml.jackson.annotation.JsonProperty("name")
@java.lang.SuppressWarnings("all")
@lombok.Generated
public String name() {
return this.name;
}
@com.fasterxml.jackson.annotation.JsonProperty("age")
@java.lang.SuppressWarnings("all")
@lombok.Generated
public int age() {
return this.age;
}
@com.fasterxml.jackson.annotation.JsonIgnore
@java.lang.SuppressWarnings("all")
@lombok.Generated
public String password() {
return this.password;
}
/**
* @return {@code this}.
*/
@com.fasterxml.jackson.annotation.JsonProperty("name")
@java.lang.SuppressWarnings("all")
@lombok.Generated
public JacksonizedAccessorsJackson3 name(final String name) {
this.name = name;
return this;
}
/**
* @return {@code this}.
*/
@com.fasterxml.jackson.annotation.JsonProperty("age")
@java.lang.SuppressWarnings("all")
@lombok.Generated
public JacksonizedAccessorsJackson3 age(final int age) {
this.age = age;
return this;
}
/**
* @return {@code this}.
*/
@com.fasterxml.jackson.annotation.JsonIgnore
@java.lang.SuppressWarnings("all")
@lombok.Generated
public JacksonizedAccessorsJackson3 password(final String password) {
this.password = password;
return this;
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
@lombok.Generated
public boolean equals(final java.lang.Object o) {
if (o == this) return true;
if (!(o instanceof JacksonizedAccessorsJackson3)) return false;
final JacksonizedAccessorsJackson3 other = (JacksonizedAccessorsJackson3) o;
if (!other.canEqual((java.lang.Object) this)) return false;
if (this.age() != other.age()) return false;
final java.lang.Object this$name = this.name();
final java.lang.Object other$name = other.name();
if (this$name == null ? other$name != null : !this$name.equals(other$name)) return false;
return true;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
protected boolean canEqual(final java.lang.Object other) {
return other instanceof JacksonizedAccessorsJackson3;
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
@lombok.Generated
public int hashCode() {
final int PRIME = 59;
int result = 1;
result = result * PRIME + this.age();
final java.lang.Object $name = this.name();
result = result * PRIME + ($name == null ? 43 : $name.hashCode());
return result;
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
@lombok.Generated
public java.lang.String toString() {
return "JacksonizedAccessorsJackson3(name=" + this.name() + ", age=" + this.age() + ", password=" + this.password() + ")";
}
}
@@ -0,0 +1,68 @@
@lombok.Data @lombok.experimental.Accessors(fluent = true) @lombok.extern.jackson.Jacksonized class JacksonizedAccessorsJackson3 {
private @com.fasterxml.jackson.annotation.JsonProperty("name") String name;
private @com.fasterxml.jackson.annotation.JsonProperty("age") int age;
private transient @com.fasterxml.jackson.annotation.JsonIgnore String password;
public @com.fasterxml.jackson.annotation.JsonProperty("name") @java.lang.SuppressWarnings("all") @lombok.Generated String name() {
return this.name;
}
public @com.fasterxml.jackson.annotation.JsonProperty("age") @java.lang.SuppressWarnings("all") @lombok.Generated int age() {
return this.age;
}
public @com.fasterxml.jackson.annotation.JsonIgnore @java.lang.SuppressWarnings("all") @lombok.Generated String password() {
return this.password;
}
/**
* @return {@code this}.
*/
public @com.fasterxml.jackson.annotation.JsonProperty("name") @java.lang.SuppressWarnings("all") @lombok.Generated JacksonizedAccessorsJackson3 name(final String name) {
this.name = name;
return this;
}
/**
* @return {@code this}.
*/
public @com.fasterxml.jackson.annotation.JsonProperty("age") @java.lang.SuppressWarnings("all") @lombok.Generated JacksonizedAccessorsJackson3 age(final int age) {
this.age = age;
return this;
}
/**
* @return {@code this}.
*/
public @com.fasterxml.jackson.annotation.JsonIgnore @java.lang.SuppressWarnings("all") @lombok.Generated JacksonizedAccessorsJackson3 password(final String password) {
this.password = password;
return this;
}
public @java.lang.Override @java.lang.SuppressWarnings("all") @lombok.Generated boolean equals(final java.lang.Object o) {
if ((o == this))
return true;
if ((! (o instanceof JacksonizedAccessorsJackson3)))
return false;
final JacksonizedAccessorsJackson3 other = (JacksonizedAccessorsJackson3) o;
if ((! other.canEqual((java.lang.Object) this)))
return false;
if ((this.age() != other.age()))
return false;
final java.lang.Object this$name = this.name();
final java.lang.Object other$name = other.name();
if (((this$name == null) ? (other$name != null) : (! this$name.equals(other$name))))
return false;
return true;
}
protected @java.lang.SuppressWarnings("all") @lombok.Generated boolean canEqual(final java.lang.Object other) {
return (other instanceof JacksonizedAccessorsJackson3);
}
public @java.lang.Override @java.lang.SuppressWarnings("all") @lombok.Generated int hashCode() {
final int PRIME = 59;
int result = 1;
result = ((result * PRIME) + this.age());
final java.lang.Object $name = this.name();
result = ((result * PRIME) + (($name == null) ? 43 : $name.hashCode()));
return result;
}
public @java.lang.Override @java.lang.SuppressWarnings("all") @lombok.Generated java.lang.String toString() {
return (((((("JacksonizedAccessorsJackson3(name=" + this.name()) + ", age=") + this.age()) + ", password=") + this.password()) + ")");
}
public @java.lang.SuppressWarnings("all") @lombok.Generated JacksonizedAccessorsJackson3() {
super();
}
}
@@ -0,0 +1,10 @@
//version 8: Jackson deps are at least Java7+.
//CONF: lombok.jacksonized.jacksonVersion += 3
@lombok.Data
@lombok.experimental.Accessors(fluent = true)
@lombok.extern.jackson.Jacksonized
class JacksonizedAccessorsJackson3 {
private String name;
private int age;
private transient String password;
}
@@ -0,0 +1 @@
1 Ambiguous: Jackson2 and Jackson3 exist; define which variant(s) you want in 'lombok.config'. See https://projectlombok.org/features/experimental/Jacksonized
@@ -0,0 +1 @@
1 Ambiguous: Jackson2 and Jackson3 exist; define which variant(s) you want in 'lombok.config'. See https://projectlombok.org/features/experimental/Jacksonized
@@ -0,0 +1 @@
1 Ambiguous: Jackson2 and Jackson3 exist; define which variant(s) you want in 'lombok.config'. See https://projectlombok.org/features/experimental/Jacksonized
@@ -0,0 +1 @@
1 Ambiguous: Jackson2 and Jackson3 exist; define which variant(s) you want in 'lombok.config'. See https://projectlombok.org/features/experimental/Jacksonized
@@ -1 +1,2 @@
2 Ambiguous: Jackson2 and Jackson3 exist; define which variant(s) you want in 'lombok.config'. See https://projectlombok.org/features/experimental/Jacksonized
2 @JsonDeserialize already exists on class. Either delete @JsonDeserialize, or remove @Jacksonized and manually configure Jackson.