minimal-json
minimal-json copied to clipboard
Fixed some Sonar issues
This is basically a port from RestFB and improved even further.
- Duplicate strings used in several Exceptions moved to constant values
- IntelliJ IDE project files added to gitignore
This fixes improve the code quality according to the default sonarqube java quality profile.
Location was made Serializable. Why is it so?
Ah sorry, I forgot to mention this one.
Location
is used as field in the ParseException
and the exception class is serializable because every exception extends Throwable
.
So all fields of the ParseException
should be serializable, too. Or the field needs to be transient.
But because there are methods that work directly on the Location field, serializable look like the better way.
Location is used as field in the ParseException and the exception class is serializable because every exception extends Throwable.
I see.
Well, it looks like a good pull request to me, but I don't think it will be merged any time soon, as the maintainer seems to have distanced himself from the project.
Hm okay, I see. That's a pity, since I really like minimal-json and with its zero dependency approach it is a good "partner" for the RestFB library. I try to contact Ralf and check the state of minimal-json.
Good luck. What I really liked about this library is that it's just a clean Java JSON library.
No reflection, no nonsensical casts, and a quite lean API.
Thanks for the PR and sorry for letting you wait.
I understand that Sonar recommends extracting constants, however, in this case, I don't see much value in this change. It creates a dependency between the parameter names and the constants. It's really not a big issue, but I have a slight preference to keep the messages close to the parameter names they refer to. The change also does not help to reduce the size of the compiled jar. In fact, it even adds ~ 290 bytes.
For these reasons, I'd feel better not to include this change.
Making Location
serializable looks reasonable to me.