- Stack Overflow Public questions & answers
- Stack Overflow for Teams Where developers & technologists share private knowledge with coworkers
- Talent Build your employer brand
- Advertising Reach developers & technologists worldwide
- About the company

Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Not annotated parameter overrides @??? parameter
While overriding code:
from: org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader
I receive an IntelliJ warning:
Not annotated parameter overrides @??? parameter less... (Strg+F1) Inspection info: Reports problems related to @Nullable and @NotNull annotations usage configured in Constant conditions & exceptions inspection.
What can I do to avoid that?
- intellij-idea
Explanation
Although I can't reproduce this on AbstractItemCountingItemStreamItemReader from this artifact
, this annotation means that the parent method has some @NotNull / @NonNull annotation on the parameter, while the overriding method has no.
To fix it, you need to put the same annotation on the overriding method.
As I wrote, there is no such annotation in the version I've downloaded, but check your sources and copy the parameter annotation from there.
This warning sometimes gets buggy, so it can help to restart the IDEA. Restarting helped when I tried to write a trivial example to reproduce the warning.
A trivial reproducible example
Parent class:
Child class:

- Specially note that non-annotating @Nullable method does not provoke any warning.
- Warning only worked after IDEA restart.
- The whole inspection looks to work pretty buggy, if you turn on/off the checkboxes in the inspection settings and try to reproduce them. So, again, restarting/invalidating caches may help to get rid or show the incorrect warning.

Your Answer
Sign up or log in, post as a guest.
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service , privacy policy and cookie policy
Not the answer you're looking for? Browse other questions tagged spring intellij-idea warnings nullable notnull or ask your own question .
- The Overflow Blog
- How Intuit democratizes AI development across teams through reusability sponsored post
- The nature of simulating nature: A Q&A with IBM Quantum researcher Dr. Jamie...
- Featured on Meta
- We've added a "Necessary cookies only" option to the cookie consent popup
- Launching the CI/CD and R Collectives and community editing features for...
- The [amazon] tag is being burninated
- Temporary policy: ChatGPT is banned
- Staging Ground Beta 1 Recap, and Reviewers needed for Beta 2
Hot Network Questions
- Is there a single-word adjective for "having exceptionally strong moral principles"?
- Google maps for Space exploration
- Is the God of a monotheism necessarily omnipotent?
- Create a structure to store student data and display all the records in the array
- Is it ok to run post hoc comparisons if ANOVA is nearly significant?
- Linear Algebra - Linear transformation question
- Does melting sea ices rises global sea level?
- FAA Handbooks Copyrights
- My code is GPL licensed, can I issue a license to have my code be distributed in a specific MIT licensed project?
- How can I measure the power in mW of a radio signal?
- Rolling cube on an infinite chessboard
- Quotients of number fields by certain prime powers
- A Swiss watch company seized my watch, saying it was stolen. I bought it 10 years ago, is that legal?
- What is the point of Thrower's Bandolier?
- "Is" or "are" for two uncountable words?
- Should sticker on top of HDD be peeled?
- Can carbocations exist in a nonpolar solvent?
- How do you ensure that a red herring doesn't violate Chekhov's gun?
- What is the name of the color used by the SBB (Swiss Federal Railway) in the 1920s to paint their locomotive?
- std::to_array for multi dimensional array
- Heap implementation in C
- How to protect big bundle of NM cable near attic scuttle hole?
- Why isn't light switch turning off the outlet?
- Disconnect between goals and daily tasks...Is it me, or the industry?
Your privacy
By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy .
[Solved]-Not annotated parameter overrides @NonNullApi parameter-Springboot
https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/lang/NonNullApi.html :
A common Spring annotation to declare that parameters and return values are to be considered as non-nullable by default for a given package.
Here's the org/springframework/core/convert/converter/package-info.java :
@NonNullApi can be overridden at the method level with the @Nullable annotation to prevent the warning for a method that might return null, and that's what you see in org.springframework.core.convert.converter.Converter :
On you overriding method you don't specify the @Nullable annotation and thus the warning.

