diff --git a/src/main/java/tools/jackson/core/TreeNode.java b/src/main/java/tools/jackson/core/TreeNode.java index da3d981b97..9017bd5ae2 100644 --- a/src/main/java/tools/jackson/core/TreeNode.java +++ b/src/main/java/tools/jackson/core/TreeNode.java @@ -5,6 +5,7 @@ package tools.jackson.core; +import java.util.Collection; import java.util.Iterator; import java.util.Spliterator; import java.util.Spliterators; @@ -227,7 +228,7 @@ public interface TreeNode * @return An iterator for traversing names of all properties this Object node * has (if Object node); empty {@link Iterator} otherwise (never {@code null}). */ - Iterator propertyNames(); + Collection propertyNames(); /** * Method for accessing names of all properties for this node via a {@code Spliterator} , @@ -239,7 +240,7 @@ public interface TreeNode * @since 3.0 */ default Spliterator propertyNameSpliterator() { - return Spliterators.spliteratorUnknownSize(propertyNames(), Spliterator.ORDERED); + return propertyNames().spliterator(); } /** diff --git a/src/test/java/tools/jackson/core/util/DelegatesTest.java b/src/test/java/tools/jackson/core/util/DelegatesTest.java index e76f22c2c9..e53265dc45 100644 --- a/src/test/java/tools/jackson/core/util/DelegatesTest.java +++ b/src/test/java/tools/jackson/core/util/DelegatesTest.java @@ -3,6 +3,7 @@ import java.io.*; import java.math.BigDecimal; import java.math.BigInteger; +import java.util.Collection; import java.util.Iterator; import org.junit.jupiter.api.Test; @@ -92,7 +93,7 @@ public TreeNode path(int index) { } @Override - public Iterator propertyNames() { + public Collection propertyNames() { return null; }