Last active
November 29, 2018 15:04
-
-
Save KingsMentor/64099740da618a8437cbe5f11610775a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Annotion Type | Example | Usage | |
---|---|---|---|
Nullness | @Nullable and @NonNull,check for nullness of a given variable | parametar or return value. | |
Thread | @MainThread,@UiThread,@WorkerThread,@BinderThread,@AnyThread | Thread annotations check if a method is called from a specific type of thread. | |
Value constraint | @IntRange, @FloatRange, and @Size | to validate the values of passed parameters | |
Permission | @to validate the permissions of the caller of a method | to validate the permissions of the caller of a method | |
Return value | @CheckResult | to validate that a method's result or return value is actually used | |
CallSuper | @CallSuper | to validate that an overriding method calls the super implementation of the method | |
Typedef | @IntDef and @StringDef | ensure that a particular parameter, return value, or field references a specific set of constants | |
Keep | @Keep | ensures that an annotated class or method is not removed when the code is minified at build time | |
Code visibility | @VisibleForTesting | indicates that an annotated method is more visible than normally necessary to make the method testable | |
Restrict an API | @RestrictTo | indicates that access to the annotated API (package, class, or method) is limited as certain Scope. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment