New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EnsuresNonNull false positive #4685
Comments
I'm sorry you are having trouble. The Nullness Checker does infer that Here are three things you could do for the
(A side note: it's easier to experiment with your code if you provide a compilable example. Your example is missing import statements and uses many classes that are not part of the JDK. Also, the error message refers to line 220, which does not exist in the code snippet you provided.) |
@npepinpe Does the answer resolve your problem? |
I'm closing this because of no answer from the original poster after (I believe) resolving the issue. |
First off, I'm just starting out with the Checker Framework, so it's possible I'm simply doing something wrong, but it seems to me like the documentation implies I can use
EnsuresNonNull
for the following:I have a class as so:
Note that
producerFactory.newProducer()
returns a@NonNull
annotated type. When running the framework, I still get the following error:I use the Maven integration as specified in the docs, and simply run
mvn compile
. I didn't change the profiles or any of the settings from the docs. I'm also on Java 11.I expect here that the method correctly ensures that
producer
is never null, and that other methods can transitively declare the same by calling this method.Note that the
producer
property is annotated as@Nullable
on purpose, as the producer may be null'd at times.The text was updated successfully, but these errors were encountered: