Android: use AndroidX classes in styleguide
This updates the styleguide to recommend androidx.annotation.Nullable because android.support.* is generally deprecated. We've already migrated chromium to the AndroidX imports, so this just updates the styleguide to be in line with our current practices. This deletes the word "other" from the section header because this is the only reference I could find to Java annotations. Test: tools/md_browser/md_browser.py styleguide/java/java.md Test: Upload to gerrit > open file > click "gitiles" Change-Id: I84a78e3396fc05eeabda1114aab1658593a9be66 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2593182 Auto-Submit: Nate Fischer <ntfschr@chromium.org> Commit-Queue: Andrew Grieve <agrieve@chromium.org> Reviewed-by: Andrew Grieve <agrieve@chromium.org> Cr-Commit-Position: refs/heads/master@{#837588}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
8f03df37d5
commit
74cd25c0d4
@ -124,12 +124,12 @@ Classes that need destructor logic should provide an explicit `destroy()`
|
||||
method. Use [LifetimeAssert](https://chromium.googlesource.com/chromium/src/+/master/base/android/java/src/org/chromium/base/LifetimeAssert.java)
|
||||
to ensure in debug builds and tests that `destroy()` is called.
|
||||
|
||||
### Other Android Support Library Annotations
|
||||
### AndroidX Annotations
|
||||
* Use them! They are [documented here](https://developer.android.com/studio/write/annotations).
|
||||
* They generally improve readability.
|
||||
* Some make lint more useful.
|
||||
* `javax.annotation.Nullable` vs `android.support.annotation.Nullable`
|
||||
* Always prefer `android.support.annotation.Nullable`.
|
||||
* `javax.annotation.Nullable` vs `androidx.annotation.Nullable`
|
||||
* Always prefer `androidx.annotation.Nullable`.
|
||||
* It uses `@Retention(SOURCE)` rather than `@Retention(RUNTIME)`.
|
||||
|
||||
## Tools
|
||||
|
Reference in New Issue
Block a user