Dave's Brain

Browse - Programming Tips - I am getting "HashMapK,V should be parameterized" on standard W32API code.

Date: 2016aug20
Language: Java
OS: Windows

Q.  I am getting "HashMap<K,V> should be parameterized" on standard W32API code.
How can I avoid that warning?

A. Add Change HashMap to HashMap<String,Object>
Change:

/** Standard options to use the Unicode version of a w32 API. */ public HashMap UNICODE_OPTIONS = new HashMap() { { put(OPTION_TYPE_MAPPER, W32APITypeMapper.UNICODE); put(OPTION_FUNCTION_MAPPER, W32APIFunctionMapper.UNICODE); } }; /** Standard options to use the ASCII/MBCS version of a w32 API. */ public HashMap ASCII_OPTIONS = new HashMap() { { put(OPTION_TYPE_MAPPER, W32APITypeMapper.ASCII); put(OPTION_FUNCTION_MAPPER, W32APIFunctionMapper.ASCII); } }; public HashMap DEFAULT_OPTIONS = Boolean.getBoolean("w32.ascii") ? ASCII_OPTIONS : UNICODE_OPTIONS;
To:
/** Standard options to use the Unicode version of a w32 API. */ public HashMap<String,Object> UNICODE_OPTIONS = new HashMap<String,Object>() { { put(OPTION_TYPE_MAPPER, W32APITypeMapper.UNICODE); put(OPTION_FUNCTION_MAPPER, W32APIFunctionMapper.UNICODE); } }; /** Standard options to use the ASCII/MBCS version of a w32 API. */ public HashMap<String,Object> ASCII_OPTIONS = new HashMap<String,Object>() { { put(OPTION_TYPE_MAPPER, W32APITypeMapper.ASCII); put(OPTION_FUNCTION_MAPPER, W32APIFunctionMapper.ASCII); } }; public HashMap<String,Object> DEFAULT_OPTIONS = Boolean.getBoolean("w32.ascii") ? ASCII_OPTIONS : UNICODE_OPTIONS;

Add a comment

Sign in to add a comment
Copyright © 2008-2017, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.