当前位置:网站首页>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开发全套学习资料》送给大家,初衷也很简单,就是希望帮助到想自学又不知道该从何学起的朋友,同时减轻大家的负担。添加下方名片,即可获取全套学习资料哦
边栏推荐
- Guarantee WIFI security in home and enterprise-with AC and AP networking experiment
- 21 Day Learning Challenge Schedule
- DNS的解析流程
- LeetCode brush topic series - 787 K station transfer within the cheapest flight
- There are more and more talents in software testing. Why are people still reluctant to take the road of software testing?
- Luogu mini game Daquan (everyone who uses Luogu must know)
- Redis database
- 51 MCU Peripherals: Infrared Communication
- 字节面试题:如何保证缓存和数据库的一致性
- 上海交大牵手淘宝成立媒体计算实验室:推动视频超分等关键技术发展
猜你喜欢
随机推荐
深入剖析成员变量和局部变量的初始化问题
腾讯大咖分享 | 腾讯Alluxio(DOP)在金融场景的落地与优化实践
flex layout (flexible layout)
Use the browser's local storage to realize the function of remembering the user name
nacos注册中心
Detailed installation and configuration of golang environment
保证家里和企业中的WIFI安全-附AC与AP组网实验
leetcode括号匹配问题——32.最长有效括号
跨桌面端Web容器演进
pytorch基本操作:使用神经网络进行分类任务
Install and use Google Chrome
Deep learning - CNN realizes the recognition of MNIST handwritten digits
Redis-cluster mode (master-slave replication mode, sentinel mode, clustering mode)
rhce作业
Redis(十一) - 异步优化秒杀
Alluxio为Presto赋能跨云的自助服务能力
秒杀系统小demo
直播系统聊天技术(八):vivo直播系统中IM消息模块的架构实践
6W+字记录实验全过程 | 探索Alluxio经济化数据存储策略
An advanced method for solving palindromes









