0

Revert "Android: Add Error Prone warning against Java stream() apis"

This reverts commit e910d272c0.

Reason for revert: crbug.com/344943957#comment13

Original change's description:
> Android: Add Error Prone warning against Java stream() apis
>
> And minor clarifying tweaks to style guide wrt streams
>
> Bug: 344943957
> Change-Id: I90b976866c8f3f71826459b7d3097692e1f533b4
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6042674
> Auto-Submit: Andrew Grieve <agrieve@chromium.org>
> Commit-Queue: Andrew Grieve <agrieve@chromium.org>
> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1388426}

Bug: 344943957
Change-Id: Ib9b3d8db9f47383eaced5192a15e7cac6427da35
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6051419
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Auto-Submit: Keigo Oka <oka@chromium.org>
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Andrew Grieve <agrieve@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1388467}
This commit is contained in:
Keigo Oka
2024-11-26 21:39:34 +00:00
committed by Chromium LUCI CQ
parent 35bae7079b
commit 8ff33dbc1d
6 changed files with 8 additions and 58 deletions
build/android/gyp
chrome/browser/tabmodel/android/java/src/org/chromium/chrome/browser/tabmodel
styleguide/java
tools/android/errorprone_plugin
BUILD.gnOWNERS
src
org
chromium
tools
errorprone

@ -261,18 +261,16 @@ Log.d(TAG, "There are %d cats", countCats()); // countCats() not stripped.
### Streams
Using [Java streams] outside of tests is strongly discouraged. If you can write
your code as an explicit loop, then do so. The primary reason for this guidance
is because the lambdas (and method references) needed for streams almost always
result in larger binary size than their loop equivalents (see
[crbug.com/344943957] for examples).
Most uses of [Java streams] are discouraged. If you can write your code as an
explicit loop, then do so. The primary reason for this guidance is because the
lambdas (and method references) needed for streams almost always result in
larger binary size ([example](https://chromium-review.googlesource.com/c/chromium/src/+/4329952).
The `parallel()` and `parallelStream()` APIs are simpler than their loop
equivalents, but are banned due to a lack of a compelling use case in Chrome.
If you find one, please discuss on `java@chromium.org`.
equivalents, but are are currently banned due to a lack of a compelling use case
in Chrome. If you find one, please discuss on `java@chromium.org`.
[Java streams]: https://docs.oracle.com/javase/8/docs/api/java/util/stream/package-summary.html
[crbug.com/344943957]: https://crbug.com/344943957
### AndroidX Annotations {#annotations}