본문 바로가기

개발개발

@SuppressWarnings("unchecked") does not ignore raw types warnings anymore

What is affected: Usage of @SuppressWarnings("unchecked").

Description: Up to Eclipse 3.5, @SuppressWarnings("unchecked") was used to suppress the unchecked and raw types warnings. This was not consistent with other compilers (e.g. javac). A new warning token "rawtypes" has been added to cover the case of raw type warnings exclusively. So in order to get rid of all warnings, in Eclipse 3.6, it might be required to add "rawtypes" in the warning token list.

If it is not possible to update the code, a system property (-DsuppressRawWhenUnchecked=true) can be added to the -vmargs list on startup. This preserves the old behavior. The projects need to be manually cleaned and rebuilt after toggling the property.

Action required: When new warnings that were previously ignored are now reported, add "rawtypes" to the list of warning tokens.

Before:
@SuppressWarnings("unchecked")
    void bar(List list) {
        List<String> ls2 = list;
    }
@SuppressWarnings("unchecked")
private List l;
After:

@SuppressWarnings({"unchecked", "rawtypes"}) void bar(List list) { List<String> ls2 = list; } @SuppressWarnings("rawtypes") private List l;


요약하면 이전에는 rowtype워닝이나 unchecked워닝을 구분없이 @SuppressWarnings("unchecked") 를

사용해서 워닝을 제거했지만, 이클립스 3.6 부터는 구별해서 적용해야한다는 내용인듯.

'개발개발' 카테고리의 다른 글

context binding  (0) 2011.09.26
self-executing anonymous function  (0) 2011.09.26
Dynamic Web Module?  (1) 2011.09.15
Oracle 날자 관련 함수  (0) 2010.04.09
Oracle 10g XE  (0) 2010.04.05