Eliminating generic warnings by properly specifying generic types