Introduce kotlin-stdlib-jdk7/8 libraries, deprecate kotlin-stdlib-jre7/8
The idea is to keep all declarations in the same packages from Kotlin's point of view, but use JvmPackageName annotation to move them to another JVM package, to avoid the split package problem which is otherwise unsolvable when using module path on Java 9 (KT-19258). In this commit, kotlin-stdlib-jre7/8 are moved to kotlin-stdlib-jdk7/8 and in the subsequent commit, -jre7/8 are restored. This is done in order to make Git recognize this as a file move to preserve history. Include new stdlib-jdkN artifacts in manifest version tests.
This commit is contained in:
committed by
Ilya Gorbunov
parent
2fc3f4d07b
commit
e253acd5fd
@@ -1,4 +1,4 @@
|
||||
description = 'Kotlin Standard Library JRE 7 extension'
|
||||
description = 'Kotlin Standard Library JDK 7 extension'
|
||||
|
||||
apply plugin: 'kotlin'
|
||||
|
||||
@@ -49,7 +49,7 @@ compileKotlin {
|
||||
kotlinOptions.freeCompilerArgs = [
|
||||
"-Xallow-kotlin-package",
|
||||
"-Xmultifile-parts-inherit",
|
||||
"-Xdump-declarations-to", "${buildDir}/stdlib-jre7-declarations.json",
|
||||
"-Xdump-declarations-to", "${buildDir}/stdlib-jdk7-declarations.json",
|
||||
"-module-name", project.name
|
||||
]
|
||||
}
|
||||
@@ -64,7 +64,7 @@ test {
|
||||
executable = "$JDK_17/bin/java"
|
||||
}
|
||||
|
||||
task testJre6Tests(type: Test) {
|
||||
task testJdk6Tests(type: Test) {
|
||||
dependsOn(':kotlin-stdlib:testClasses')
|
||||
group = "verification"
|
||||
|
||||
@@ -79,4 +79,4 @@ task testJre6Tests(type: Test) {
|
||||
}
|
||||
}
|
||||
|
||||
check.dependsOn testJre6Tests
|
||||
check.dependsOn testJdk6Tests
|
||||
+4
-3
@@ -14,7 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@file:JvmName("AutoCloseableKt")
|
||||
@file:kotlin.jvm.JvmPackageName("kotlin.jdk7")
|
||||
package kotlin
|
||||
|
||||
/**
|
||||
@@ -27,8 +29,7 @@ package kotlin
|
||||
* @param block a function to process this [AutoCloseable] resource.
|
||||
* @return the result of [block] function invoked on this resource.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
@Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
|
||||
@SinceKotlin("1.2")
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun <T : AutoCloseable?, R> T.use(block: (T) -> R): R {
|
||||
var exception: Throwable? = null
|
||||
@@ -48,7 +49,7 @@ public inline fun <T : AutoCloseable?, R> T.use(block: (T) -> R): R {
|
||||
*
|
||||
* The suppressed exception is added to the list of suppressed exceptions of [cause] exception.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
@SinceKotlin("1.2")
|
||||
@PublishedApi
|
||||
internal fun AutoCloseable?.closeFinally(cause: Throwable?) = when {
|
||||
this == null -> {}
|
||||
@@ -1,4 +1,4 @@
|
||||
description = 'Kotlin Standard Library JRE 8 extension'
|
||||
description = 'Kotlin Standard Library JDK 8 extension'
|
||||
|
||||
apply plugin: 'kotlin'
|
||||
|
||||
@@ -9,7 +9,7 @@ ext.jvmTarget = "1.8"
|
||||
|
||||
dependencies {
|
||||
compile project(':kotlin-stdlib')
|
||||
compile project(':kotlin-stdlib-jre7')
|
||||
compile project(':kotlin-stdlib-jdk7')
|
||||
testCompile project(':kotlin-test:kotlin-test-junit')
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ sourceSets {
|
||||
srcDir 'test'
|
||||
if(!System.properties.'idea.active') {
|
||||
srcDir '../test'
|
||||
srcDir '../jre7/test'
|
||||
srcDir '../jdk7/test'
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -52,7 +52,7 @@ compileKotlin {
|
||||
kotlinOptions.freeCompilerArgs = [
|
||||
"-Xallow-kotlin-package",
|
||||
"-Xmultifile-parts-inherit",
|
||||
"-Xdump-declarations-to", "${buildDir}/stdlib-jre8-declarations.json",
|
||||
"-Xdump-declarations-to", "${buildDir}/stdlib-jdk8-declarations.json",
|
||||
"-module-name", project.name
|
||||
]
|
||||
}
|
||||
@@ -67,8 +67,7 @@ test {
|
||||
executable = "$JDK_18/bin/java"
|
||||
}
|
||||
|
||||
|
||||
task testJre6Tests(type: Test) {
|
||||
task testJdk6Tests(type: Test) {
|
||||
dependsOn(':kotlin-stdlib:testClasses')
|
||||
group = "verification"
|
||||
|
||||
@@ -83,4 +82,4 @@ task testJre6Tests(type: Test) {
|
||||
}
|
||||
}
|
||||
|
||||
check.dependsOn testJre6Tests
|
||||
check.dependsOn testJdk6Tests
|
||||
+5
-6
@@ -14,16 +14,16 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
@file:Suppress("UNCHECKED_CAST", "NOTHING_TO_INLINE")
|
||||
@file:JvmName("CollectionsJRE8Kt")
|
||||
@file:Suppress("UNCHECKED_CAST", "NOTHING_TO_INLINE", "INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@file:JvmName("CollectionsJDK8Kt")
|
||||
@file:kotlin.jvm.JvmPackageName("kotlin.collections.jdk8")
|
||||
package kotlin.collections
|
||||
|
||||
/**
|
||||
* Returns the value to which the specified key is mapped, or
|
||||
* [defaultValue] if this map contains no mapping for the key.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
@Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
|
||||
@SinceKotlin("1.2")
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun <@kotlin.internal.OnlyInputTypes K, V> Map<out K, V>.getOrDefault(key: K, defaultValue: V): V
|
||||
= (this as Map<K, V>).getOrDefault(key, defaultValue)
|
||||
@@ -33,8 +33,7 @@ public inline fun <@kotlin.internal.OnlyInputTypes K, V> Map<out K, V>.getOrDefa
|
||||
* Removes the entry for the specified key only if it is currently
|
||||
* mapped to the specified value.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
@Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
|
||||
@SinceKotlin("1.2")
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun <@kotlin.internal.OnlyInputTypes K, @kotlin.internal.OnlyInputTypes V> MutableMap<out K, out V>.remove(key: K, value: V): Boolean
|
||||
= (this as MutableMap<K, V>).remove(key, value)
|
||||
+11
-9
@@ -14,7 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@file:JvmName("StreamsKt")
|
||||
@file:kotlin.jvm.JvmPackageName("kotlin.streams.jdk8")
|
||||
package kotlin.streams
|
||||
|
||||
import java.util.*
|
||||
@@ -23,53 +25,53 @@ import java.util.stream.*
|
||||
/**
|
||||
* Creates a [Sequence] instance that wraps the original stream iterating through its elements.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
@SinceKotlin("1.2")
|
||||
public fun <T> Stream<T>.asSequence(): Sequence<T> = Sequence { iterator() }
|
||||
|
||||
/**
|
||||
* Creates a [Sequence] instance that wraps the original stream iterating through its elements.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
@SinceKotlin("1.2")
|
||||
public fun IntStream.asSequence(): Sequence<Int> = Sequence { iterator() }
|
||||
|
||||
/**
|
||||
* Creates a [Sequence] instance that wraps the original stream iterating through its elements.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
@SinceKotlin("1.2")
|
||||
public fun LongStream.asSequence(): Sequence<Long> = Sequence { iterator() }
|
||||
|
||||
/**
|
||||
* Creates a [Sequence] instance that wraps the original stream iterating through its elements.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
@SinceKotlin("1.2")
|
||||
public fun DoubleStream.asSequence(): Sequence<Double> = Sequence { iterator() }
|
||||
|
||||
/**
|
||||
* Creates a sequential [Stream] instance that produces elements from the original sequence.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
@SinceKotlin("1.2")
|
||||
public fun <T> Sequence<T>.asStream(): Stream<T> = StreamSupport.stream({ Spliterators.spliteratorUnknownSize(iterator(), Spliterator.ORDERED) }, Spliterator.ORDERED, false)
|
||||
|
||||
/**
|
||||
* Returns a [List] containing all elements produced by this stream.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
@SinceKotlin("1.2")
|
||||
public fun <T> Stream<T>.toList(): List<T> = collect(Collectors.toList<T>())
|
||||
|
||||
/**
|
||||
* Returns a [List] containing all elements produced by this stream.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
@SinceKotlin("1.2")
|
||||
public fun IntStream.toList(): List<Int> = toArray().asList()
|
||||
|
||||
/**
|
||||
* Returns a [List] containing all elements produced by this stream.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
@SinceKotlin("1.2")
|
||||
public fun LongStream.toList(): List<Long> = toArray().asList()
|
||||
|
||||
/**
|
||||
* Returns a [List] containing all elements produced by this stream.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
@SinceKotlin("1.2")
|
||||
public fun DoubleStream.toList(): List<Double> = toArray().asList()
|
||||
+4
-2
@@ -14,7 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
@file:JvmName("RegexExtensionsJRE8Kt")
|
||||
@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@file:JvmName("RegexExtensionsJDK8Kt")
|
||||
@file:kotlin.jvm.JvmPackageName("kotlin.text.jdk8")
|
||||
package kotlin.text
|
||||
|
||||
/**
|
||||
@@ -23,7 +25,7 @@ package kotlin.text
|
||||
* @return An instance of [MatchGroup] if the group with the specified [name] was matched or `null` otherwise.
|
||||
* @throws [UnsupportedOperationException] if getting named groups isn't supported on the current platform.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
@SinceKotlin("1.2")
|
||||
public operator fun MatchGroupCollection.get(name: String): MatchGroup? {
|
||||
val namedGroups = this as? MatchNamedGroupCollection ?:
|
||||
throw UnsupportedOperationException("Retrieving groups by name is not supported on this platform.")
|
||||
Reference in New Issue
Block a user