Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix false positive involving type parameter @nullable annotations.
NullAway doesn't currently support `@Nullable` annotations on type parameters. However, we had an error where a `@Nullable` annotation in a type parameter of the return type of a method was being interpreted as applying to the method return itself. For example: ``` public static <R> Foo<@nullable R> bar() { ... } public static void baz() { bar().toString(); } ``` would mistakenly be considered a null dereference. We introduce an additional check to `NullabilityUtil.getTypeUseAnnotations(...)` which will retrieve the method return annotation for the following cases: ``` @nullable public static <R> Foo<R> bar() @nullable public static <R> Foo<@nullable R> bar() public static <R> @nullable Foo<R> bar() ``` Yet ignore the annotation inside the type parameter of `Foo`. It is possible we might need to refactor this check when we actually start handling nullability of type parameters.
- Loading branch information