Schlagwort-Archive: @SuppressWarnings

Eclipse 3.5 zu Eclipse 3.6 –> @SuppressWarnings("unchecked") und @SuppressWarnings("rawtypes")

Von http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.jdt.doc.isv/porting/3.6/incompatibilities.html Punkt 3:

@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;