You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/home/xeno/IdeaProjects/untitled/src/main/java/org/example/Main.java:10: error: [NullAway] returning @Nullable expression from method with @NonNull return type
it's talking about the map lambda
project.getObjects().property(String.class).map( s -> null);
but the gradle implementation very clearly allows a nullable return.
afaik, gradle api is comprehensively annotated with non null as the default. It's used by kotlin consumers with null safety in mind.
The text was updated successfully, but these errors were encountered:
xenoterracide
changed the title
incorrect non null return with gradle and jetbrains annotations
false positive non null return with gradle and jetbrains annotations
Jan 6, 2025
Will take me a bit of time to dig into this one. There are some places where we initially special-cased JSpecify annotations, and I think that was a mistake; we should just accept any @Nullable annotation like we do elsewhere in NullAway, until we see it causing problems. So we can fix that.
But beyond that, I think we will need proper support for inference on generic methods (#1075) before we can support code like this. In this case I assume map is a generic method, and we need to infer that it's ok to treat its output type as @Nullable.
note: worth saying that I believe that gradle will be moving to jspecify in version 9, there's a ticket related to that ... somewhere, linked in another ticket.
it's talking about the
map
lambdabut the gradle implementation very clearly allows a nullable return.
copypasta of gradles source
bug.tar.gz
reproducer uses dynamic versions, so here's the at time of writing resolutions that I think are important.
afaik, gradle api is comprehensively annotated with non null as the default. It's used by kotlin consumers with null safety in mind.
The text was updated successfully, but these errors were encountered: