An open API service indexing awesome lists of open source software.

https://github.com/serso/thread-guard

Injects assertions in methods annotated with @MainThread or @WorkerThread
https://github.com/serso/thread-guard

Last synced: about 1 month ago
JSON representation

Injects assertions in methods annotated with @MainThread or @WorkerThread

Awesome Lists containing this project

README

          

# Description
Protects against calling methods on wrong threads using AspectJ and Android's
`@MainThread`/`@WorkerThread` annotations.

# Usage
Set up AspectA as described here: https://github.com/serso/aspecta.

Import Thread Guard library to your project:
```groovy
dependencies {
implementation 'org.solovyev.android.threadguard:lib:1.0.2'
}
```

Optionally, you can specify how to penalize the violations:
```java
package org.example.android;

class App extends Application {

@Override
void onCreate() {
ThreadGuard.penaltyDeath();
// or
ThreadGuard.penaltyLog();
}
}
```