How do I address unchecked cast warnings?

后端 未结 23 1532
醉梦人生
醉梦人生 2020-11-22 03:06

Eclipse is giving me a warning of the following form:

Type safety: Unchecked cast from Object to HashMap

This is from a call to

23条回答
  •  野性不改
    2020-11-22 03:48

    If I have to use an API that doesn't support Generics.. I try and isolate those calls in wrapper routines with as few lines as possible. I then use the SuppressWarnings annotation and also add the type-safety casts at the same time.

    This is just a personal preference to keep things as neat as possible.

提交回复
热议问题