@SuppressWarnings(“serial”) 借鉴山清水秀ysu

@SuppressWarnings("serial")的理解

作用:用于抑制编译器产生警告信息

抑制单类型警告
@SuppressWarnings("serial")的理解

抑制多类型警告

@SuppressWarnings("serial")的理解
抑制所有类型警告
@SuppressWarnings("serial")的理解

@SuppressWarnings("serial")的理解

· @SuppressWarnings(“unchecked”)
告诉编译器忽略 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”)

抑制警告的关键字

@SuppressWarnings("serial")的理解

@SuppressWarnings("serial")的理解

相关文章:

  • 2021-10-06
  • 2021-10-04
猜你喜欢
  • 2022-12-23
  • 2021-08-10
  • 2022-12-23
  • 2018-11-13
  • 2021-06-20
相关资源
相似解决方案