<@U2E974ELT> I haven't seen the MainThread or UiTh...
# coroutines
b
@elizarov I haven't seen the MainThread or UiThread annotation very often, but I'd say others are pretty common (Nullable, NonNull, IntDef...)
e
bamdmux: That is what I’m worried about. That the package is imported, making it quite cumbersome to use
launch(MainThread) { … }
, since it will not compile without giving an obvious explanation as to why.
b
You should discard the MainThread option. Considering the uses of the annotation package alone (for the NonNull and such) and the various appcompat libraries (which uses the annotation) and are now included by default on a new Android Studio project, the chances of it being included on a random android project are very high
d
No big deal. We have tons of Observable classes here and there. But this doesn't prevent us from using rxjava, isn't it? Personally me don't use android.support.annotation.MainThread at all. And for other support annotations i use non-wildcard imports, so MainThread name is free to use. For those guys who need support version, they can use fully qualified name like
Copy code
@android.support.annotation.MainThread
k
It's going to be used a lot more though. It'll throw a runtime error if run on a background thread and is one of the common annotations with newer apps. I think we have to use an alternative on kotlin too. 😔
d
not sure how this annotation can be useful in runtime. it is just a marker and it is pretty useless in most use cases. from the docs:
A common use of the thread annotation is to validate method overrides in the AsyncTask class because this class performs background operations and publishes results only on the UI thread
does anybody still use AsyncTask nowadays?
k
I thought it was runtime. Using it as a marker is not useful 😂