Skip to content

Commit 672406c

Browse files
Fix GsonTest: assertEquals for annotated2 email, improve known-issue comment in annotated test
Co-authored-by: holgerfriedrich <2121139+holgerfriedrich@users.noreply.github.com>
1 parent 49fed6e commit 672406c

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

  • bundles/org.openhab.core/src/test/java/org/openhab/core/gson

bundles/org.openhab.core/src/test/java/org/openhab/core/gson/GsonTest.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,10 @@ void testLoadAndDeserializeAnnotatedJson() {
8585
assertEquals("John Doe", test.n, "Name field should match");
8686
assertEquals(30, test.age, "Age field should match");
8787
assertTrue(test.active, "Active field should match");
88-
// Known issue: when @NonNullByDefault({}) precedes @SerializedName in annotation order,
89-
// Gson cannot find the @SerializedName annotation and the email field is not deserialized.
90-
// This is an intentional test to document ECJ annotation ordering behavior.
91-
assertNull(test.e, "Email field is expected to be null due to annotation ordering issue");
88+
// Known issue in ECJ >3.43 due to changed handling of annotations (FIELD / TYPE_USE):
89+
// when @NonNullByDefault({}) precedes @SerializedName, ECJ emits @SerializedName as a
90+
// TYPE_USE annotation instead of a FIELD annotation, and Gson cannot find it.
91+
assertNull(test.e, "Email field is expected to be null due to annotation ordering issue in ECJ >3.43");
9292
}
9393

9494
@Test
@@ -106,10 +106,7 @@ void testLoadAndDeserializeAnnotated2Json() {
106106
assertEquals("John Doe", test.n, "Name field should match");
107107
assertEquals(30, test.age, "Age field should match");
108108
assertTrue(test.active, "Active field should match");
109-
// Known issue: when @Nullable precedes @SerializedName in annotation order,
110-
// Gson cannot find the @SerializedName annotation and the email field is not deserialized.
111-
// This is an intentional test to document ECJ annotation ordering behavior.
112-
assertNull(test.e, "Email field is expected to be null due to annotation ordering issue");
109+
assertEquals("john.doe@example.com", test.e, "Email field should match");
113110
}
114111

115112
@Test

0 commit comments

Comments
 (0)