zoukankan      html  css  js  c++  java
  • @suppresswarnings(unchecked)的作用

    一般在项目中会出现红色的报错,这个是影响项目运行的,无法启动,会停在那里,而warning警告,黄色的虽然不是会让项目停止,但是却是不规范,留下隐患,而@suppresswarnings就是告诉编译器忽略警告。不用在编译完成后出现警告。 @SuppressWarnings(“”) @SuppressWarnings({}) @SuppressWarnings(value={}) value -将由编译器在注释的元素中取消显示的警告集。允许使用重复的名称。忽略第二个和后面出现的名称。出现未被识别的警告名不是错误:编译器必须忽略无法识别的所有警告名。但如果某个注释包含未被识别的警告名,那么编译器可以随意发出一个警告。 @SuppressWarnings("unchecked") 告诉编译器忽略 unchecked 警告信息,如使用List,ArrayList等未进行参数化产生的警告信息。 · @SuppressWarnings("serial") 如果编译器出现这样的警告信息:The serializable class WmailCalendar does notdeclare a static final serialVersionUID field of type long 使用这个注释将警告信息去掉。 · @SuppressWarnings("deprecation") 如果使用了使用@Deprecated注释的方法,编译器将出现警告信息。 使用这个注释将警告信息去掉。 · @SuppressWarnings("unchecked", "deprecation") 告诉编译器同时忽略unchecked和deprecation的警告信息。 · @SuppressWarnings(value={"unchecked", "deprecation"}) 等同于@SuppressWarnings("unchecked", "deprecation")

    转载于:https://www.cnblogs.com/jiangshengxiang/p/8625962.html

  • 相关阅读:
    转:Caused by: java.lang.NoSuchMethodError: org.apache.log4j.Category.log
    maven安装
    eclipse安装插件
    java.lang.ClassNotFoundException: com.*.listener.ConfigInfoReader
    oracle
    myeclipse中文乱码,JSP页面乱码
    ansible 列表变量、字典变量
    python模块
    python函数
    python数据类型2
  • 原文地址:https://www.cnblogs.com/zhaozhitong/p/12665416.html
Copyright © 2011-2022 走看看