I have a method with this signature:
protected final Map<String, Object> buildOutputMappings(
AbstractDataObject ado, MDBase md)
And called with this method (in a subclass):
Map<String, Object> params = buildOutputMappings(ra, md);
I get this compiler warning:
Warning:Warning:line (136)[unchecked] unchecked conversion
found : java.util.Map
required: java.util.Map<java.lang.String,java.lang.Object>
Changing params to an ungenericized Map removes the compiler warning. Why is this and how can it be avoided (other than suppression)?
EDIT: This is JDK 1.5, and line 136 is the assignment statement above. Neither class is paramterized, they just have methods that return a Map of a generic type. The returned object within the method is also genericized.
EDIT: The superclass is indeed genericized, although return value has nothing to do with those generics. Here is the code of the method, although with the disclaimer that I didn't write this and I know it is ugly:
protected final Map<String, Object> buildOutputMappings(AbstractDataObject ado, MDBase md) throws DAOException {
try {
....
Map<String,Object> params = new HashMap<String, Object>(spc.getNumberInParams());
....
return params;
}
catch (Exception e) {
logger.undeterminedError(e);
throw new DAOException(e.getMessage(), e);
}
}
Here are the class declarations:
public abstract class DAOBase<T extends AbstractDataObject>
public class RoleAssignmentDAO extends DAOBase