Java忽略警告注解@SuppressWarnings

@SuppressWarnings(“path”)

// 忽略使用了某些不赞成使用的类和方法的警告

@SuppressWarnings(“deprecation”)

// 忽略switch语句执行到底没有break关键字的警告

@SuppressWarnings(“fallthrough”)

// 忽略某类实现Serializable,但是没有定义serialVersionUID的警告

@SuppressWarnings(“serial”)

// 忽略没有传递带有泛型的参数的警告

@SuppressWarnings(“rawtypes”)

源码

=======

package java.lang;

import java.lang.annotation.*;

import static java.lang.annotation.ElementType.*;

/**

  • Indicates that the named compiler warnings should be suppressed in the

  • annotated element (and in all program elements contained in the annotated

  • element). Note that the set of warnings suppressed in a given element is

  • a superset of the warnings suppressed in all containing elements. For

  • example, if you annotate a class to suppress one warning and annotate a

  • method to suppress another, both warnings will be suppressed in the method.

  • As a matter of style, programmers should always use this annotation

  • on the most deeply nested element where it is effective. If you want to

  • suppress a warning in a particular method, you should annotate that

  • method rather than its class.

  • @author Josh Bloch

  • @since 1.5

  • @jls 4.8 Raw Types

  • @jls 4.12.2 Variables of Reference Type

  • @jls 5.1.9 Unchecked Conversion

  • @jls 5.5.2 Checked Casts and Unchecked Casts

  • @jls 9.6.3.5 @SuppressWarnings

*/

@Target({TYPE, FIELD, METHOD, PARAMETER, CONSTRUCTOR, LOCAL_VARIABLE})

@Retention(RetentionPolicy.SOURCE)

public @interface SuppressWarnings {

/**

  • The set of warnings that are to be suppressed by the compiler in the

  • annotated element. Duplicate names are permitted. The second and

  • successive occurrences of a name are ignored. The presence of

  • unrecognized warning names is not an error: Compilers must

  • ignore any warning names they do not recognize. They are, however,

  • free to emit a warning if an annotation contains an unrecognized

最后,附一张自己面试前准备的脑图:

image

面试前一定少不了刷题,为了方便大家复习,我分享一波个人整理的面试大全宝典

  • Java核心知识整理

image

  • Spring全家桶(实战系列)

image.png

Step3:刷题

既然是要面试,那么就少不了刷题,实际上春节回家后,哪儿也去不了,我自己是刷了不少面试题的,所以在面试过程中才能够做到心中有数,基本上会清楚面试过程中会问到哪些知识点,高频题又有哪些,所以刷题是面试前期准备过程中非常重要的一点。

以下是我私藏的面试题库:

image

很多人感叹“学习无用”,实际上之所以产生无用论,是因为自己想要的与自己所学的匹配不上,这也就意味着自己学得远远不够。无论是学习还是工作,都应该有主动性,所以如果拥有大厂梦,那么就要自己努力去实现它。

最后祝愿各位身体健康,顺利拿到心仪的offer!
57526)]

很多人感叹“学习无用”,实际上之所以产生无用论,是因为自己想要的与自己所学的匹配不上,这也就意味着自己学得远远不够。无论是学习还是工作,都应该有主动性,所以如果拥有大厂梦,那么就要自己努力去实现它。

最后祝愿各位身体健康,顺利拿到心仪的offer!

  • 4
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值