Skip to content

Commit 175f0e3

Browse files
committed
Analysis: Suppress synchronized on suspend coroutines warning
Warning Messages: "@synchronized annotation is not applicable to suspend functions and lambdas" This coroutines warning is suppressed, that is, instead of it being resolved, since it seems that: 1. Adding the '@synchronized' annotation was done deliberately, and 2. Changing that is a bit complicated as it would need a bit more thought to properly fix this, using [Mutex] or otherwise. For more info see: - Fix crash in UploadStarter on Samsung devices with Android 5 #10878 (Introduced In): https://github.com/wordpress-mobile/WordPress-Android/ pull/10878 - Forbid @synchronized annotation on suspend functions (Kotlin Issue): https://youtrack.jetbrains.com/issue/KT-27333/ Forbid-Synchronized-annotation-on-suspend-functions - Coroutines and Java Synchronization Don't Mix (Blog Post: https://blog.danlew.net/2020/01/28/ coroutines-and-java-synchronization-dont-mix/
1 parent e03d208 commit 175f0e3

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

WordPress/src/main/java/org/wordpress/android/ui/uploads/UploadStarter.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ class UploadStarter @Inject constructor(
142142
* and `uploadServiceFacade.isPostUploadingOrQueued(it)` might return out-of-date result and a same post is added
143143
* twice.
144144
*/
145+
@Suppress("SYNCHRONIZED_ON_SUSPEND")
145146
@Synchronized
146147
private suspend fun upload(site: SiteModel) = coroutineScope {
147148
val posts = async { postStore.getPostsWithLocalChanges(site) }

0 commit comments

Comments
 (0)