当前位置:网站首页>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开发全套学习资料》送给大家,初衷也很简单,就是希望帮助到想自学又不知道该从何学起的朋友,同时减轻大家的负担。添加下方名片,即可获取全套学习资料哦
边栏推荐
猜你喜欢
About the directory structure of the web application
网安学习-内网渗透4
机器学习——支持向量机原理
关于 VS Code 优化启动性能的实践
Mysql数据库 | 基于Docker搭建Mysql-8.0以上版本主从实例实战
51 MCU peripherals: DS18B20
上海交大牵手淘宝成立媒体计算实验室:推动视频超分等关键技术发展
说好的女程序员做测试有优势?面试十几家,被面试官虐哭~~
Double for loop case (use js jiujiu printing multiplication table)
Redis-----非关系数据库
随机推荐
Meta公司内部项目-RaptorX:将Presto性能提升10倍
Brush LeetCode topic series - 10. Regular expression match
Different ways of shell scripting
测试技术之APP蓝牙连接测试
为什么4个字节的float要比8个字节的long大呢?
Common functions of pytorch
Shell 脚本不同玩法
Contents of encoding-indexes.js file printed with Bluetooth:
Leetcode parentheses matching problem -- 32. The longest parentheses effectively
What are the ways to improve software testing capabilities?After reading this article, it will take you up a notch
直播系统聊天技术(八):vivo直播系统中IM消息模块的架构实践
如何进行并发数计算(稳定性测试和压力测试)?
APP Bluetooth connection test of test technology
跨桌面端Web容器演进
golang generics
代码编世界 科技创未来
自动化运维工具——ansible、概述、安装、模块介绍
nacos注册中心
Point Density-Aware Voxels for LiDAR 3D Object Detection 论文笔记
[C language] LeetCode26. Delete duplicates in an ordered array && LeetCode88. Merge two ordered arrays