简体   繁体   中英

How to suppress unchecked class warning

how to I pass HashMap<String, String>.class in Gson builder for supperss "unchecked warning"?

HashMap<String, String> manifest = 
    Gson().fromJson(stringBuilder.toString(), HashMap.class);

@SuppressWarnings("unchecked")标记您的方法

Please add @SuppressWarnings("unchecked") above your Hashmap reference. This will only ignore the next statement to it instead of whole method.

@SuppressWarnings("unchecked") 

HashMap<String, String> manifest = 
        Gson().fromJson(stringBuilder.toString(), HashMap.class);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM