# CheckResult

Artifact: [androidx.annotation:annotation](https://developer.android.com/jetpack/androidx/releases/annotation) [View Source](https://cs.android.com/search?q=file:androidx/annotation/CheckResult.kt+class:androidx.annotation.CheckResult) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/annotation#1.0.0)

*** ** * ** ***

Common/AllAndroid/JVM
- Cmn

  ```
  @MustBeDocumented
  @Retention(value = AnnotationRetention.BINARY)
  @Target(allowedTargets = [AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER])
  annotation CheckResult
  ```

*** ** * ** ***

Denotes that the annotated method returns a result that it typically is an error to ignore. This is usually used for methods that have no side effect, so calling it without actually looking at the result usually means the developer has misunderstood what the method does.

Example:

```kotlin
public @CheckResult String trim(String s) { return s.trim(); }
...
trim(s); // this is probably an error
s = trim(s); // ok
```

## Summary

| ### Public constructors |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/annotation/CheckResult#CheckResult(kotlin.String)(suggest: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` | Cmn |

| ### Public properties |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/annotation/CheckResult#suggest()` Defines the name of the suggested method to use instead, if applicable (using the same signature format as javadoc.) If there is more than one possibility, list them all separated by commas. | Cmn |

## Public constructors

### CheckResult

Cmn Added in [1.10.0](https://developer.android.com/jetpack/androidx/releases/annotation#1.10.0)

```
CheckResult(suggest: String = "")
```

## Public properties

### suggest

Cmn

```
val suggest: String
```

Defines the name of the suggested method to use instead, if applicable (using the same signature format as javadoc.) If there is more than one possibility, list them all separated by commas.

For example, ProcessBuilder has a method named `redirectErrorStream()` which sounds like it might redirect the error stream. It does not. It's just a getter which returns whether the process builder will redirect the error stream, and to actually set it, you must call `redirectErrorStream(boolean)`. In that case, the method should be defined like this:

```kotlin
@CheckResult(suggest="#redirectErrorStream(boolean)")
public boolean redirectErrorStream() { ... }
```