Giter Site home page Giter Site logo

Comments (3)

msridhar avatar msridhar commented on June 7, 2024

The issue is that you call this.properties.username() (and password()) inside a lambda body. NullAway doesn't know when the lambda function will be invoked, and it does not assume that username() and password() will remain non-null until that point. If you store this.properties.username() and password() in local variables and do both the isNotEmpty() checks and the uses with those locals, everything will work (since the value of the local variables cannot change).

from nullaway.

ilopezv avatar ilopezv commented on June 7, 2024

I know that the issue is closed, but it is not a similar case?
There is no lambda and nullpointer checks have been made at line 43.

image

KnownInitializers has been configured with org.apache.commons.collections4.isNotEmpty

-XepOpt:NullAway:KnownInitializers=org.springframework.util.Assert.notNull,org.apache.commons.collections4.isNotEmpty \
-XepOpt:NullAway:CheckOptionalEmptiness=true \ 

And the error still appears at line 45

[ERROR] /C:/santalucia/workspace/ams-spring-data/ams-spring-data-rest/src/main/java/com/santalucia/arq/ams/data/rest/config/repository/AmsRepositoryRestConfigurer.java:[45,52] [NullAway] dereferenced expression properties.exposeIdsFor() is @Nullable
[ERROR]     (see http://t.uber.com/nullaway )
[ERROR]   Did you mean '@SuppressWarnings("NullAway") @Override'?

from nullaway.

msridhar avatar msridhar commented on June 7, 2024

This is a different case. I don't think the KnownInitializers flag is being used correctly; that flag is for (most likely inherited) methods that behave like constructors almost and run before other methods in the class:

https://github.com/uber/NullAway/wiki/Configuration#known-initializers

For this case, we seem to be missing a model for the relevant CollectionUtils.isNotEmpty() method. That would be added around here:

.put(methodRef("spark.utils.CollectionUtils", "isNotEmpty(java.util.Collection<?>)"), 0)

A PR with a fix would be welcome!

from nullaway.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.