告訴編譯器忽略 unchecked 警告信息,如使用List,ArrayList等未進行參數化產生的警告信息。
· @SuppressWarnings("serial")
如果編譯器出現這樣的警告信息:The serializable class WmailCalendar does not declare a static final serialVersionUID field of type long
使用這個注釋將警告信息去掉。
· @SuppressWarnings("deprecation")
如果使用了使用@Deprecated注釋的方法,編譯器將出現警告信息。
使用這個注釋將警告信息去掉。
· @SuppressWarnings("unchecked", "deprecation")
告訴編譯器同時忽略unchecked和deprecation的警告信息。
· @SuppressWarnings(value={"unchecked", "deprecation"})
等同于@SuppressWarnings("unchecked", "deprecation")
4.@SafeVarargs“堆污染”把一個不帶泛型的對象賦值給一個帶泛型的變量。
5.@FunctionalInterface在
java8規定:如果接口中只有一個抽象方法,該接口就是函數式接口。@FunctionalInterface用來指定某個接口必須是函數式接口。