jamsesso / json-logic-java

A pure Java implementation of JsonLogic without using the Nashorn JS engine
MIT License
99 stars 50 forks source link

Iterable Maps treated as Arrays #25

Closed mhball closed 2 years ago

mhball commented 2 years ago

Some map implementations implement the java.lang.Iterable interface, which satisfy the ArrayLike.isEligible(Object data) check and get treated as arrays. E.g. Vert.x JsonObject.

Can I suggest checking for instances of java.util.Collection instead of java.lang.Iterable to find array-like objects to allow for iterable maps?

jamsesso commented 2 years ago

Great question. I had to look into why the default Java Map implementations don't do this and found: https://stackoverflow.com/a/19422495

This would definitely be a major semver change so I'd need to see if there are others who think this is a more reasonable default. Right now, I'll opt to keep the implementation as-is.