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