Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ITEM 32. 제네릭과 가변인수를 함께 쓸 때는 신중하라 #59

Open
SGKIM94 opened this issue Apr 5, 2021 · 0 comments
Open
Assignees
Labels
Assignment Something to submit

Comments

@SGKIM94
Copy link
Collaborator

SGKIM94 commented Apr 5, 2021

가변인수를 사용하면 기본적으로 경고가 발생합니다.
이를 무시한다면, 호출하는 곳마다 @SuppressWarnings("unchecked") 애너테이션을 달아 경고를 숨겨야 했고, 지루한 작업이며 가독성을 떨어뜨리고 진짜 문제를 알려주는 경고마저 숨기는 안좋은 결과가 발생할 수 있습니다.

따라서, @SaveVarags 애너테이션을 사용하여 경고를 숨길 수 있습니다.
하지만, 메서드가 안전함이 보장이 되어야하는데요.

이러한 가변인수를 안전함이 보장될 수 있는 방법에 대해서 정리해봅시다.

@SGKIM94 SGKIM94 added the Assignment Something to submit label Apr 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Assignment Something to submit
Projects
None yet
Development

No branches or pull requests

4 participants