stleary / JSON-java

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

Revert recent obj long get long changes #869

Closed stleary closed 7 months ago

stleary commented 7 months ago

See #868. Reverts recent code changes that break existing applications. This PR will be left up for a few days for comments. If there are no objections or concerns it will included in a new release soon.

For more information, please see XMLTest.clarifyCurrentBehavior() and JSONObjectTest.clarifyCurrentBehavior().

stleary commented 7 months ago

What problem does this code solve? Reverts some recently released changes that do not work as intended. Changes to improve optLong vs getLong are needed, but must not change existing functionality without good reason. In this case, strings consisting of some number of leading zeros followed by any digits should not be interpreted as numbers, as that goes against the JSON spec.

Does the code still compile with Java6? Yes

Risks Moderate. The faulty code is already released, and may potentially already be in use. On the other hand, the last release was relatively recent, and the misbehaving code is a bit of an edge case.

Changes to the API? getLong(), optLong(), and stringToNumber() functionality is reverted.

Will this require a new release? Yes. However, there are several workflow issues that should be addressed before the release:

Should the documentation be updated? No

Does it break the unit tests? No. Some recently added unit tests are removed.

Was any code refactored in this commit? No

Review status APPROVED - by myself

In this case, the review window has already completed.

A release will be performed as soon as the workflows are updated.