How do I address unchecked cast warnings?

后端 未结 23 1203
醉梦人生
醉梦人生 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:45

    A quick guess if you post your code can say for sure but you might have done something along the lines of

    HashMap test = new HashMap();
    

    which will produce the warning when you need to do

    HashMap test = new HashMap();
    

    it might be worth looking at

    Generics in the Java Programming Language

    if your unfamiliar with what needs to be done.

提交回复
热议问题