I don't want to supress warnings. Is there another way to handle this warning?
"The expression of type Iterator needs unchecked conversion to conform to Iterator"
Iterator<String> it = schemaJSON.getJSONObject("body").keys();
Unchecked assignment: 'java.util.List' to 'java.util.List<java.lang.String>' It means that you try to assign not type safe object to a type safe variable. If you are make sure that such assignment is type safe, you can disable the warning using @SuppressWarnings annotation, as in the following examples.
Unchecked cast means that you are (implicitly or explicitly) casting from a generic type to a nonqualified type or the other way around.
The warning tells you that the compiler has encountered a condition that it can't guarantee the sense of. You should avoid having this kind of thing.
You can find your answere here: Type Safety warning with JSON Iterator
Iterator<?> it = schemaJSON.getJSONObject("body").keys();
while(it.hasNext())
{
String next = (String) it.next();
...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With