[682] Correct the fix for 670 and return the type if the type has alr…#683
Open
jamezp wants to merge 1 commit intoeclipse-ee4j:masterfrom
Open
[682] Correct the fix for 670 and return the type if the type has alr…#683jamezp wants to merge 1 commit intoeclipse-ee4j:masterfrom
jamezp wants to merge 1 commit intoeclipse-ee4j:masterfrom
Conversation
…eady been resolved. Signed-off-by: James R. Perkins <jperkins@ibm.com>
KyleAure
reviewed
Dec 8, 2025
Member
KyleAure
left a comment
There was a problem hiding this comment.
This fix looks good.
I think all we are missing from the tests are appropriate de-serialization testing for the same scenario. This looks like common practice in this test class so I added those suggestions below.
Comment on lines
+527
to
+530
| // Use a new instance of Jsonb to avoid any caching | ||
| try (var jsonb = JsonbBuilder.create()) { | ||
| assertEquals(expectedJson, jsonb.toJson(container)); | ||
| } |
Member
There was a problem hiding this comment.
Suggested change
| // Use a new instance of Jsonb to avoid any caching | |
| try (var jsonb = JsonbBuilder.create()) { | |
| assertEquals(expectedJson, jsonb.toJson(container)); | |
| } | |
| // Use a new instance of Jsonb to avoid any caching | |
| try (var jsonb = JsonbBuilder.create()) { | |
| assertEquals(expectedJson, jsonb.toJson(container)); | |
| TreeContainer<TreeElement> result = jsonb.fromJson(expectedJson, new TestTypeToken<TreeContainer<TreeElement>>() {}.getType()); | |
| assertIterableEquals(container.getTree().getChildren(), result.getTree().getChildren()); | |
| } |
Requires addition of:
import static org.junit.jupiter.api.Assertions.assertIterableEquals;
Comment on lines
+542
to
+545
| // Use a new instance of Jsonb to avoid any caching | ||
| try (var jsonb = JsonbBuilder.create()) { | ||
| assertEquals(expectedJson, jsonb.toJson(container)); | ||
| } |
Member
There was a problem hiding this comment.
Suggested change
| // Use a new instance of Jsonb to avoid any caching | |
| try (var jsonb = JsonbBuilder.create()) { | |
| assertEquals(expectedJson, jsonb.toJson(container)); | |
| } | |
| // Use a new instance of Jsonb to avoid any caching | |
| try (var jsonb = JsonbBuilder.create()) { | |
| assertEquals(expectedJson, jsonb.toJson(container)); | |
| ListContainer<TreeElement> result = jsonb.fromJson(expectedJson, new TestTypeToken<ListContainer<TreeElement>>() {}.getType()); | |
| assertIterableEquals(container.getList(), result.getList()); | |
| } |
Requires addition of:
import static org.junit.jupiter.api.Assertions.assertIterableEquals;| public class TreeElement implements TreeTypeContainer<TreeElement> { | ||
| public class TreeElement extends TreeTypeContainer<TreeElement> { | ||
|
|
||
| private final String name; |
Member
There was a problem hiding this comment.
Suggested change
| private final String name; | |
| private String name; | |
| public TreeElement() { | |
| } |
suggestion: allow for deserialization
| public void setChildren(final List<TreeElement> children) { | ||
| this.children = children; | ||
| } | ||
| } |
Member
There was a problem hiding this comment.
Suggested change
| } | |
| public void setName(final String name) { | |
| this.name = name; | |
| } | |
| @Override | |
| public boolean equals(Object o) { | |
| if (this == o) { | |
| return true; | |
| } | |
| if (o == null || getClass() != o.getClass()) { | |
| return false; | |
| } | |
| if (!super.equals(o)) { | |
| return false; | |
| } | |
| TreeElement that = (TreeElement) o; | |
| return name != null ? name.equals(that.name) : that.name == null; | |
| } | |
| } |
suggestion: allow for deserialization and assertions.
| public void setChildren(final List<T> children) { | ||
| this.children = children; | ||
| } | ||
| } |
Member
There was a problem hiding this comment.
Suggested change
| } | |
| @Override | |
| public boolean equals(Object o) { | |
| if (this == o) { | |
| return true; | |
| } | |
| if (o == null || getClass() != o.getClass()) { | |
| return false; | |
| } | |
| TreeTypeContainer<?> that = (TreeTypeContainer<?>) o; | |
| if (children == null) { | |
| return that.children == null; | |
| } | |
| return children.containsAll(that.children) && that.children.containsAll(children); | |
| } | |
| } |
Suggestion: allow for assertions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…eady been resolved.
resolves #682