Change theme
Help
Press space for more information.
Show links for this issue (Shortcut: i, l)
Copy issue ID
Previous Issue (Shortcut: k)
Next Issue (Shortcut: j)
Sign in to use full features.
Vote: I am impacted
Notification menu
Refresh (Shortcut: Shift+r)
Go home (Shortcut: u)
Pending code changes (auto-populated)
View issue level access limits(Press Alt + Right arrow for more information)
Unintended behavior
View staffing
Description
Example:
1 dedicated thread for local SQLite operations
pool of threads for disk operations
pool of threads for network operations
Suggested change is to add property for @WorkerThread as following:
@Retention(CLASS)
@Target({METHOD,CONSTRUCTOR,TYPE,PARAMETER})
public @interface WorkerThread {
+ String value() default "";
}
This value may be treated as logical ID of thread or pool.
Then do corresponding changes in Lint. It must detect calls from wrong thread, assuming that each unique 'value' of the @WorkerThread represents single thread.
Example:
@WorkerThread("network")
public void onCallbackFromNetwork() {
// here Line must warn about WrongThread
doSomethingInDatabase();
}
@WorkerThread("database")
public void doSomethingInDatabase() {
}