Map is a raw type

이클립스 에디터에서 Map is a raw type. 이라는 노란색 아이콘 경고가 아래와 같이 발생했다.

Multiple markers at this line
 - Type safety: The return type Map for boardView(BoardVO) from the type BoardServiceImpl needs unchecked conversion to 
 conform to Map<String,Object> from the type BoardService
 - Map is a raw type. References to generic type Map<K,V> should be parameterized
 - implements javada.board.service.BoardService.boardView

노란색 경고 아이콘은 클릭하면 아래와 같은 도움말 창이 뜨는데 리턴 타입을 Map에서 Map<String,Object>로 변경(generic code 추가)하면 노란색 경고 아이콘이 사라진다.
generic01

Map<String, Object>으로 수정된 코드

public Map<String, Object> boardView(
    BoardVO searchVO) throws Exception {
 BoardVO boardVO = boardDAO.boardView(searchVO);
 boardVO.setCode_name(boardDAO.codeName(searchVO));
 
 Map<String, Object> map = new HashMap<String, Object>();
 map.put("codeList", boardDAO.codeList(searchVO));
 map.put("codeName", boardDAO.codeName(searchVO));
 map.put("bbs", boardVO);
 
 return map;
 }

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다