当前位置:网站首页>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开发全套学习资料》送给大家,初衷也很简单,就是希望帮助到想自学又不知道该从何学起的朋友,同时减轻大家的负担。添加下方名片,即可获取全套学习资料哦
边栏推荐
- 软件测试的需求人才越来越多,为什么大家还是不太愿意走软件测试的道路?
- The virtual reality real estate display system foresees the future decoration effect in advance
- Shuttle + Alluxio 加速内存Shuffle起飞
- 51 MCU peripherals: ADC
- kubernetes 亲和、反亲和、污点、容忍
- Say good woman programmers do testing have an advantage?More than a dozen interview, abuse of cry ~ ~ by the interviewer
- How to perform concurrent calculation (stability test and stress test)?
- 21 Day Learning Challenge Schedule
- Packaging and deployment of go projects
- C语言小游戏——扫雷小游戏
猜你喜欢
随机推荐
软件测试在职2年跳槽4次,你还在怪老板不给你涨薪?
selenium + robotframework的运行原理
BGP experiment (route reflector, federation, route optimization)
51 MCU peripherals: ADC
51单片机外设篇:红外通信
The Go language learning notes - dealing with timeout - use the language from scratch from Context
构造方法、成员变量、局部变量
软件测试的需求人才越来越多,为什么大家还是不太愿意走软件测试的道路?
Difference and analysis of CPU usage and load
自动化运维工具——ansible、概述、安装、模块介绍
Smart people's game improvement: Chapter 3, Lesson 2: "Number of Tongtong" (number)
如何进行并发数计算(稳定性测试和压力测试)?
Machine learning -- - theory of support vector machine (SVM)
洛谷小游戏大全(用洛谷的人都得知道)
Redis(十一) - 异步优化秒杀
coredns介绍
C语言小游戏——扫雷小游戏
C语言中i++和++i在循环中的差异性
Shuttle + Alluxio 加速内存Shuffle起飞
[C language] LeetCode26. Delete duplicates in an ordered array && LeetCode88. Merge two ordered arrays









