Andrew Grieve | 8d9e40f | 2023-03-15 21:04:42 | [diff] [blame] | 1 | # Chromium Java Style Guide |
nyquist | 9d61f98 | 2017-02-10 00:29:08 | [diff] [blame] | 2 | |
| 3 | _For other languages, please see the [Chromium style |
John Palmer | be05130 | 2021-05-19 11:48:35 | [diff] [blame] | 4 | guides](https://chromium.googlesource.com/chromium/src/+/main/styleguide/styleguide.md)._ |
nyquist | 9d61f98 | 2017-02-10 00:29:08 | [diff] [blame] | 5 | |
| 6 | Chromium follows the [Android Open Source style |
| 7 | guide](http://source.android.com/source/code-style.html) unless an exception |
| 8 | is listed below. |
| 9 | |
nyquist | aae4c7c | 2017-02-15 20:41:42 | [diff] [blame] | 10 | You can propose changes to this style guide by sending an email to |
| 11 | `[email protected]`. Ideally, the list will arrive at some consensus and you can |
| 12 | request review for a change to this file. If there's no consensus, |
John Palmer | be05130 | 2021-05-19 11:48:35 | [diff] [blame] | 13 | [`//styleguide/java/OWNERS`](https://chromium.googlesource.com/chromium/src/+/main/styleguide/java/OWNERS) |
nyquist | aae4c7c | 2017-02-15 20:41:42 | [diff] [blame] | 14 | get to decide. |
| 15 | |
agrieve | 0e6bdf2 | 2018-08-03 14:25:24 | [diff] [blame] | 16 | [TOC] |
| 17 | |
Andrew Grieve | 8282bf2 | 2023-01-13 17:29:17 | [diff] [blame] | 18 | ## Java 10 Language Features |
Nate Fischer | 03308e9 | 2022-11-07 18:14:59 | [diff] [blame] | 19 | |
Andrew Grieve | 8d9e40f | 2023-03-15 21:04:42 | [diff] [blame] | 20 | ### Type Deduction using `var` |
Nate Fischer | 03308e9 | 2022-11-07 18:14:59 | [diff] [blame] | 21 | |
| 22 | A variable declaration can use the `var` keyword in place of the type (similar |
| 23 | to the `auto` keyword in C++). In line with the [guidance for |
| 24 | C++](https://google.github.io/styleguide/cppguide.html#Type_deduction), the |
| 25 | `var` keyword may be used when it aids readability and the type of the value is |
| 26 | already clear (ex. `var bundle = new Bundle()` is OK, but `var something = |
| 27 | returnValueIsNotObvious()` may be unclear to readers who are new to this part of |
| 28 | the code). |
| 29 | |
| 30 | The `var` keyword may also be used in try-with-resources when the resource is |
| 31 | not directly accessed (or when it falls under the previous guidance), such as: |
| 32 | |
| 33 | ```java |
| 34 | try (var ignored = StrictModeContext.allowDiskWrites()) { |
| 35 | // 'var' is permitted so long as the 'ignored' variable is not used directly |
| 36 | // in the code. |
| 37 | } |
| 38 | ``` |
| 39 | |
agrieve | 0e6bdf2 | 2018-08-03 14:25:24 | [diff] [blame] | 40 | ## Java 8 Language Features |
Andrew Grieve | 8d9e40f | 2023-03-15 21:04:42 | [diff] [blame] | 41 | |
Andrew Grieve | 8282bf2 | 2023-01-13 17:29:17 | [diff] [blame] | 42 | [D8] is used to rewrite some Java 7 & 8 language constructs in a way that is |
| 43 | compatible with Java 6 (and thus all Android versions). Use of [these features] |
| 44 | is encouraged. |
agrieve | 0e6bdf2 | 2018-08-03 14:25:24 | [diff] [blame] | 45 | |
Andrew Grieve | 8282bf2 | 2023-01-13 17:29:17 | [diff] [blame] | 46 | [D8]: https://developer.android.com/studio/command-line/d8 |
| 47 | [these features]: https://developer.android.com/studio/write/java8-support |
agrieve | 0e6bdf2 | 2018-08-03 14:25:24 | [diff] [blame] | 48 | |
Andrew Grieve | 8282bf2 | 2023-01-13 17:29:17 | [diff] [blame] | 49 | ## Java Library APIs |
agrieve | 0e6bdf2 | 2018-08-03 14:25:24 | [diff] [blame] | 50 | |
Andrew Grieve | 8282bf2 | 2023-01-13 17:29:17 | [diff] [blame] | 51 | Android provides the ability to bundle copies of `java.` APIs alongside |
| 52 | application code, known as [Java Library Desugaring]. However, since this |
| 53 | bundling comes with a performance cost, Chrome does not use it. Treat `java.` |
| 54 | APIs the same as you would `android.` ones and guard them with |
| 55 | `Build.VERSION.SDK_INT` checks [when necessary]. The one exception is if the |
| 56 | method is [directly backported by D8] (these are okay to use, since they are |
| 57 | lightweight). Android Lint will fail if you try to use an API without a |
| 58 | corresponding `Build.VERSION.SDK_INT` guard or `@RequiresApi` annotation. |
| 59 | |
| 60 | [Java Library Desugaring]: https://developer.android.com/studio/write/java8-support-table |
| 61 | [when necessary]: https://developer.android.com/reference/packages |
| 62 | [directly backported by D8]: https://source.chromium.org/chromium/chromium/src/+/main:third_party/r8/backported_methods.txt |
agrieve | 0e6bdf2 | 2018-08-03 14:25:24 | [diff] [blame] | 63 | |
agrieve | 398286b | 2018-08-15 01:44:45 | [diff] [blame] | 64 | ## Other Language Features & APIs |
| 65 | |
| 66 | ### Exceptions |
Andrew Grieve | 318b3532 | 2023-01-13 16:03:23 | [diff] [blame] | 67 | We discourage overly broad catches via `Throwable`, `Exception`, or |
| 68 | `RuntimeException`, except when dealing with `RemoteException` or similar |
| 69 | system APIs. |
| 70 | * There have been many cases of crashes caused by `IllegalStateException` / |
| 71 | `IllegalArgumentException` / `SecurityException` being thrown where only |
| 72 | `RemoteException` was being caught. In these cases, use |
| 73 | `catch (RemoteException | RuntimeException e)`. |
| 74 | * For all broad catch expressions, add a comment to explain why. |
agrieve | 398286b | 2018-08-15 01:44:45 | [diff] [blame] | 75 | |
Andrew Grieve | 318b3532 | 2023-01-13 16:03:23 | [diff] [blame] | 76 | Avoid adding messages to exceptions that do not aid in debugging. For example: |
agrieve | 398286b | 2018-08-15 01:44:45 | [diff] [blame] | 77 | |
agrieve | 50430de | 2018-08-15 17:49:16 | [diff] [blame] | 78 | ```java |
| 79 | try { |
| 80 | somethingThatThrowsIOException(); |
| 81 | } catch (IOException e) { |
| 82 | // Bad - message does not tell you more than the stack trace does: |
| 83 | throw new RuntimeException("Failed to parse a file.", e); |
| 84 | // Good - conveys that this block failed along with the "caused by" exception. |
| 85 | throw new RuntimeException(e); |
| 86 | // Good - adds useful information. |
| 87 | throw new RuntimeException(String.format("Failed to parse %s", fileName), e); |
| 88 | } |
| 89 | ``` |
| 90 | |
agrieve | 398286b | 2018-08-15 01:44:45 | [diff] [blame] | 91 | ### Logging |
Andrew Grieve | 8d9e40f | 2023-03-15 21:04:42 | [diff] [blame] | 92 | |
agrieve | 398286b | 2018-08-15 01:44:45 | [diff] [blame] | 93 | * Use `org.chromium.base.Log` instead of `android.util.Log`. |
| 94 | * It provides `%s` support, and ensures log stripping works correctly. |
| 95 | * Minimize the use of `Log.w()` and `Log.e()`. |
| 96 | * Debug and Info log levels are stripped by ProGuard in release builds, and |
| 97 | so have no performance impact for shipping builds. However, Warning and |
| 98 | Error log levels are not stripped. |
| 99 | * Function calls in log parameters are *not* stripped by ProGuard. |
| 100 | |
| 101 | ```java |
| 102 | Log.d(TAG, "There are %d cats", countCats()); // countCats() not stripped. |
| 103 | ``` |
| 104 | |
| 105 | ### Asserts |
Andrew Grieve | 8d9e40f | 2023-03-15 21:04:42 | [diff] [blame] | 106 | |
agrieve | 398286b | 2018-08-15 01:44:45 | [diff] [blame] | 107 | The Chromium build system strips asserts in release builds (via ProGuard) and |
| 108 | enables them in debug builds (or when `dcheck_always_on=true`) (via a [build |
| 109 | step](https://codereview.chromium.org/2517203002)). You should use asserts in |
| 110 | the [same |
John Palmer | be05130 | 2021-05-19 11:48:35 | [diff] [blame] | 111 | scenarios](https://chromium.googlesource.com/chromium/src/+/main/styleguide/c++/c++.md#CHECK_DCHECK_and-NOTREACHED) |
agrieve | 398286b | 2018-08-15 01:44:45 | [diff] [blame] | 112 | where C++ DCHECK()s make sense. For multi-statement asserts, use |
Nate Fischer | 4570ebc3 | 2021-06-04 00:44:45 | [diff] [blame] | 113 | `org.chromium.build.BuildConfig.ENABLE_ASSERTS` to guard your code (similar to |
| 114 | `#if DCHECK_IS_ON()` in C++). |
agrieve | 398286b | 2018-08-15 01:44:45 | [diff] [blame] | 115 | |
| 116 | Example assert: |
| 117 | |
| 118 | ```java |
| 119 | assert someCallWithoutSideEffects() : "assert description"; |
| 120 | ``` |
| 121 | |
Nate Fischer | 4570ebc3 | 2021-06-04 00:44:45 | [diff] [blame] | 122 | Example use of `BuildConfig.ENABLE_ASSERTS`: |
agrieve | 398286b | 2018-08-15 01:44:45 | [diff] [blame] | 123 | |
| 124 | ```java |
Nate Fischer | 4570ebc3 | 2021-06-04 00:44:45 | [diff] [blame] | 125 | import org.chromium.build.BuildConfig; |
| 126 | |
| 127 | ... |
| 128 | |
| 129 | if (BuildConfig.ENABLE_ASSERTS) { |
agrieve | 398286b | 2018-08-15 01:44:45 | [diff] [blame] | 130 | // Any code here will be stripped in Release by ProGuard. |
| 131 | ... |
| 132 | } |
| 133 | ``` |
| 134 | |
Andrew Grieve | 8d9e40f | 2023-03-15 21:04:42 | [diff] [blame] | 135 | ### Streams |
| 136 | |
| 137 | Most uses of [Java 8 streams] are discouraged. If you can write your code as an |
| 138 | explicit loop, then do so. The primary reason for this guidance is because the |
| 139 | lambdas (and method references) needed for streams almost always result in |
| 140 | larger binary size ([example](https://chromium-review.googlesource.com/c/chromium/src/+/4329952). |
| 141 | |
| 142 | The `parallel()` and `parallelStream()` APIs are simpler than their loop |
| 143 | equivalents, but are are currently banned due to a lack of a compelling use case |
| 144 | in Chrome. If you find one, please discuss on `[email protected]`. |
| 145 | |
| 146 | [Java 8 streams]: https://docs.oracle.com/javase/8/docs/api/java/util/stream/package-summary.html |
| 147 | |
agrieve | 16c6fe8 | 2018-11-27 17:47:49 | [diff] [blame] | 148 | ### Finalizers |
Andrew Grieve | 8d9e40f | 2023-03-15 21:04:42 | [diff] [blame] | 149 | |
agrieve | 16c6fe8 | 2018-11-27 17:47:49 | [diff] [blame] | 150 | In line with [Google's Java style guide](https://google.github.io/styleguide/javaguide.html#s6.4-finalizers), |
| 151 | never override `Object.finalize()`. |
| 152 | |
| 153 | Custom finalizers: |
| 154 | * are called on a background thread, and at an unpredicatble point in time, |
| 155 | * swallow all exceptions (asserts won't work), |
| 156 | * causes additional garbage collector jank. |
| 157 | |
| 158 | Classes that need destructor logic should provide an explicit `destroy()` |
John Palmer | be05130 | 2021-05-19 11:48:35 | [diff] [blame] | 159 | method. Use [LifetimeAssert](https://chromium.googlesource.com/chromium/src/+/main/base/android/java/src/org/chromium/base/LifetimeAssert.java) |
Bo Liu | 9bb53ca | 2020-09-22 00:48:10 | [diff] [blame] | 160 | to ensure in debug builds and tests that `destroy()` is called. |
agrieve | 16c6fe8 | 2018-11-27 17:47:49 | [diff] [blame] | 161 | |
Nate Fischer | 74cd25c | 2020-12-16 16:17:03 | [diff] [blame] | 162 | ### AndroidX Annotations |
Andrew Grieve | 8d9e40f | 2023-03-15 21:04:42 | [diff] [blame] | 163 | |
agrieve | 398286b | 2018-08-15 01:44:45 | [diff] [blame] | 164 | * Use them! They are [documented here](https://developer.android.com/studio/write/annotations). |
| 165 | * They generally improve readability. |
| 166 | * Some make lint more useful. |
Nate Fischer | 74cd25c | 2020-12-16 16:17:03 | [diff] [blame] | 167 | * `javax.annotation.Nullable` vs `androidx.annotation.Nullable` |
| 168 | * Always prefer `androidx.annotation.Nullable`. |
agrieve | 398286b | 2018-08-15 01:44:45 | [diff] [blame] | 169 | * It uses `@Retention(SOURCE)` rather than `@Retention(RUNTIME)`. |
| 170 | |
Carlos Knippschild | f2e58c1 | 2021-06-03 01:43:37 | [diff] [blame] | 171 | ### IntDef Instead of Enum |
| 172 | |
| 173 | Java enums generate far more bytecode than integer constants. When integers are |
| 174 | sufficient, prefer using an [@IntDef annotation], which will have usage checked |
| 175 | by [Android lint]. |
| 176 | |
| 177 | Values can be declared outside or inside the `@interface`. We recommend the |
| 178 | latter, with constants nested within it as follows: |
| 179 | |
| 180 | ```java |
| 181 | @IntDef({ContactsPickerAction.CANCEL, ContactsPickerAction.CONTACTS_SELECTED, |
| 182 | ContactsPickerAction.SELECT_ALL, ContactsPickerAction.UNDO_SELECT_ALL}) |
| 183 | @Retention(RetentionPolicy.SOURCE) |
| 184 | public @interface ContactsPickerAction { |
| 185 | int CANCEL = 0; |
| 186 | int CONTACTS_SELECTED = 1; |
| 187 | int SELECT_ALL = 2; |
| 188 | int UNDO_SELECT_ALL = 3; |
| 189 | int NUM_ENTRIES = 4; |
| 190 | } |
| 191 | // ... |
| 192 | void onContactsPickerUserAction(@ContactsPickerAction int action, ...); |
| 193 | ``` |
| 194 | |
| 195 | Values of `Integer` type are also supported, which allows using a sentinel |
| 196 | `null` if needed. |
| 197 | |
| 198 | [@IntDef annotation]: https://developer.android.com/studio/write/annotations#enum-annotations |
| 199 | [Android lint]: https://chromium.googlesource.com/chromium/src/+/HEAD/build/android/docs/lint.md |
| 200 | |
agrieve | 398286b | 2018-08-15 01:44:45 | [diff] [blame] | 201 | ## Style / Formatting |
nyquist | aae4c7c | 2017-02-15 20:41:42 | [diff] [blame] | 202 | |
agrieve | 398286b | 2018-08-15 01:44:45 | [diff] [blame] | 203 | ### File Headers |
John Palmer | be05130 | 2021-05-19 11:48:35 | [diff] [blame] | 204 | * Use the same format as in the [C++ style guide](https://chromium.googlesource.com/chromium/src/+/main/styleguide/c++/c++.md#File-headers). |
nyquist | aae4c7c | 2017-02-15 20:41:42 | [diff] [blame] | 205 | |
agrieve | 398286b | 2018-08-15 01:44:45 | [diff] [blame] | 206 | ### TODOs |
Andrew Grieve | 8d9e40f | 2023-03-15 21:04:42 | [diff] [blame] | 207 | |
agrieve | 398286b | 2018-08-15 01:44:45 | [diff] [blame] | 208 | * TODO should follow chromium convention. Examples: |
| 209 | * `TODO(username): Some sentence here.` |
| 210 | * `TODO(crbug.com/123456): Even better to use a bug for context.` |
nyquist | aae4c7c | 2017-02-15 20:41:42 | [diff] [blame] | 211 | |
Andrew Grieve | 8d9e40f | 2023-03-15 21:04:42 | [diff] [blame] | 212 | ### Code Formatting |
| 213 | |
nyquist | 9d61f98 | 2017-02-10 00:29:08 | [diff] [blame] | 214 | * Fields should not be explicitly initialized to default values (see |
| 215 | [here](https://groups.google.com/a/chromium.org/d/topic/chromium-dev/ylbLOvLs0bs/discussion)). |
nyquist | aae4c7c | 2017-02-15 20:41:42 | [diff] [blame] | 216 | |
Andrew Grieve | 8d9e40f | 2023-03-15 21:04:42 | [diff] [blame] | 217 | ### Curly Braces |
| 218 | |
nyquist | aae4c7c | 2017-02-15 20:41:42 | [diff] [blame] | 219 | Conditional braces should be used, but are optional if the conditional and the |
| 220 | statement can be on a single line. |
| 221 | |
| 222 | Do: |
| 223 | |
| 224 | ```java |
| 225 | if (someConditional) return false; |
| 226 | for (int i = 0; i < 10; ++i) callThing(i); |
| 227 | ``` |
| 228 | |
| 229 | or |
| 230 | |
| 231 | ```java |
| 232 | if (someConditional) { |
| 233 | return false; |
| 234 | } |
| 235 | ``` |
| 236 | |
| 237 | Do NOT do: |
| 238 | |
| 239 | ```java |
| 240 | if (someConditional) |
| 241 | return false; |
| 242 | ``` |
| 243 | |
nyquist | 2d192c4c | 2017-03-06 21:36:51 | [diff] [blame] | 244 | ### Import Order |
Andrew Grieve | 8d9e40f | 2023-03-15 21:04:42 | [diff] [blame] | 245 | |
nyquist | 2d192c4c | 2017-03-06 21:36:51 | [diff] [blame] | 246 | * Static imports go before other imports. |
| 247 | * Each import group must be separated by an empty line. |
| 248 | |
| 249 | This is the order of the import groups: |
| 250 | |
| 251 | 1. android |
Yun Liu | f40227d9 | 2019-04-04 17:37:46 | [diff] [blame] | 252 | 1. androidx |
nyquist | 2d192c4c | 2017-03-06 21:36:51 | [diff] [blame] | 253 | 1. com (except com.google.android.apps.chrome) |
| 254 | 1. dalvik |
| 255 | 1. junit |
| 256 | 1. org |
| 257 | 1. com.google.android.apps.chrome |
| 258 | 1. org.chromium |
| 259 | 1. java |
| 260 | 1. javax |
| 261 | |
Caitlin Fischer | 210cfab | 2020-05-07 20:04:30 | [diff] [blame] | 262 | ## Test-only Code |
Andrew Grieve | 8d9e40f | 2023-03-15 21:04:42 | [diff] [blame] | 263 | |
Andrew Grieve | 0872aad | 2023-06-26 14:16:31 | [diff] [blame] | 264 | Functions and fields used only for testing should have `ForTesting` as a |
| 265 | suffix so that: |
Caitlin Fischer | 210cfab | 2020-05-07 20:04:30 | [diff] [blame] | 266 | |
Andrew Grieve | 0872aad | 2023-06-26 14:16:31 | [diff] [blame] | 267 | 1. The `android-binary-size` trybot can [ensure they are removed] in |
| 268 | non-test optimized builds (by R8). |
| 269 | 2. [`PRESUMBIT.py`] can ensure no calls are made to such methods outside of |
| 270 | tests, and |
| 271 | |
| 272 | `ForTesting` methods that are `@CalledByNative` should use |
| 273 | `@CalledByNativeForTesting` instead. |
| 274 | |
| 275 | Symbols that are made public (or package-private) for the sake of tests |
| 276 | should be annotated with [`@VisibleForTesting`]. Android Lint will check |
| 277 | that calls from non-test code respect the "otherwise" visibility. |
| 278 | |
| 279 | Symbols with a `ForTesting` suffix should **not** be annotated with |
| 280 | `@VisibleForTesting`. While `otherwise=VisibleForTesting.NONE` exists, it |
| 281 | is redundant given the "ForTesting" suffix and the associated lint check |
| 282 | is redundant given our trybot check. |
| 283 | |
| 284 | [ensure they are removed]: /docs/speed/binary_size/android_binary_size_trybot.md#Added-Symbols-named-ForTest |
| 285 | [`PRESUMBIT.py`]: https://chromium.googlesource.com/chromium/src/+/main/PRESUBMIT.py |
| 286 | [`@VisibleForTesting`]: https://developer.android.com/reference/androidx/annotation/VisibleForTesting |
Sam Maier | 7452a0d | 2022-07-20 18:24:35 | [diff] [blame] | 287 | |
nyquist | 9d61f98 | 2017-02-10 00:29:08 | [diff] [blame] | 288 | ## Location |
Andrew Grieve | 8d9e40f | 2023-03-15 21:04:42 | [diff] [blame] | 289 | |
nyquist | 9d61f98 | 2017-02-10 00:29:08 | [diff] [blame] | 290 | "Top level directories" are defined as directories with a GN file, such as |
John Palmer | be05130 | 2021-05-19 11:48:35 | [diff] [blame] | 291 | [//base](https://chromium.googlesource.com/chromium/src/+/main/base/) |
nyquist | 9d61f98 | 2017-02-10 00:29:08 | [diff] [blame] | 292 | and |
John Palmer | be05130 | 2021-05-19 11:48:35 | [diff] [blame] | 293 | [//content](https://chromium.googlesource.com/chromium/src/+/main/content/), |
nyquist | 9d61f98 | 2017-02-10 00:29:08 | [diff] [blame] | 294 | Chromium Java should live in a directory named |
| 295 | `<top level directory>/android/java`, with a package name |
| 296 | `org.chromium.<top level directory>`. Each top level directory's Java should |
| 297 | build into a distinct JAR that honors the abstraction specified in a native |
John Palmer | be05130 | 2021-05-19 11:48:35 | [diff] [blame] | 298 | [checkdeps](https://chromium.googlesource.com/chromium/buildtools/+/main/checkdeps/checkdeps.py) |
nyquist | 9d61f98 | 2017-02-10 00:29:08 | [diff] [blame] | 299 | (e.g. `org.chromium.base` does not import `org.chromium.content`). The full |
| 300 | path of any java file should contain the complete package name. |
| 301 | |
| 302 | For example, top level directory `//base` might contain a file named |
| 303 | `base/android/java/org/chromium/base/Class.java`. This would get compiled into a |
| 304 | `chromium_base.jar` (final JAR name TBD). |
| 305 | |
| 306 | `org.chromium.chrome.browser.foo.Class` would live in |
| 307 | `chrome/android/java/org/chromium/chrome/browser/foo/Class.java`. |
| 308 | |
| 309 | New `<top level directory>/android` directories should have an `OWNERS` file |
| 310 | much like |
John Palmer | be05130 | 2021-05-19 11:48:35 | [diff] [blame] | 311 | [//base/android/OWNERS](https://chromium.googlesource.com/chromium/src/+/main/base/android/OWNERS). |
nyquist | 9d61f98 | 2017-02-10 00:29:08 | [diff] [blame] | 312 | |
Andrew Grieve | 0872aad | 2023-06-26 14:16:31 | [diff] [blame] | 313 | ## Tools |
| 314 | |
| 315 | ### Automatically Formatting Edited Files |
| 316 | |
| 317 | A checkout should give you clang-format to automatically format Java code. |
| 318 | It is suggested that Clang's formatting of code should be accepted in code |
| 319 | reviews. |
| 320 | |
| 321 | You can run `git cl format` to apply the automatic formatting. |
| 322 | |
| 323 | ### IDE Setup |
| 324 | |
| 325 | For automatically using the correct style, follow the guide to set up your |
| 326 | favorite IDE: |
| 327 | |
| 328 | * [Android Studio](https://chromium.googlesource.com/chromium/src/+/main/docs/android_studio.md) |
| 329 | * [Eclipse](https://chromium.googlesource.com/chromium/src/+/main/docs/eclipse.md) |
| 330 | |
| 331 | ### Checkstyle |
| 332 | |
| 333 | Checkstyle is automatically run by the build bots, and to ensure you do not have |
| 334 | any surprises, you can also set up checkstyle locally using [this |
| 335 | guide](https://sites.google.com/a/chromium.org/dev/developers/checkstyle). |
| 336 | |
| 337 | ### Lint |
| 338 | |
| 339 | Lint is run as part of the build. For more information, see |
| 340 | [here](https://chromium.googlesource.com/chromium/src/+/main/build/android/docs/lint.md). |
| 341 | |
nyquist | aae4c7c | 2017-02-15 20:41:42 | [diff] [blame] | 342 | ## Miscellany |
Andrew Grieve | 8d9e40f | 2023-03-15 21:04:42 | [diff] [blame] | 343 | |
nyquist | aae4c7c | 2017-02-15 20:41:42 | [diff] [blame] | 344 | * Use UTF-8 file encodings and LF line endings. |