Skip to content

Annotate the remaining public classes under collect for nullness.#5664

Closed
copybara-service[bot] wants to merge 1 commit into
masterfrom
test_384698326
Closed

Annotate the remaining public classes under collect for nullness.#5664
copybara-service[bot] wants to merge 1 commit into
masterfrom
test_384698326

Conversation

@copybara-service

Copy link
Copy Markdown
Contributor

Annotate the remaining public classes under collect for nullness.

And fix the annotations on the paddedPartition methods: I had annotated them as returning a series of lists of T, but in fact they return a series of lists of @Nullable T. We got away with this because of a combination of:

  • an unncessary cast to List<T> in Iterators.paddedPartition
  • a bug in our nullness checker that permits a cast from List<@Nullable T> to List<T> without warning

I was going to say that I suspected that the bug is fundamentally the same bug as b/192579700. (Regardless, I'll try to add a sample input for both this problem and b/192579700 so that we can eventually work toward fixing both.) But from glancing at how I originally annotated this file when I was using the stock Checker Framework back in 2019, I get the impression that even it may have somehow missed this. If so, I'll ideally also report the problem upstream.

Finally, I'll note that this CL includes tiny steps toward addressing #989 (particularly the part reported as #1015), albeit only inside implementation code.

RELNOTES=n/a

And fix the annotations on the `paddedPartition` methods: I had annotated them as returning a series of lists of `T`, but in fact they return a series of lists of `@Nullable T`. We got away with this because of a combination of:

- an unncessary cast to `List<T>` in `Iterators.paddedPartition`
- a bug in our nullness checker that permits a cast from `List<@nullable T>` to `List<T>` without warning

I was going to say that I suspected that the bug is fundamentally the same bug as b/192579700. (Regardless, I'll try to add a sample input for both this problem and b/192579700 so that we can eventually work toward fixing both.) But from glancing at how I originally annotated this file when I was using the stock Checker Framework back in 2019, I get the impression that even it may have somehow missed this. If so, I'll ideally also report the problem upstream.

Finally, I'll note that this CL includes tiny steps toward addressing #989 (particularly the part reported as #1015), albeit only inside implementation code.

RELNOTES=n/a
PiperOrigin-RevId: 384698326
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant