Kotlin Standard Library JRE 7/8 extensions

I’m new to Kotlin and currently exploring the standard library and noticed that there were JRE 7 and 8 specific extensions which depended on the stdlib.

When I created an Android test project, it specified the JRE7 flavour. My questions are:

  • What are these extensions for and where are they documented?
  • If for Android we use minSDKVersion of 24 or higher, is the JRE8 extension dependency ok to use?

Thanks!

1 Like

Ditto! Bump, if anyone knows?

They also show as deprecated in Maven Central (https://mvnrepository.com/artifact/org.jetbrains.kotlin) so it adds to the fun.

After a bit of further Googling, here’s some additional info:
https://kotlinlang.org/docs/reference/whatsnew11.html#java-8-standard-library-support
https://kotlinlang.org/docs/reference/whatsnew12.html#kotlin-standard-library-artifacts-and-split-packages

I wouldn’t consider this a full-on documentation, but helpful information nonetheless.

The standard library extension artifacts are documented as a part of the standard library documentation.

In case of some API is located in the extension artifact it gets the respective badge. For example note JRE8 badge on the kotlin.streams package.

As for the artifacts themselves, you should use kotlin-stdlib-jdk7/8 as of Kotlin 1.2, and kotlin-stdlib-jre7/8 are deprecated due to the reasons explained in the “What’s new in 1.2” article.

By the way, I recently found, that kotlin-stdlib-jdk8 does not contain all of the methods that are present in kotlin-stdlib-jre8. For example I could not find stream to sequence conversion. Maybe it is fixed already?

As of Kotlin 1.2 these methods should be there, see: https://github.com/JetBrains/kotlin/blob/1.2.0/libraries/stdlib/jdk8/src/kotlin/streams/Streams.kt#L25-L47

1 Like

Yes, I see it now. Maybe it was older version or dependency cache corruption.