In latest Guava 33.4.8 Sets.newHashSet the parameter elements are of @Nullable type, but NullAway fails to recognize it.
https://github.com/google/guava/blob/f06690fa3e874f65515e8fd338a74d636e2c792f/guava/src/com/google/common/collect/Sets.java#L200-L205
@SuppressWarnings("NonApiType") // acts as a direct substitute for a constructor call
public static <E extends @Nullable Object> HashSet<E> newHashSet(E... elements) {
HashSet<E> set = newHashSetWithExpectedSize(elements.length);
Collections.addAll(set, elements);
return set;
}
Error:
/var/home/user/workspace/nullaway-test/WebsiteProvider.java:50: error: [NullAway] passing @Nullable parameter 'website' where @NonNull is required
final Set<String> params = Sets.newHashSet(website, company);
^
(see http://t.uber.com/nullaway )
This got flagged only after recently bumping NullAway and Guava versions. It used to work before.