Age | Commit message (Collapse) | Author |
|
Change-Id: I62e8c26d31cd26cde61de415f24726c8a4d12b60
|
|
update_for_crash am: 6390a8d8dc am: 19207ba68a am: 73f6211dbc
Original change: https://android-review.googlesource.com/c/platform/external/nullaway/+/2854014
Change-Id: I6beade98a4d1561c140ca947f6ecda3f3f5ca8f9
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
|
|
update_for_crash am: 6390a8d8dc am: 3486bbdf92 am: 3b75672bbf
Original change: https://android-review.googlesource.com/c/platform/external/nullaway/+/2854014
Change-Id: I19aeee0044fdd2919ce4edd398ebe5f8286add91
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
|
|
update_for_crash am: 6390a8d8dc am: 19207ba68a
Original change: https://android-review.googlesource.com/c/platform/external/nullaway/+/2854014
Change-Id: Id0120a67c13fe2dad6e08ffdb1592a9e507c32f1
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
|
|
update_for_crash am: 6390a8d8dc am: 3486bbdf92
Original change: https://android-review.googlesource.com/c/platform/external/nullaway/+/2854014
Change-Id: I910225e842c4d9e6bde5222fa4f41209fe23f696
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
|
|
update_for_crash am: 6390a8d8dc
Original change: https://android-review.googlesource.com/c/platform/external/nullaway/+/2854014
Change-Id: I64ffb69a0a8fe0dcf96eb2324fd5bff4b8c8c756
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
|
|
update_for_crash am: 6390a8d8dc
Original change: https://android-review.googlesource.com/c/platform/external/nullaway/+/2854014
Change-Id: If0651b3a585e0e55ff888f729d8ca654bcede5c9
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
|
|
* commit 'bf74867fbb7b3dd4ea1539060150036635b772a3':
Fix assertion check for structure of enhanced-for loop over a Map keySet (#868)
Prepare next development version.
Prepare for release 0.10.17
Fix bug with computing direct type use annotations on parameters (#864)
Model Apache Flink's RichFunction.open as an @Initializer method (#862)
Apply minor cleanups suggested by IntelliJ in generics code (#860)
Clarifications and small fixes for checking JSpecify @Nullable annotation (#859)
Create com.uber.nullaway.generics package (#855)
JSpecify: handling the return of a diamond operator anonymous object method caller (#858)
JSpecify: adding com.google.common to annotated packages in build.gradle (#857)
JSpecify: fix crash with calls to static methods (#856)
Prepare next development version.
Change-Id: Iede61970989608371bc156e92fe33a1bcc61e2b7
|
|
Fixes #866
Before, we would check that an enhanced-for loop includes a call to
`Set.iterator()` on the result of calling `Map.keySet()`. However, it is
possible and legal that statically, the target of this call is instead
`Collection.iterator()`. So, we change our check to test the receiver
type passed into the call (which must still be a `Set`). Also,
opportunistically switch a couple of places we were throwing
`RuntimeException` around this check to throw the more meaningful
`VerifyException`. Unfortunately, we have not found a way to add a test
in open-source to reproduce the failure from #866 but we have confirmed
this change fixes the problem.
|
|
Change-Id: I63c7db02e4a7ebd8ec22d7dee8dca9f55118d3b2
|
|
Original change: https://android-review.googlesource.com/c/platform/external/nullaway/+/2831254
Change-Id: I906b4ad9e552cf0f35237614dae22675297466e8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
|
|
683dfed778 am: 5af8b817a0 am: 55e80993ce
Original change: https://android-review.googlesource.com/c/platform/external/nullaway/+/2831253
Change-Id: I07faf3a3f541a1f49bfea123309093080e6f9fdd
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
|
|
Original change: https://android-review.googlesource.com/c/platform/external/nullaway/+/2831254
Change-Id: I6fccf035571f819fd9d024bc90e4e675373c2fbb
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
|
|
683dfed778 am: 3b51819bb2 am: 21dd832874
Original change: https://android-review.googlesource.com/c/platform/external/nullaway/+/2831253
Change-Id: Icf0794f5e1c9bad41fff0d386c834891fdbaa4f0
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
|
|
Original change: https://android-review.googlesource.com/c/platform/external/nullaway/+/2831254
Change-Id: I399073f86070f3fa0009b5a469cd18520d1741c7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
|
|
683dfed778 am: 5af8b817a0
Original change: https://android-review.googlesource.com/c/platform/external/nullaway/+/2831253
Change-Id: Ieaaa39a559b0fd2eebfd5e18b314629c7ca6a657
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
|
|
Original change: https://android-review.googlesource.com/c/platform/external/nullaway/+/2831254
Change-Id: Iff8cbee8d789d25307996e6961ba86e257df551c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
|
|
683dfed778 am: 3b51819bb2
Original change: https://android-review.googlesource.com/c/platform/external/nullaway/+/2831253
Change-Id: Ie7a23a1b37c46467b94d776dbc3a4a9972493a26
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
|
|
Original change: https://android-review.googlesource.com/c/platform/external/nullaway/+/2831254
Change-Id: I69bf49c33cb68e19d696a3a5f6d83f6da32e133f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
|
|
683dfed778
Original change: https://android-review.googlesource.com/c/platform/external/nullaway/+/2831253
Change-Id: Ib783f557c18215d248e7fd285d6d9237f580cffe
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
|
|
Original change: https://android-review.googlesource.com/c/platform/external/nullaway/+/2831254
Change-Id: If0ffedb7a9bb59d8ba5c1b0af1ce1254f501b4c1
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
|
|
683dfed778
Original change: https://android-review.googlesource.com/c/platform/external/nullaway/+/2831253
Change-Id: I3b756761fa1a5cc119d8e75e17229b6617ffc096
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
|
|
|
|
|
|
NullAway was still treating annotations on generic type arguments as
being on the top-level type of a parameter itself, which could lead to
false positives and potentially also missed bugs.
|
|
From the
[docs](https://nightlies.apache.org/flink/flink-docs-master/api/java/org/apache/flink/api/common/functions/RichFunction.html#open-org.apache.flink.api.common.functions.OpenContext-)
here: `open(...)` should always be called before other methods,
such as `filter(...)`, so it fits our definition of an `@Initializer`
method.
|
|
Bug: 311064136
Test: m RUN_ERROR_PRONE=true javac-check
Change-Id: I33bfd234d9567051033d1b2ac3e65be96b84dc80
|
|
Remove unnecessary casts, switch to isEmpty() in a couple of places, fix
a typo. No behavior changes, just cleanup
|
|
Rename a variable and add docs to clarify that in certain places, our
JSpecify support specifically checks for
`@org.jspecify.annotations.Nullable` annotations and not others. Also,
fix a couple of places where we were comparing types by their `String`
representation.
|
|
Fixes #817. This is a refactoring with no semantic changes.
|
|
* commit '24db25eb2160a04377dd8b278b3cf99a89db914a': (244 commits)
Prepare for release 0.10.16.
JSpecify: handle Nullability for return types of lambda expressions for Generic Types. (#854)
JSpecify: Modify Array Type Use Annotation Syntax (#850)
JSpecify: handle Nullability for lambda expression parameters for Generic Types (#852)
Minor cleanup in AccessPathElement (#851)
Update to Gradle 8.4 and Error Prone 2.23.0 (#849)
JSpecify: handle return types of method references in Java Generics (#847)
Prepare next development version.
Prepare for release 0.10.15.
JSpecify: initial handling of generic enclosing types for inner classes (#837)
JSpecify: handle incorrect method parameter nullability for method reference (#845)
Update minimum Error Prone version and Guava version (#843)
Ignore another method for code coverage (#844)
Build NullAway with JSpecify mode enabled (#841)
Update to Checker Framework 3.39.0 (#839)
Ignore code coverage for method executed non-deterministically in tests (#838)
Properly check generic method overriding in explicitly-typed anonymous classes (#808)
Update to Error Prone 2.22.0 (#833)
Fix which JDKs are installed on CI (#835)
Run recent JDK tests on JDK 21 (#834)
...
Change-Id: I45c3950b1842521a06fbd8ff7dbf6ba4a008b6e4
|
|
caller (#858)
In reference to the
[exception](https://github.com/uber/NullAway/issues/791#issuecomment-1803020173)
mentioned in the discussion for #791 .
Adding the test case to reproduce the same issue:
```java
class Test {
static class B<T>{
String build(){return "x";}
}
static String testNegative() {
//We were getting the aforementioned mentioned exception when we tried to do this
return new B<>().build();
}
}
```
All unit tests have passed for the changes that were made for this.
---------
Co-authored-by: Manu Sridharan <msridhar@gmail.com>
|
|
Based on the fixes made in #856 , we should no longer get that exception
after adding com.google.common in the annotated packages when running in
JSpecify mode.
|
|
After adding com.google.common to annotated packages for
buildWithNullAway in JSpecify Mode, we got the following exception:
```java
error: An unhandled exception was thrown by the Error Prone static analysis plugin.
return findEnclosingMethodOrLambdaOrInitializer(path, ImmutableSet.of());
com.google.common.util.concurrent.UncheckedExecutionException: java.lang.NullPointerException: castToNonNull failed!
at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2086)
at com.google.common.cache.LocalCache.get(LocalCache.java:4012)
at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:4035)
at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:5011)
Caused by: java.lang.NullPointerException: castToNonNull failed!
at com.uber.nullaway.NullabilityUtil.castToNonNull(NullabilityUtil.java:409)
at com.uber.nullaway.GenericsChecks.getGenericReturnNullnessAtInvocation(GenericsChecks.java:800)
at com.uber.nullaway.dataflow.AccessPathNullnessPropagation.genericReturnIsNullable(AccessPathNullnessPropagation.java:1031)
at com.uber.nullaway.dataflow.AccessPathNullnessPropagation.returnValueNullness(AccessPathNullnessPropagation.java:1008)
at com.uber.nullaway.dataflow.AccessPathNullnessPropagation.visit
```
With the call to ```java ImmutableSet.of()``` which is a static call, we
were wrongly trying to return null from getTreeType in
GenericChecks.java for this case which caused the above Exception.
A unit test which reproduces the issue has been added to
NullAwayJSpecifyGenerickChecks.java:
```java
import org.jspecify.annotations.Nullable;
import com.google.common.collect.ImmutableSet;
class Test {
static void funcImmutableSet(ImmutableSet<Object> is){
}
static void testNegative() {
//We were getting the issue on this line
funcImmutableSet(ImmutableSet.of());
}
}
```
All the unit tests from the NullAway build have passed for these
changes.
---------
Co-authored-by: Manu Sridharan <msridhar@gmail.com>
|
|
|
|
|
|
Generic Types. (#854)
```java
class Test {
interface A<T1 extends @Nullable Object> {
T1 function(Object o);
}
static void testPositive() {
// BUG: Diagnostic contains: returning @Nullable expression from method with @NonNull return type
A<String> p = x -> null;
}
static void testNegative() {
// We were reporting a false positive here since the indirect Nullability through the generic was not handled correctly.
A<@Nullable String> p = x -> null;
}
}
```
For the negative scenario mentioned above where we do not expect an
exception, we were getting a false positive. After computing the
Nullability correctly when it is indirectly applied through the generic
type we no longer get this false positive.
All the test cases in NullAwayJSpecifyGenericTests.java have passed for
these changes.
Similar changes for handling lambda parameters were made under
https://github.com/uber/NullAway/pull/852
---------
Co-authored-by: Manu Sridharan <msridhar@gmail.com>
|
|
Added unit tests for annotations on array in JSpecify mode and modified
behavior.
Currently, NullAway does not support `@Nullable` annotations on array
elements (#708). Both `@Nullable String[]` and `String @Nullable []` are
currently treated identically, and NullAway considers both annotations
as the array itself might be null.
This is the first step to bring the annotation syntax in line with
JSpecify norms, which treats `@Nullable String[]` as the array elements
could be null while `String @Nullable []` implies the array itself could
be null.
After this change, NullAway completely ignores type-use annotations on array element types, such
as `@Nullable String[]`, and only considers type-use annotations in the correct position for the top-level type, i.e.,
`String @Nullable []`. This is an intermediary change, and support for
type annotations will be extended eventually. Additionally, this
**only** applies to **JSpecify mode**
Unit tests currently conform to the current behavior of NullAway after
the changes and some tests have TODOs until we support annotations on
type and are able to detect the nullability of array elements.
---------
Co-authored-by: Manu Sridharan <msridhar@gmail.com>
Co-authored-by: Lázaro Clapp <lazaro.clapp@gmail.com>
|
|
Types (#852)
We were not getting the desired error for the positive test in the
following test case:
```java
class Test {
interface A<T1 extends @Nullable Object> {
String function(T1 o);
}
static void testPositive() {
// We were not getting the desired error here and these changes address that
// BUG: Diagnostic contains: dereferenced expression o is @Nullable
A<@Nullable Object> p = o -> o.toString();
}
static void testNegative() {
A<Object> p = o -> o.toString();
}
}
```
Upon changing the way we compute the Nullability of the functional
interface parameters, we are able to get the desired error.
Note: These changes only affect lambda parameters and do not deal with
return types. That will be addressed in a future PR.
---------
Co-authored-by: Manu Sridharan <msridhar@gmail.com>
|
|
Remove an unused method and add a use of Objects.equals()
|
|
Just to stay up to date. Fixed a couple new Error Prone warnings. Also
switch to GA JDK 21 in our CI config.
|
|
Adding new test case and the logic to handle the negative scenario of
the test case where we were getting a false positive earlier.
```Java
class Test {
interface A<T1 extends @Nullable Object> {
T1 function(Object o);
}
static @Nullable String foo(Object o) {
return o.toString();
}
static void testPositive() {
// BUG: Diagnostic contains: referenced method returns @Nullable
A<String> p = Test::foo;
}
static void testNegative() {
// We were getting a false positive error on this line as the Nullability of the overriden method was not identified
A<@Nullable String> p = Test::foo;
}
}
```
All test cases in NullAwayJSpecifyGenericTests.java passed for these
changes.
---------
Co-authored-by: Manu Sridharan <msridhar@gmail.com>
|
|
|
|
|
|
This is a step towards fixing #836. We now properly handle the case of a
generic enclosing type for an inner class type, both in checking
matching of type argument nullability and in pretty-printing for error
messages. We still don't handle `NewClassTree` types correctly which is
why #836 is not yet fixed.
Also fixes a bug in where generics checks were performed for `return`
statements. Previously we would only check generic type arguments if the
top-level nullability of the return type was `@NonNull`.
|
|
(#845)
We now report an error for the following test case:
```java
class Test {
interface A<T1 extends @Nullable Object> {
String function(T1 o);
}
static String foo(Object o) {
return o.toString();
}
static void testPositive() {
// we now report an error here, as foo's parameter need to be @Nullable
A<@Nullable Object> p = Test::foo;
}
static void testNegative() {
A<Object> p = Test::foo;
}
}
```
---------
Co-authored-by: Manu Sridharan <msridhar@gmail.com>
|
|
Fixes #842. Updating the minimum supported Error Prone version to 2.10.0
allows for some code cleanup in tests.
We also update our `README.md` (finally!) to mention the new minimum
version, to use the Gradle Error Prone plugin correctly, to mention the
Gradle NullAway plugin, and to not mention so many specific versions so
it doesn't get out of date so quickly in the future. This fixes #466.
|
|
Another fix related to #828 (see also #838)
|
|
This will give us a bit better test coverage as we continue to implement
JSpecify. With one small fix to an assertion check, now NullAway can
build itself in JSpecify mode without crashing!
|
|
Fixes #831 as Checker Framework dataflow now has support for JDK 21
constructs
|