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
@@ -155,6 +155,8 @@ val coreLibProjects = listOf(
|
||||
":kotlin-stdlib-js",
|
||||
":kotlin-stdlib-jre7",
|
||||
":kotlin-stdlib-jre8",
|
||||
":kotlin-stdlib-jdk7",
|
||||
":kotlin-stdlib-jdk8",
|
||||
":kotlin-test:kotlin-test-common",
|
||||
":kotlin-test:kotlin-test-jvm",
|
||||
":kotlin-test:kotlin-test-junit",
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ You need to install a recent [Maven](http://maven.apache.org/) distribution and
|
||||
JDK_18="path to JDK 1.8"
|
||||
|
||||
The main part of the Kotlin standard library, `kotlin-stdlib`, is compiled against JDK 1.6 and also there are two extensions
|
||||
for the standard library, `kotlin-stdlib-jre7` and `kotlin-stdlib-jre8`, which are compiled against JDK 1.7 and 1.8 respectively,
|
||||
for the standard library, `kotlin-stdlib-jdk7` and `kotlin-stdlib-jdk8`, which are compiled against JDK 1.7 and 1.8 respectively,
|
||||
so you need to have all these JDKs installed.
|
||||
|
||||
Be sure to build Kotlin compiler distribution before launching Gradle and Maven: see [root ReadMe.md, section "Building"](../ReadMe.md#installing-plugin).
|
||||
|
||||
@@ -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.")
|
||||
@@ -7,7 +7,7 @@ and ensure that the public binary API wasn't changed in a way that make this cha
|
||||
|
||||
Compile and run tests. `CasesPublicAPITest` verifies the tool itself,
|
||||
and `RuntimePublicAPITest` dumps the public API of `kotlin-stdlib`,
|
||||
`kotlin-stdlib-jre7/8` and `kotlin-reflect` jars,
|
||||
`kotlin-stdlib-jdk7/8`, `kotlin-stdlib-jre7/8` and `kotlin-reflect` jars,
|
||||
which must be built beforehand with gradle. Use `clean assemble` tasks,
|
||||
since the incremental compilation currently doesn't produce all the required output.
|
||||
|
||||
|
||||
@@ -13,6 +13,8 @@ dependencies {
|
||||
testArtifacts project(':kotlin-stdlib')
|
||||
testArtifacts project(':kotlin-stdlib-jre7')
|
||||
testArtifacts project(':kotlin-stdlib-jre8')
|
||||
testArtifacts project(':kotlin-stdlib-jdk7')
|
||||
testArtifacts project(':kotlin-stdlib-jdk8')
|
||||
testArtifacts project(':kotlin-reflect')
|
||||
// legacy
|
||||
// testArtifacts project(':kotlin-runtime')
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
public final class kotlin/AutoCloseableKt {
|
||||
public final class kotlin/jdk7/AutoCloseableKt {
|
||||
public static final fun closeFinally (Ljava/lang/AutoCloseable;Ljava/lang/Throwable;)V
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
public final class kotlin/streams/StreamsKt {
|
||||
public final class kotlin/streams/jdk8/StreamsKt {
|
||||
public static final fun asSequence (Ljava/util/stream/DoubleStream;)Lkotlin/sequences/Sequence;
|
||||
public static final fun asSequence (Ljava/util/stream/IntStream;)Lkotlin/sequences/Sequence;
|
||||
public static final fun asSequence (Ljava/util/stream/LongStream;)Lkotlin/sequences/Sequence;
|
||||
@@ -10,7 +10,7 @@ public final class kotlin/streams/StreamsKt {
|
||||
public static final fun toList (Ljava/util/stream/Stream;)Ljava/util/List;
|
||||
}
|
||||
|
||||
public final class kotlin/text/RegexExtensionsJRE8Kt {
|
||||
public final class kotlin/text/jdk8/RegexExtensionsJDK8Kt {
|
||||
public static final fun get (Lkotlin/text/MatchGroupCollection;Ljava/lang/String;)Lkotlin/text/MatchGroup;
|
||||
}
|
||||
|
||||
+8
@@ -41,6 +41,14 @@ class RuntimePublicAPITest {
|
||||
snapshotAPIAndCompare("../../stdlib/build/libs", "kotlin-stdlib", listOf("../stdlib-declarations.json", "../runtime-declarations.json"), listOf("kotlin.jvm.internal"))
|
||||
}
|
||||
|
||||
@Test fun kotlinStdlibJdk7() {
|
||||
snapshotAPIAndCompare("../../stdlib/jdk7/build/libs", "kotlin-stdlib-jdk7", listOf("../stdlib-jdk7-declarations.json"))
|
||||
}
|
||||
|
||||
@Test fun kotlinStdlibJdk8() {
|
||||
snapshotAPIAndCompare("../../stdlib/jdk8/build/libs", "kotlin-stdlib-jdk8", listOf("../stdlib-jdk8-declarations.json"))
|
||||
}
|
||||
|
||||
@Test fun kotlinStdlibJre7() {
|
||||
snapshotAPIAndCompare("../../stdlib/jre7/build/libs", "kotlin-stdlib-jre7", listOf("../stdlib-jre7-declarations.json"))
|
||||
}
|
||||
|
||||
@@ -127,6 +127,8 @@
|
||||
<artifact>org.jetbrains.kotlin:kotlin-stdlib:${project.version}</artifact>
|
||||
<artifact>org.jetbrains.kotlin:kotlin-stdlib-common:${project.version}</artifact>
|
||||
<artifact>org.jetbrains.kotlin:kotlin-stdlib-js:${project.version}</artifact>
|
||||
<artifact>org.jetbrains.kotlin:kotlin-stdlib-jdk7:${project.version}</artifact>
|
||||
<artifact>org.jetbrains.kotlin:kotlin-stdlib-jdk8:${project.version}</artifact>
|
||||
<artifact>org.jetbrains.kotlin:kotlin-stdlib-jre7:${project.version}</artifact>
|
||||
<artifact>org.jetbrains.kotlin:kotlin-stdlib-jre8:${project.version}</artifact>
|
||||
<artifact>org.jetbrains.kotlin:kotlin-reflect:${project.version}</artifact>
|
||||
|
||||
+10
@@ -44,6 +44,16 @@
|
||||
<artifactId>kotlin-stdlib-jre8</artifactId>
|
||||
<version>${kotlin.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-stdlib-jdk7</artifactId>
|
||||
<version>${kotlin.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-stdlib-jdk8</artifactId>
|
||||
<version>${kotlin.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-script-runtime</artifactId>
|
||||
|
||||
+2
@@ -26,6 +26,8 @@ val LIBRARIES = listOf(
|
||||
"kotlin-stdlib-common",
|
||||
"kotlin-stdlib-jre7",
|
||||
"kotlin-stdlib-jre8",
|
||||
"kotlin-stdlib-jdk7",
|
||||
"kotlin-stdlib-jdk8",
|
||||
"kotlin-reflect",
|
||||
"kotlin-script-runtime"
|
||||
)
|
||||
|
||||
@@ -98,6 +98,8 @@ include ":kotlin-build-common",
|
||||
":kotlin-stdlib-js",
|
||||
":kotlin-stdlib-jre7",
|
||||
":kotlin-stdlib-jre8",
|
||||
":kotlin-stdlib-jdk7",
|
||||
":kotlin-stdlib-jdk8",
|
||||
":kotlin-stdlib:samples",
|
||||
":prepare:build.version",
|
||||
":kotlin-build-common",
|
||||
@@ -154,6 +156,8 @@ project(':kotlin-stdlib').projectDir = "$rootDir/libraries/stdlib" as File
|
||||
project(':kotlin-stdlib-js').projectDir = "$rootDir/libraries/stdlib/js" as File
|
||||
project(':kotlin-stdlib-jre7').projectDir = "$rootDir/libraries/stdlib/jre7" as File
|
||||
project(':kotlin-stdlib-jre8').projectDir = "$rootDir/libraries/stdlib/jre8" as File
|
||||
project(':kotlin-stdlib-jdk7').projectDir = "$rootDir/libraries/stdlib/jdk7" as File
|
||||
project(':kotlin-stdlib-jdk8').projectDir = "$rootDir/libraries/stdlib/jdk8" as File
|
||||
project(':kotlin-stdlib:samples').projectDir = "$rootDir/libraries/stdlib/samples" as File
|
||||
project(':kotlin-reflect').projectDir = "$rootDir/libraries/tools/kotlin-reflect" as File
|
||||
project(':kotlin-compiler').projectDir = "$rootDir/prepare/compiler" as File
|
||||
|
||||
Reference in New Issue
Block a user