Related Query
- Not annotated parameter overrides @NonNullApi parameter
- Parameter 0 of constructor in required a bean of type 'java.lang.String' that could not be found
- Spring @Value annotated method, use default value when properties not available
- intellij - spring-boot is not being recognised (unmapped Spring-boot annotated configuration classes)
- Parameter 0 of method setUserService in <method> required a bean of type <service> that could not be found
- @Converter annotated class not getting auto detected in spring-boot project
- Spring Retry: method annotated with @Recover not being called
- Parameter value [%Gabrek%] did not match expected type [java.lang.Character (n/a)];
- Required MultipartFile parameter 'file' is not present
- Required MultipartFile parameter is not present - Spring Boot REST POST
- Parameter 1 of constructor in required a bean of type 'org.springframework.social.connect.ConnectionRepository' that could not be found
- Call @Retryable method in a method that is annotated with @Async not working
- Jpa Repository save Inferred type 'S' for type parameter 'S' is not within its bound
- Test annotated with @DataJpaTest not autowiring field annotated with @Autowired
- Method annotated with @Async not called asynchronously and ContextRefreshedEvent is received before application context starts
- InvalidDataAccessApiUsageException: Parameter value element did not match expected type
- named parameter [yyy] is not registered with this procedure call
- Required String parameter 'email' is not present
- Check if a parameter is specified or not into the URL
- Inferred type 'S' for type parameter 'S' is not within its bound; should extend 'com.example.srilanka.model.Employee'
- Long parameter is not present error
- Swagger-UI Does not display with SpringBoot and path parameter on root endpoint
- spring hibernate did not get the value of parameter
- Circuit Breaker does not work when a method annotated with HystrixCommand calls another method which throws exception
- Spring Data Rest + Spring Boot - findBy* not passing parameter to MongoDB?
- Parameter value [1234567890] did not match expected type [scala.Option (n/a)]
- Parameter value [....] did not match expected type [java.util.Collection (n/a)]
- Spring boot Thymeleaf context parameter is not passed to template
- java.lang.IllegalArgumentException: Could not locate named parameter [user], expecting one of [min, gender, max]
- Annotated class with @Secured and @PreAuthorize does not secure super methods
More Query from same tag
- Having a service called with STOMP which accepts more than one parameter
- Spring Boot security custom Login page to different url "/" not working
- Creating json-object with auto increment for POST reqest to save in DB
- Hibernate JPA: 'IS EMPTY' condition doesn't work for collections passed as parameters
- Using @JsonView with Spring Hateoas
- What does CascadeType.MERGE actually do?
- Pageable in spring for paging on List<Object> is not working
- Spring Boot control target JAR file name
- Use batch mode for dynamic listener
- Create Jacoco report for external repository
- Spring Boot 1.5.1 caches JSP
- How to define a bean from a dependency class as @Primary in Spring?
- spring profile not loading some properties?
- Kafka consumer- Pause polling of event from specific kafka topic partition to use it as delayed queue
- Generate title cased fields with JPA/Spring Boot on Postgres
- Cannot resolve symbol org.springframework.test.web.server
- How to get Person instead of Mono<Person>?
- apache-camel : How to split a collections of objects and iterate on each on them?
- The temporary upload location [/tmp/tomcat.4296537502689403143.5000/work/Tomcat/localhost/ROOT] is not valid
- Springboot - Thymeleaf tries to resolve files it should not
- Spring Boot variable to lowercase
- Spring Boot and Database Initialization - could not find data.sql
- layout:decorate is not working in thymeleaf
- Spring JPA: How do we sort by an attribute present in an Embedded class
- Spring doesn't track changes on files stored in "./resources/" folder
- Docker - "image operating system "linux" cannot be used on this platform" while trying to build image
- How can I make optional OpenAPI parameters nullable using springdoc-openapi?
- How create JPA/persistence for a SQL view
- Docker RabbitMQ Spring java.net.UnknownHostException: rabbitmq: Name or service not known
- How to restrict resource acess with an api gateway

Copyright 2023 www.appsloveworld.com . All rights reserved.
Not annotated parameter overrides @NonNullApi parameter

idea警告,就下面这样
Not annotated parameter overrides @NonNullApi parameter

Not annotated parameter overrides @NotNull parameter
这个警告看起来很不友好,看起来是让你加上@NotNull注解或者@NonNullApi ,但是加了根本没用!!! 虽然只是警告 但是强迫症很难受!!!
直译:没有被注解的参数重写了@NonNullApi参数 这个提示是说因为被重写的方法的包被这个@NonNullApi注解了,所以方法参数也需要被注解 提示Not annotated parameter是说没有给参数加注解,至于加啥注解提示里没说。
解决方式(两种)
使用“javax.annotation.nonnull”注解可以解决.
直接给参数添加@Nonnull注解
使用“org.springframework.lang.NonNullApi”注解可以解决

“相关推荐”对你有帮助么?

请填写红包祝福语或标题

你的鼓励将是我创作的最大动力

您的余额不足,请更换扫码支付或 充值

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

IDE extension that lets you fix coding issues before they exist!
Setup is effortless and analysis is automatic for most languages
Self-Hosted
Fast, accurate analysis; enterprise scalability
When using null-related annotations at global scope level, for instance using javax.annotation.ParametersAreNonnullByDefault (from JSR-305) at package level, it means that all the parameters to all the methods included in the package will, or should, be considered Non- null . It is equivalent to annotating every parameter in every method with non-null annotations (such as @Nonnull ).
The rule raises an issue every time a parameter could be null for a method invocation, where the method is annotated as forbidding null parameters.
Noncompliant Code Example
Compliant solution.
Two solutions are possible:
- The signature of the method is correct, and null check should be done prior to the call.
- The signature of the method is not coherent and should be annotated to allow null values being passed as parameter

IMAGES
VIDEO
COMMENTS
, this annotation means that the parent method has some @NotNull / @NonNull annotation on the parameter, while the overriding method has no. To
The bug is that this warning appears when "@NonNull" should be used to annotate an overridden parameter, but the warning text indicates that
What steps will reproduce the issue? ... What is the expected result? Smth like "Not annotated parameter overrides NotNull parameter", or no warnings. What
@NonNullApi can be overridden at the method level with the @Nullable annotation to prevent the warning for a method that might return null, and that's what you
Android : Meaning of Android Studio error: Not annotated parameter overrides @NonNull parameter [ Beautify Your Computer
Not annotated parameter overrides @NotNull parameter ... The purpose is to allow the compiler to warn when certain assumptions are being violated
parameter is annotated, the analyzer reports an error if the pointer is null., Optional pointer parameters When a pointer parameter annotation, This annotation
现象:idea报错,就下面这样Not annotated parameter overrides @NonNullApi parameter类似的还有这个:Not annotated parameter overrides @NotNull
The signature of the method is not coherent and should be annotated to allow null values being passed as parameter. @javax.annotation.
... parameters for onCommand, over commandsender, command and st, with the message "Not annotated parameter overrides @NotNull parameter"