Android: fix styleguide for BuildConfig changes
No change to logic, only docs. This updates the Java style guide for BuildConfig.ENABLE_ASSERTS: * BuildConfig moved to the "org.chromium.build" package in https://crrev.com/c/2774858 * DCHECK_IS_ON was renamed to ENABLE_ASSERTS by https://crrev.com/c/2731127 Test: Upload to gerrit > open file > click "gitiles" Change-Id: I414be4b35c08bf8a85d70de6154e2ed0b71ea212 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2937883 Commit-Queue: Nate Fischer <ntfschr@chromium.org> Commit-Queue: Andrew Grieve <agrieve@chromium.org> Auto-Submit: Nate Fischer <ntfschr@chromium.org> Reviewed-by: Andrew Grieve <agrieve@chromium.org> Cr-Commit-Position: refs/heads/master@{#889088}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
be30cbdeef
commit
4570ebc331
@ -94,7 +94,8 @@ step](https://codereview.chromium.org/2517203002)). You should use asserts in
|
||||
the [same
|
||||
scenarios](https://chromium.googlesource.com/chromium/src/+/main/styleguide/c++/c++.md#CHECK_DCHECK_and-NOTREACHED)
|
||||
where C++ DCHECK()s make sense. For multi-statement asserts, use
|
||||
`org.chromium.base.BuildConfig.DCHECK_IS_ON` to guard your code.
|
||||
`org.chromium.build.BuildConfig.ENABLE_ASSERTS` to guard your code (similar to
|
||||
`#if DCHECK_IS_ON()` in C++).
|
||||
|
||||
Example assert:
|
||||
|
||||
@ -102,10 +103,14 @@ Example assert:
|
||||
assert someCallWithoutSideEffects() : "assert description";
|
||||
```
|
||||
|
||||
Example use of `DCHECK_IS_ON`:
|
||||
Example use of `BuildConfig.ENABLE_ASSERTS`:
|
||||
|
||||
```java
|
||||
if (org.chromium.base.BuildConfig.DCHECK_IS_ON) {
|
||||
import org.chromium.build.BuildConfig;
|
||||
|
||||
...
|
||||
|
||||
if (BuildConfig.ENABLE_ASSERTS) {
|
||||
// Any code here will be stripped in Release by ProGuard.
|
||||
...
|
||||
}
|
||||
|
Reference in New Issue
Block a user