-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider dropping support for Java 6 in kotlinx.coroutines 1.4 #1589
Comments
From Android's perspective, the use of |
Please consider Java 8 only, I don't see any worth in Java 7 support. |
What specifically are you looking for from 8 that is not available in 7? Also do you mean the APIs of 8, the classfile format version, or both? |
I am considering class version 52. Personally I don't consider supporting Java 7 a worth, nor for Android now for regular JVM software. |
Classfile version 52 and Java 7 APIs is acceptable from an Android perspective. Java versions essentially are meaningless when talking about Android support anyway. API 21 is a reasonable minimum-supported version and the toolchain can handle classfile version 52. |
@JakeWharton What would be the easiest way to automatically (during CI) verify that we are only using APIs that are available in certain Android API version and what minimum API version you'd recommend to support for a core library like |
For OkHttp and Okio (which are also Kotlin multiplatform projects) we use Animal Sniffer on the JVM targets to ensure compatibility. For example, OkHttp supports Java 8 on the JVM and API 21 for Android so we configure both of those: https://github.com/square/okhttp/blob/master/build.gradle#L112-L119. I personally think API 21 is a reasonable minimum supported version. The global platform dashboard (which inexplicably hasn't been updated since May) at https://developer.android.com/about/dashboards paints roughly 10% below that line, the most of which is 7% on API 19 (API 20 doesn't really exist). You can speculate that those numbers are even lower by now since they only go down. It's a long tail to zero though so I would not consider a non-zero number worth supporting simply because it exists. Choosing a higher minimum supported version will always bring complaints. Plenty of people will be supporting API 19 and potentially even lower. You'll want your choice to be defensible. In OkHttp's case API 21 meant modern cipher suites are guaranteed which ensured the privacy of its user's data. I think the desire to use FJP unconditionally is a pretty strong position given the code size and runtime performance/memory impact. It will also have interesting implications on the AndroidX libraries which depend on coroutines. Most (all?) of them support API 14+ for no real good reason other than historical and no strong motivation to move. I would not let that play a factor in your decision. They've been forced to bump the minimum of various modules before and those modules can decide to stick to a 1.3 dependency to retain compatibility or bump for new features just like everyone else. (All of this is my personal view as an Android developer. If you need some official Android position that'll be a whole other ordeal) |
The current custom scheduler provides a concrete improvement on non Android platform? |
At this time, are Coroutines considering targeting which API level for 1.4? Java 7 or 8? |
It would simplify dev setup if we compile against JDK 8 and target JDK 8 bytecode (version 52), but we are in no immediate need to use any JDK 8 API. JDK 7 should be enough. In this case, we'll need some kind of validation setup against a specific Android API surface we'll choose as a min version. Any pointers and other help here will be appreciated. |
Animal sniffer plugin and one of these: https://search.maven.org/search?q=g:net.sf.androidscents.signature%20a:android-api-level-%2A |
Kotlin#2963) * Introduce animalsniffer checks to coroutines and compile against Java 8 source and binary target, but still avoiding Java 7+ API * Do not use deprecated target, language desugaring will handle default interface methods and Math/Long/Int static methods * Partially migrate to .gradle.kts Fixes Kotlin#1589
Kotlin#2963) * Introduce animalsniffer checks to coroutines and compile against Java 8 source and binary target, but still avoiding Java 7+ API * Do not use deprecated target, language desugaring will handle default interface methods and Math/Long/Int static methods * Partially migrate to .gradle.kts Fixes Kotlin#1589
Supporting Java 6 target creates a lot of maintenance burden and it would be nice if we could migrate to Java 7 or 8. A lot of widespread Android libraries work only with Java 8, Android toolchain knows how to desugar Java 6+ API (except for
java.time
that we don't use) and it's unlikely that there are users sitting on old Android toolchain, Java 6, but on the latestkotlinx.coroutines
.This issue is created to gather feedback and/or objections about such migration.
List of potential features blocked by Java 6 support:
ClassValue
in stacktrace recovery (instead of a concurrent map of weak references that is prone to class leaks)Dispatchers.Default
andDispatchers.IO
(usingManagedBlocker
) on Android. It will reduce the size of resulting dex withkx.coroutines
by ~20 KB and will share threads with common pool (less memory consumption -> better footprint on low-end devices)JvmDefault
to evolve our public interfaces in a backward-compatible way (also, less bytecode)addSuppressed
without reflection or jdk8 jar....
The text was updated successfully, but these errors were encountered: