当前位置:网站首页>Not annotated parameter overrides @NonNullApi parameter
Not annotated parameter overrides @NonNullApi parameter
2022-08-02 05:18:00 【m0_67392931】
现象
idea警告,就下面这样
Not annotated parameter overrides @NonNullApi parameter

类似的还有这个:
Not annotated parameter overrides @NotNull parameter
这个警告看起来很不友好,看起来是让你加上@NotNull注解或者@NonNullApi ,但是加了根本没用!!!
虽然只是警告 但是强迫症很难受!!!
问题说明
错误提示是
Not annotated parameter overrides @NonNullApi parameter
直译:没有被注解的参数重写了@NonNullApi参数
这个提示是说因为被重写的方法的包被这个@NonNullApi注解了,所以方法参数也需要被注解
提示Not annotated parameter是说没有给参数加注解,至于加啥注解提示里没说。
解决方式(两种)
使用“javax.annotation.Nonnull”注解可以解决
直接给参数添加@Nonnull注解
import javax.annotation.Nonnull;
@Slf4j
@Configuration
public class ScheduledConfigurer implements SchedulingConfigurer {
@Override
public void configureTasks(@Nonnull ScheduledTaskRegistrar taskRegistrar) {
taskRegistrar.setScheduler(taskExecutor());
}
}
使用“org.springframework.lang.NonNullApi”注解可以解决
在package-info.java文件中给包加上@NonNullApi注解
@NonNullApi
package com.jswdwsx.configurer;
import org.springframework.lang.NonNullApi;
先自我介绍一下,小编13年上师交大毕业,曾经在小公司待过,去过华为OPPO等大厂,18年进入阿里,直到现在。深知大多数初中级java工程师,想要升技能,往往是需要自己摸索成长或是报班学习,但对于培训机构动则近万元的学费,着实压力不小。自己不成体系的自学效率很低又漫长,而且容易碰到天花板技术停止不前。因此我收集了一份《java开发全套学习资料》送给大家,初衷也很简单,就是希望帮助到想自学又不知道该从何学起的朋友,同时减轻大家的负担。添加下方名片,即可获取全套学习资料哦
边栏推荐
- kubernetes 亲和、反亲和、污点、容忍
- What are the ways to improve software testing capabilities?After reading this article, it will take you up a notch
- 5款经典代码阅读器的使用方案对比
- 线程基础(一)
- 分布式文件存储服务器之Minio对象存储技术参考指南
- Cyber Security Learning - Intranet Penetration 4
- classSR论文阅读笔记
- [C language] LeetCode26. Delete duplicates in an ordered array && LeetCode88. Merge two ordered arrays
- About the directory structure of the web application
- kubernetes affinity, anti-affinity, taint, tolerance
猜你喜欢

点云旋转到参考坐标系方向(最小方向包围盒方法)

Home NAS server (4) | MergerFS and SnapRaid data backup

如何优化OpenSumi终端性能?

Stress testing and performance analysis of node projects

Say good woman programmers do testing have an advantage?More than a dozen interview, abuse of cry ~ ~ by the interviewer

虚拟现实房产展示系统提前预见未来装修效果

coredns介绍

Meta公司内部项目-RaptorX:将Presto性能提升10倍

51 microcontroller peripherals article: dot-matrix LCD

ATM系统
随机推荐
直播系统聊天技术(八):vivo直播系统中IM消息模块的架构实践
机器学习——支持向量机原理
nacos registry
6W+字记录实验全过程 | 探索Alluxio经济化数据存储策略
How to perform concurrent calculation (stability test and stress test)?
pl/sql之神奇的嵌套与变量生命周期
对node工程进行压力测试与性能分析
自动化运维工具——ansible、概述、安装、模块介绍
DNS的解析流程
MySQL数据表的基本操作和基于 MySQL数据表的基本操作的综合实例项目
eggjs controller层调用controller层解决方案
[OpenCV from entry to practice] image processing technology [pixel] (the most detailed in the whole network)
Constructors, member variables, local variables
测试环境要多少?从成本与效率说起
驱动页面性能优化的3个有效策略
classSR论文阅读笔记
腾讯大咖分享 | 腾讯Alluxio(DOP)在金融场景的落地与优化实践
为什么4个字节的float要比8个字节的long大呢?
双重for循环案例(用js打印九九乘法表)
洛谷小游戏大全(用洛谷的人都得知道)