Skip to content

serso/thread-guard

Repository files navigation

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:

dependencies {
  implementation 'org.solovyev.android.threadguard:lib:1.0.2'
}

Optionally, you can specify how to penalize the violations:

package org.example.android;

class App extends Application {

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

About

Injects assertions in methods annotated with @mainthread or @workerthread

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages