Kotlin Standard Library JRE 7/8 extensions


#1

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!


#2

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.


#3

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.


#4

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.


#5

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?


#6

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


#7

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