Skip to content

[4주차] 이시윤_Item27#18

Merged
023-dev merged 2 commits intoeffective-java-3e-study:mainfrom
cyunlee:main
Jan 28, 2025
Merged

[4주차] 이시윤_Item27#18
023-dev merged 2 commits intoeffective-java-3e-study:mainfrom
cyunlee:main

Conversation

@cyunlee
Copy link
Copy Markdown
Contributor

@cyunlee cyunlee commented Jan 22, 2025

No description provided.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SuppressWarnings를 사용할 때, 경고를 무시해도 되는 이유를 주석으로 남겨야 한다고 했는데, 구체적인 예시가 있을까요?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

해당 타입이 안전하다는 확신을 얻기 위해 어떤 검증들을 해보는 게 좋은지 궁금합니다!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

저는 개인적으로 경고를 무시해서 "안전한" 경우는 거의 없다고 생각합니다. 그래서 @SuppressWarnings 를 지양하는 편인데요!
혹시 경고를 무시하는게 좀 더 나은 경우가 있나요??

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

만약 List<Object>를 그대로 사용하고 싶고,

list.add(1);
int intValue = (int) list.get(1);

이런 코드를 추가하고 싶다면
@SuppressWarnings("unchecked") 를 메서드 레벨로 빼야 할까요? 아니면 int intValue = (int) list.get(1); 이 위에 달아야할까요? 의견이 궁금합니다 :)

@023-dev 023-dev merged commit 3016079 into effective-java-3e-study:main Jan 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants