stleary / JSON-java

A reference implementation of a JSON package in Java.
http://stleary.github.io/JSON-java/index.html
Other
4.54k stars 2.56k forks source link

update-jsonpath: update jsonpath from 2.4.0 to 2.9.0 #894

Closed stleary closed 1 week ago

stleary commented 6 months ago

What problem does this code solve? Fixes #893 by updating jsonpath, which is only used for unit tests, from 2.4.0 to 2.9.0.

Does the code still compile with Java6? Yes

Risks Low

Changes to the API? No

Will this require a new release? No

Should the documentation be updated? No

Does it break the unit tests? No

Was any code refactored in this commit? No executable code was changed

Review status APPROVED - by myself

Starting 3-day comment window

javadev commented 5 months ago

added Approved - 3-day window Approved - by myself labels 3 weeks ago

stleary commented 5 months ago

PRs can be submitted and approved but merges will remain pending until #884 and #891 are completed.

stleary commented 5 months ago

@StacySager1977 Only the repo owner is allowed to merge changes. This merge is being temporarily held back for the reasons stated above.

rikkarth commented 4 months ago

PRs can be submitted and approved but merges will remain pending until #884 and #891 are completed.

is there any action required? i'm under the impression both have been addressed

stleary commented 4 months ago

@rikkarth, Yes, I think additional action is needed. First, apologies to all for not addressing this sooner. A confluence of one-time events has consumed all of my free time for the past month, but I have cycles available now to dig deeper. I added a note to #884 that I think demonstrates that invalid trailing chars have not been addressed yet for JSONObject. That should be easily fixable, but first let's make sure the existing implementation is the best we can come up with.

The purpose of strict mode is, I think, actually fairly simple: to enforce double quotes around strings and disallow invalid trailing chars at the end of the parsed document. Also, during parsing, we have to make sure that the JSONParserConfiguration object is passed or default initialized wherever it might be needed. If I missed anything else, please remind me.

For string checking, one would think that would be done in JSONTokener.nextString(), but it was not. Instead, a new method, parseUnquotedText() is added. This does not seem like the simplest and most direct implementation to me. For example, by doing the work in nextString(), we would not need JSONTokener.smallCharMemory, or the methods that manipulate it.

For trailing chars, we need to separate the top-level array or object from nested instances. Recall, we are only concerned with raw text parsing. Wouldn't the String and Tokener constructors be the best place to do this? Then we would not need JSONTokener.arrayLevel.

Regarding the tests, I still think that it's fair to limp along for now with manual strict mode tests, but as mentioned above, the missing JSONObject tests must be filled in.

In summary, some missed work in JSONObject, many missing JSONObject unit tests, and some concerns that the implementation could be much simpler and more direct.

rikkarth commented 3 months ago

@rikkarth, Yes, I think additional action is needed. First, apologies to all for not addressing this sooner. A confluence of one-time events has consumed all of my free time for the past month, but I have cycles available now to dig deeper. I added a note to #884 that I think demonstrates that invalid trailing chars have not been addressed yet for JSONObject. That should be easily fixable, but first let's make sure the existing implementation is the best we can come up with.

The purpose of strict mode is, I think, actually fairly simple: to enforce double quotes around strings and disallow invalid trailing chars at the end of the parsed document. Also, during parsing, we have to make sure that the JSONParserConfiguration object is passed or default initialized wherever it might be needed. If I missed anything else, please remind me.

For string checking, one would think that would be done in JSONTokener.nextString(), but it was not. Instead, a new method, parseUnquotedText() is added. This does not seem like the simplest and most direct implementation to me. For example, by doing the work in nextString(), we would not need JSONTokener.smallCharMemory, or the methods that manipulate it.

For trailing chars, we need to separate the top-level array or object from nested instances. Recall, we are only concerned with raw text parsing. Wouldn't the String and Tokener constructors be the best place to do this? Then we would not need JSONTokener.arrayLevel.

Regarding the tests, I still think that it's fair to limp along for now with manual strict mode tests, but as mentioned above, the missing JSONObject tests must be filled in.

In summary, some missed work in JSONObject, many missing JSONObject unit tests, and some concerns that the implementation could be much simpler and more direct.

Will address as much as possible next week.

rikkarth commented 3 months ago

Currently addressing issue https://github.com/stleary/JSON-java/issues/884 in PR https://github.com/stleary/JSON-java/pull/903