Numeric enhancements, Refactoring, Fix spelling#336
Conversation
|
Looks good, but seems to be breaking one of the unit tests: |
|
Yup, I'll take a look. |
|
OK, looks like the test is wrong due to that lack of having a float put method I mentioned. I'll update the test and push the change later today. |
|
What problem does this code solve? Risks Changes to the API? Will this require a new release? Should the documentation be updated? Does it break the unit tests? Was any code refactored in this commit? Review status |
test support for Numeric enhancements, Refactoring, Fix spelling: stleary/JSON-java/pull/336
This is mostly cleanup of comments with a few changes to also remove some compile time warnings.
incrementI replaced the autoboxing calls with explicit accessors and also prevented runtime casting by using the proper long/float/double literals.NullI added a hashcode function that explicitly returns 0 everytime, the same as most hash functions when handling null :return someField == null ? 0 : someField.hashCode();putfunction forfloat... for some reason we have code that handles floats in multiple places, but no way to directly add them into the JSONObject. Previously these would get converted todoubleput(literalNumber)methods to use the valueOf static instead of always creating new instances.this.constructorparameters to be final.toString(String, String)updated parameters to be finalLet me know if I should roll any of the changes back and just keep the comment fixes.