Date: 2016aug20
Language: Java
OS: Windows
Q. Java: "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;