When using JSON-simple in Java, IDEA highlights in the following code the second line with inspection.

JSONObject request = new JSONObject(); request.put("type", "abilityStatus"); 

Inspection says:

 Unchecked call to 'put(K, V)' as a member of raw type 'java.util.HashMap' 

There are no problems with compilation and operation, but I want to figure out what I don’t like IDEA and how to fix it.

Who faced this and knows how to deal with it?

    1 answer 1

    This warning occurs for all users of org.json.simple due to the fact that the library does not use generics. You can hide the warning with the @SuppressWarnings("unchecked") construct

    If you want to do the "right", you can use something like Google GSOn

    https://stackoverflow.com/questions/24548656/unchecked-call-to-adde-as-a-member-of-the-raw-type-arraylist-and-hashmap