-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Removed compilation warnings #110
Conversation
Hi Christophe,
|
Thanks for your answer @stleary. Concerning the @SuppressWarnings part, I've added it to remove the warnings I get when Object are casted to something else, resulting in unchecked cast. Eventually, I can provide another commit ignoring only the specific cast lines. |
I think SupressWarnings and unchecked casts are equally annoying. I note that the problem lines are all casts to generics, e.g. return new JSONObject((Map<String, Object>) value).toString(); What would you think about something like, return new JSONObject((Map<?, ?>) value).toString(); [Note: I am not going to be able to commit any changes until the unit test suite is completed, which will take a little while. But it would be good to get rid of the warnings in a safe way. Let me know what you think.] |
Thank you for the tip. I've pushed a new commit using <?> and no warning anymore. |
Thanks! As mentioned earlier, I need to hold off on commits until the unit tests are done. If you wish to contribute, the repository is: https://github.com/stleary/JSON-Java-unit-test. |
Thanks for the pull request. I think removing warnings is advisable if there is 100% certainty that the code is not affected. My bad for suggesting Map and Collection<?>. That invokes the JSONObject(Object) and JSONArray(Object) ctors, and incidentally breaks the unit tests. To summarize:
|
I've restored "local" @SuppressWarnings for the specific lines. Now we should be OK. |
Looks good. Leaving it up for a day or so in case of additional comments. Will have to hand merge, looks like there is a formatting issue in JSONObject. |
The formatting issue should be fixed now, allowing you to automerge. |
Thanks, merged on a separate branch. |
I have updated the code to removed several compilation warnings.