diff --git a/.github/workflows/validate-events-data.yml b/.github/workflows/validate-events-data.yml index 0815295df56..5a48b0df923 100644 --- a/.github/workflows/validate-events-data.yml +++ b/.github/workflows/validate-events-data.yml @@ -7,7 +7,7 @@ on: branches: [ master ] jobs: - validate_user_groups_data: + validate_community_events_data: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/verify-samples.yml b/.github/workflows/verify-samples.yml index f28cf2d17e0..b6ab2090e13 100644 --- a/.github/workflows/verify-samples.yml +++ b/.github/workflows/verify-samples.yml @@ -6,14 +6,14 @@ on: pull_request: branches: [ master ] jobs: - build: + verify_samples: runs-on: ubuntu-latest steps: - name: Set up JDK - uses: actions/setup-java@v2 + uses: actions/setup-java@v3 with: - java-version: '11' - distribution: 'adopt' + java-version: '17' + distribution: 'zulu' - name: Run a verifier uses: AlexanderPrendota/kotlin-samples-verifier@master with: diff --git a/.idea/kotlin-web-site.iml b/.idea/kotlin-web-site.iml index bbb1615ccf4..a712f720706 100644 --- a/.idea/kotlin-web-site.iml +++ b/.idea/kotlin-web-site.iml @@ -97,13 +97,15 @@ - + + + diff --git a/.teamcity/BuildParams.kt b/.teamcity/BuildParams.kt index 62a22cc9d92..f65357e2c45 100644 --- a/.teamcity/BuildParams.kt +++ b/.teamcity/BuildParams.kt @@ -1,7 +1,10 @@ object BuildParams { - const val KOTLINX_COROUTINES_RELEASE_TAG = "1.6.4" - const val KOTLINX_SERIALIZATION_RELEASE_TAG = "v1.5.0" + const val DOKKA_TEMPLATES_VERSION = "1.9.0-dev-218" + + const val KOTLINX_COROUTINES_RELEASE_TAG = "1.7.1" + const val KOTLINX_SERIALIZATION_RELEASE_TAG = "v1.6.0" const val KOTLINX_DATETIME_RELEASE_TAG = "v0.4.0" + const val KOTLINX_METADATA_JVM_RELEASE_TAG = "v0.7.0" const val SEARCH_APP_ID = "7961PKYRXV" const val SEARCH_INDEX_NAME = "prod_KOTLINLANG_WEBHELP" diff --git a/.teamcity/builds/apiReferences/BuildApiReferencesProject.kt b/.teamcity/builds/apiReferences/BuildApiReferencesProject.kt index aa09d655cee..45ce91968d2 100644 --- a/.teamcity/builds/apiReferences/BuildApiReferencesProject.kt +++ b/.teamcity/builds/apiReferences/BuildApiReferencesProject.kt @@ -9,6 +9,9 @@ import builds.apiReferences.kotlinx.datetime.KotlinxDatetimePrepareDokkaTemplate import builds.apiReferences.kotlinx.serialization.KotlinxSerializationBuildApiReference import builds.apiReferences.kotlinx.serialization.KotlinxSerializationBuildSearchIndex import builds.apiReferences.kotlinx.serialization.KotlinxSerializationPrepareDokkaTemplates +import builds.apiReferences.kotlinx.metadataJvm.KotlinxMetadataJvmBuildApiReference +import builds.apiReferences.kotlinx.metadataJvm.KotlinxMetadataJvmBuildSearchIndex +import builds.apiReferences.kotlinx.metadataJvm.KotlinxMetadataJvmPrepareDokkaTemplates import builds.apiReferences.stdlib.BuildStdlibApiReference import builds.apiReferences.stdlib.StdlibPrepareDokkaTemplates import builds.apiReferences.templates.BuildApiReference @@ -17,6 +20,7 @@ import builds.apiReferences.templates.PrepareDokkaTemplate import builds.apiReferences.vcsRoots.KotlinxCoroutines import builds.apiReferences.vcsRoots.KotlinxSerialization import builds.apiReferences.vcsRoots.KotlinxDatetime +import builds.apiReferences.vcsRoots.Kotlin import jetbrains.buildServer.configs.kotlin.Project object BuildApiReferencesProject : Project({ @@ -35,12 +39,17 @@ object BuildApiReferencesProject : Project({ buildType(KotlinxCoroutinesBuildSearchIndex) buildType(KotlinxCoroutinesPrepareDokkaTemplates) + buildType(KotlinxMetadataJvmBuildApiReference) + buildType(KotlinxMetadataJvmBuildSearchIndex) + buildType(KotlinxMetadataJvmPrepareDokkaTemplates) + buildType(BuildStdlibApiReference) buildType(StdlibPrepareDokkaTemplates) vcsRoot(KotlinxSerialization) vcsRoot(KotlinxCoroutines) vcsRoot(KotlinxDatetime) + vcsRoot(Kotlin) template(PrepareDokkaTemplate) template(BuildApiReference) diff --git a/.teamcity/builds/apiReferences/kotlinx/coroutines/KotlinxCoroutinesBuildApiReference.kt b/.teamcity/builds/apiReferences/kotlinx/coroutines/KotlinxCoroutinesBuildApiReference.kt index d7e54116c94..b967eed1962 100644 --- a/.teamcity/builds/apiReferences/kotlinx/coroutines/KotlinxCoroutinesBuildApiReference.kt +++ b/.teamcity/builds/apiReferences/kotlinx/coroutines/KotlinxCoroutinesBuildApiReference.kt @@ -1,30 +1,24 @@ package builds.apiReferences.kotlinx.coroutines +import BuildParams.KOTLINX_COROUTINES_RELEASE_TAG import builds.apiReferences.dependsOnDokkaTemplate import builds.apiReferences.templates.BuildApiReference import jetbrains.buildServer.configs.kotlin.BuildType -import jetbrains.buildServer.configs.kotlin.triggers.vcs -object KotlinxCoroutinesBuildApiReference: BuildType({ - name = "kotlinx.coroutines API reference" +object KotlinxCoroutinesBuildApiReference : BuildType({ + name = "kotlinx.coroutines API reference" - templates(BuildApiReference) + templates(BuildApiReference) - params { - param("release.tag", BuildParams.KOTLINX_COROUTINES_RELEASE_TAG) - } - - vcs { - root(builds.apiReferences.vcsRoots.KotlinxCoroutines) - } + params { + param("release.tag", KOTLINX_COROUTINES_RELEASE_TAG) + } - triggers { vcs { - branchFilter = "+:" + root(builds.apiReferences.vcsRoots.KotlinxCoroutines) } - } - dependencies { - dependsOnDokkaTemplate(KotlinxCoroutinesPrepareDokkaTemplates) - } -}) \ No newline at end of file + dependencies { + dependsOnDokkaTemplate(KotlinxCoroutinesPrepareDokkaTemplates) + } +}) diff --git a/.teamcity/builds/apiReferences/kotlinx/datetime/KotlinxDatetimeBuildApiReference.kt b/.teamcity/builds/apiReferences/kotlinx/datetime/KotlinxDatetimeBuildApiReference.kt index 3fc334a56d5..c2dbc884a4c 100644 --- a/.teamcity/builds/apiReferences/kotlinx/datetime/KotlinxDatetimeBuildApiReference.kt +++ b/.teamcity/builds/apiReferences/kotlinx/datetime/KotlinxDatetimeBuildApiReference.kt @@ -1,52 +1,40 @@ package builds.apiReferences.kotlinx.datetime +import BuildParams.KOTLINX_DATETIME_RELEASE_TAG import builds.apiReferences.dependsOnDokkaTemplate +import builds.apiReferences.templates.BuildApiReference +import builds.apiReferences.templates.buildDokkaHTML +import builds.apiReferences.templates.scriptDropSnapshot import jetbrains.buildServer.configs.kotlin.BuildType -import jetbrains.buildServer.configs.kotlin.buildSteps.gradle -import jetbrains.buildServer.configs.kotlin.buildSteps.script -import jetbrains.buildServer.configs.kotlin.triggers.vcs object KotlinxDatetimeBuildApiReference : BuildType({ - name = "kotlinx-datetime API reference" + name = "kotlinx-datetime API reference" - artifactRules = "core/build/dokka/html/** => pages.zip" + templates(BuildApiReference) - steps { - script { - name = "Drop SNAPSHOT word for deploy" - scriptContent = """ - #!/bin/bash - sed -i -E "s/versionSuffix=SNAPSHOT//gi" ./gradle.properties - """.trimIndent() - dockerImage = "debian" - } - gradle { - name = "Build dokka html" - tasks = ":kotlinx-datetime:dokkaHtml" - useGradleWrapper = true - } - } - - params { - param("release.tag", BuildParams.KOTLINX_DATETIME_RELEASE_TAG) - param("teamcity.vcsTrigger.runBuildInNewEmptyBranch", "true") - } + artifactRules = "core/build/dokka/html/** => pages.zip" - vcs { - root(builds.apiReferences.vcsRoots.KotlinxDatetime) - } + params { + param("release.tag", KOTLINX_DATETIME_RELEASE_TAG) + } - triggers { vcs { - branchFilter = "+:" + root(builds.apiReferences.vcsRoots.KotlinxDatetime) } - } - requirements { - doesNotContain("teamcity.agent.name", "windows") - } + dependencies { + dependsOnDokkaTemplate(KotlinxDatetimePrepareDokkaTemplates, "core/dokka-templates") + } - dependencies { - dependsOnDokkaTemplate(KotlinxDatetimePrepareDokkaTemplates, "core/dokka-templates") - } + steps { + scriptDropSnapshot { + scriptContent = """ + #!/bin/bash + sed -i -E "s/versionSuffix=SNAPSHOT//gi" ./gradle.properties + """.trimIndent() + } + buildDokkaHTML { + tasks = ":kotlinx-datetime:dokkaHtml" + } + } }) diff --git a/.teamcity/builds/apiReferences/kotlinx/metadataJvm/KotlinxMetadataJvmBuildApiReference.kt b/.teamcity/builds/apiReferences/kotlinx/metadataJvm/KotlinxMetadataJvmBuildApiReference.kt new file mode 100644 index 00000000000..aa7ec34c81e --- /dev/null +++ b/.teamcity/builds/apiReferences/kotlinx/metadataJvm/KotlinxMetadataJvmBuildApiReference.kt @@ -0,0 +1,81 @@ +package builds.apiReferences.kotlinx.metadataJvm + +import BuildParams.KOTLINX_METADATA_JVM_RELEASE_TAG +import builds.apiReferences.dependsOnDokkaTemplate +import builds.apiReferences.templates.* +import jetbrains.buildServer.configs.kotlin.BuildType +import jetbrains.buildServer.configs.kotlin.buildSteps.script + +object KotlinxMetadataJvmBuildApiReference : BuildType({ + name = "kotlinx-metadata-jvm API reference" + + templates(BuildApiReference) + + artifactRules = "libraries/kotlinx-metadata/jvm/build/dokka/** => pages.zip" + + params { + param("release.tag", KOTLINX_METADATA_JVM_RELEASE_TAG) + } + + triggers { + vcsDefaultTrigger { + enabled = false + } + } + + vcs { + root(builds.apiReferences.vcsRoots.Kotlin) + } + + steps { + scriptDropSnapshot { + enabled = false + } + buildDokkaHTML { + enabled = false + } + scriptDokkaVersionSync { + scriptContent = """ + #!/bin/bash + set -e + set +x + set -o pipefail + set -u + + # update Dokka version + sed -i -E "s/dokka ?= ?\"[0-9\.]+\"/dokka = \"%DOKKA_TEMPLATES_VERSION%\"/gi" ./gradle/libs.versions.toml + + # Define the replacement string + replacement="maven(url = \"$DOKKA_SPACE_REPO\")\nmavenCentral" + + # List of kts files to apply the command on + files=( + "./build.gradle.kts" + "./repo/gradle-settings-conventions/settings.gradle.kts" + "./repo/gradle-build-conventions/buildsrc-compat/build.gradle.kts" + ) + + # Loop through the files and apply the sed command + for file in "${'$'}{files[@]}"; do + sed -i -E "s|mavenCentral|${'$'}replacement|" "${'$'}file" + done + + # modify Groovy file + sed -i -E "s|mavenCentral|maven \{ url \"$DOKKA_SPACE_REPO\" \}\nmavenCentral|" ./settings.gradle + + # add Dokka dev artifacts to the list of trusted ones + sed -i -E "s||\n\n|" ./gradle/verification-metadata.xml + """.trimIndent() + } + script { + name = "build api reference" + scriptContent = """ + ./gradlew :kotlinx-metadata-jvm:dokkaHtml -PkotlinxMetadataDeployVersion=${KOTLINX_METADATA_JVM_RELEASE_TAG} + """.trimIndent() + } + } + + dependencies { + dependsOnDokkaTemplate(KotlinxMetadataJvmPrepareDokkaTemplates, "libraries/kotlinx-metadata/jvm/dokka-templates") + } +}) diff --git a/.teamcity/builds/apiReferences/kotlinx/metadataJvm/KotlinxMetadataJvmBuildSearchIndex.kt b/.teamcity/builds/apiReferences/kotlinx/metadataJvm/KotlinxMetadataJvmBuildSearchIndex.kt new file mode 100644 index 00000000000..3d8d6485b9e --- /dev/null +++ b/.teamcity/builds/apiReferences/kotlinx/metadataJvm/KotlinxMetadataJvmBuildSearchIndex.kt @@ -0,0 +1,20 @@ +package builds.apiReferences.kotlinx.metadataJvm + +import builds.apiReferences.dependsOnDokkaPagesJson +import builds.apiReferences.templates.BuildApiReferenceSearchIndex +import jetbrains.buildServer.configs.kotlin.BuildType + +object KotlinxMetadataJvmBuildSearchIndex: BuildType({ + name = "Build search index for kotlinx-metadata-jvm" + + templates(BuildApiReferenceSearchIndex) + + params { + param("env.ALGOLIA_INDEX_NAME", "kotlinx-metadata-jvm") + param("env.API_REFERENCE_URL", "/api/kotlinx-metadata-jvm") + } + + dependencies { + dependsOnDokkaPagesJson(KotlinxMetadataJvmBuildApiReference) + } +}) diff --git a/.teamcity/builds/apiReferences/kotlinx/metadataJvm/KotlinxMetadataJvmPrepareDokkaTemplates.kt b/.teamcity/builds/apiReferences/kotlinx/metadataJvm/KotlinxMetadataJvmPrepareDokkaTemplates.kt new file mode 100644 index 00000000000..15e08bfdf90 --- /dev/null +++ b/.teamcity/builds/apiReferences/kotlinx/metadataJvm/KotlinxMetadataJvmPrepareDokkaTemplates.kt @@ -0,0 +1,14 @@ +package builds.apiReferences.kotlinx.metadataJvm + +import builds.apiReferences.templates.PrepareDokkaTemplate +import jetbrains.buildServer.configs.kotlin.BuildType + +object KotlinxMetadataJvmPrepareDokkaTemplates: BuildType({ + name = "Prepare dokka templates for kotlinx-metadata-jvm" + + templates(PrepareDokkaTemplate) + + params { + param("env.ALGOLIA_INDEX_NAME", "kotlinx-metadata-jvm") + } +}) diff --git a/.teamcity/builds/apiReferences/kotlinx/serialization/KotlinxSerializationBuildApiReference.kt b/.teamcity/builds/apiReferences/kotlinx/serialization/KotlinxSerializationBuildApiReference.kt index aebc79aa9c1..06856c18b79 100644 --- a/.teamcity/builds/apiReferences/kotlinx/serialization/KotlinxSerializationBuildApiReference.kt +++ b/.teamcity/builds/apiReferences/kotlinx/serialization/KotlinxSerializationBuildApiReference.kt @@ -1,30 +1,24 @@ package builds.apiReferences.kotlinx.serialization +import BuildParams.KOTLINX_SERIALIZATION_RELEASE_TAG import builds.apiReferences.dependsOnDokkaTemplate import builds.apiReferences.templates.BuildApiReference import jetbrains.buildServer.configs.kotlin.BuildType -import jetbrains.buildServer.configs.kotlin.triggers.vcs object KotlinxSerializationBuildApiReference : BuildType({ - name = "kotlinx.serialization API reference" + name = "kotlinx.serialization API reference" - templates(BuildApiReference) + templates(BuildApiReference) - params { - param("release.tag", BuildParams.KOTLINX_SERIALIZATION_RELEASE_TAG) - } - - vcs { - root(builds.apiReferences.vcsRoots.KotlinxSerialization) - } + params { + param("release.tag", KOTLINX_SERIALIZATION_RELEASE_TAG) + } - triggers { vcs { - branchFilter = "+:" + root(builds.apiReferences.vcsRoots.KotlinxSerialization) } - } - dependencies { - dependsOnDokkaTemplate(KotlinxSerializationPrepareDokkaTemplates) - } + dependencies { + dependsOnDokkaTemplate(KotlinxSerializationPrepareDokkaTemplates) + } }) diff --git a/.teamcity/builds/apiReferences/stdlib/BuildStdlibApiReference.kt b/.teamcity/builds/apiReferences/stdlib/BuildStdlibApiReference.kt index a4afb7ce21e..a1c0aa99eb1 100644 --- a/.teamcity/builds/apiReferences/stdlib/BuildStdlibApiReference.kt +++ b/.teamcity/builds/apiReferences/stdlib/BuildStdlibApiReference.kt @@ -1,6 +1,6 @@ package builds.apiReferences.stdlib -import jetbrains.buildServer.configs.kotlin.AbsoluteId +import jetbrains.buildServer.configs.kotlin.* import jetbrains.buildServer.configs.kotlin.BuildType object BuildStdlibApiReference : BuildType({ @@ -9,10 +9,15 @@ object BuildStdlibApiReference : BuildType({ artifactRules = "latest-version.zip" dependencies { - artifacts(AbsoluteId("Kotlin_BuildPlayground_Sirius_LibraryReferenceLatestDocs")) { - buildRule = lastPinned("+:*") - cleanDestination = true - artifactRules = "latest-version.zip" + dependency(AbsoluteId("Kotlin_BuildPlayground_Sirius_LibraryReferenceLatestDocs")) { + snapshot { + reuseBuilds = ReuseBuilds.SUCCESSFUL + onDependencyFailure = FailureAction.FAIL_TO_START + } + artifacts { + cleanDestination = true + artifactRules = "latest-version.zip" + } } } }) \ No newline at end of file diff --git a/.teamcity/builds/apiReferences/templates/BuildApiReference.kt b/.teamcity/builds/apiReferences/templates/BuildApiReference.kt index 5435d827707..fe1bfb00681 100644 --- a/.teamcity/builds/apiReferences/templates/BuildApiReference.kt +++ b/.teamcity/builds/apiReferences/templates/BuildApiReference.kt @@ -1,37 +1,80 @@ package builds.apiReferences.templates +import BuildParams.DOKKA_TEMPLATES_VERSION +import jetbrains.buildServer.configs.kotlin.BuildSteps import jetbrains.buildServer.configs.kotlin.Template -import jetbrains.buildServer.configs.kotlin.buildSteps.gradle -import jetbrains.buildServer.configs.kotlin.buildSteps.script +import jetbrains.buildServer.configs.kotlin.Trigger +import jetbrains.buildServer.configs.kotlin.Triggers +import jetbrains.buildServer.configs.kotlin.buildSteps.GradleBuildStep +import jetbrains.buildServer.configs.kotlin.buildSteps.ScriptBuildStep +import jetbrains.buildServer.configs.kotlin.triggers.VcsTrigger +import jetbrains.buildServer.configs.kotlin.triggers.vcs +fun BuildSteps.scriptDropSnapshot(block: ScriptBuildStep.() -> Unit) = step( + ScriptBuildStep { + id = "step-drop-snapshot-id" + name = "Drop SNAPSHOT word for deploy" + dockerImage = "debian" + scriptContent = """ + #!/bin/bash + CURRENT_VERSION="$(sed -E s/^v?//g <<<%release.tag%)" + sed -i -E "s/^version=.+(-SNAPSHOT)?/version=${'$'}CURRENT_VERSION/gi" ./gradle.properties + """.trimIndent() + }.apply(block), +) + +const val DOKKA_SPACE_REPO = "https://maven.pkg.jetbrains.space/kotlin/p/dokka/dev/" + +fun BuildSteps.scriptDokkaVersionSync(block: ScriptBuildStep.() -> Unit) = step( + ScriptBuildStep { + id = "step-dokka-version-sync-id" + name = "Sync dokka version with main repository templates" + dockerImage = "debian" + scriptContent = """ + #!/bin/bash + sed -i -E "s/^(dokka_version|dokkaVersion)=.+/\1=%DOKKA_TEMPLATES_VERSION%/gi" ./gradle.properties + find . -name "*.gradle.kts" -exec sed -i -E "s|mavenCentral|maven(url = \"$DOKKA_SPACE_REPO\")\nmavenCentral|" {} \; + find . -name "*.gradle" -exec sed -i -E "s|mavenCentral|maven \{ url \"$DOKKA_SPACE_REPO\" \}\nmavenCentral|" {} \; + """.trimIndent() + }.apply(block), +) + +fun BuildSteps.buildDokkaHTML(block: GradleBuildStep.() -> Unit) = step( + GradleBuildStep { + id = "step-build-dokka-html-id" + name = "Build dokka html" + tasks = "dokkaHtmlMultiModule" + }.apply(block), +) + +fun Triggers.vcsDefaultTrigger(block: Trigger.() -> Unit) = trigger( + VcsTrigger { + id = "trigger-vcs-default-trigger-id" + branchFilter = "+:" + }.apply(block) +) object BuildApiReference : Template({ - name = "Dokka Reference Template" - - artifactRules = "build/dokka/htmlMultiModule/** => pages.zip" - - steps { - script { - name = "Drop SNAPSHOT word for deploy" - scriptContent = """ - #!/bin/bash - CURRENT_VERSION="$(sed -E s/^v?//g <<<%release.tag%)" - sed -i -E "s/^version=.+(-SNAPSHOT)?/version=${'$'}CURRENT_VERSION/gi" ./gradle.properties - """.trimIndent() - dockerImage = "debian" + name = "Dokka Reference Template" + + artifactRules = "build/dokka/htmlMultiModule/** => pages.zip" + + params { + param("teamcity.vcsTrigger.runBuildInNewEmptyBranch", "true") + param("DOKKA_TEMPLATES_VERSION", DOKKA_TEMPLATES_VERSION) } - gradle { - name = "Build dokka html" - tasks = "dokkaHtmlMultiModule" + triggers { + vcsDefaultTrigger {} } - } - requirements { - contains("docker.server.osType", "linux") - } + requirements { + contains("docker.server.osType", "linux") + } - params { - param("teamcity.vcsTrigger.runBuildInNewEmptyBranch", "true") - } + steps { + scriptDropSnapshot {} + scriptDokkaVersionSync {} + buildDokkaHTML {} + } }) diff --git a/.teamcity/builds/apiReferences/vcsRoots/Kotlin.kt b/.teamcity/builds/apiReferences/vcsRoots/Kotlin.kt new file mode 100644 index 00000000000..3973aa99078 --- /dev/null +++ b/.teamcity/builds/apiReferences/vcsRoots/Kotlin.kt @@ -0,0 +1,17 @@ +package builds.apiReferences.vcsRoots + +import jetbrains.buildServer.configs.kotlin.vcs.GitVcsRoot + +object Kotlin : GitVcsRoot({ + name = "kotlin vcs root" + url = "git@github.com:JetBrains/kotlin.git" + branch = "refs/heads/master" + branchSpec = """ + +:refs/heads/(*) + """.trimIndent() + useTagsAsBranches = true + checkoutPolicy = AgentCheckoutPolicy.USE_MIRRORS + authMethod = uploadedKey { + uploadedKey = "teamcity" + } +}) diff --git a/.teamcity/builds/apiReferences/vcsRoots/KotlinxCoroutines.kt b/.teamcity/builds/apiReferences/vcsRoots/KotlinxCoroutines.kt index 1c05f2afcce..fd1bf9e9283 100644 --- a/.teamcity/builds/apiReferences/vcsRoots/KotlinxCoroutines.kt +++ b/.teamcity/builds/apiReferences/vcsRoots/KotlinxCoroutines.kt @@ -4,7 +4,7 @@ import jetbrains.buildServer.configs.kotlin.vcs.GitVcsRoot object KotlinxCoroutines : GitVcsRoot({ name = "kotlinx.coroutines vcs root" - url = "git@github.com:nikpachoo/kotlinx.coroutines.git" + url = "git@github.com:Kotlin/kotlinx.coroutines.git" branch = "refs/heads/master" branchSpec = """ +:refs/heads/(*) diff --git a/.teamcity/builds/apiReferences/vcsRoots/KotlinxDatetime.kt b/.teamcity/builds/apiReferences/vcsRoots/KotlinxDatetime.kt index 6542b689d6d..2faf3b6c4b8 100644 --- a/.teamcity/builds/apiReferences/vcsRoots/KotlinxDatetime.kt +++ b/.teamcity/builds/apiReferences/vcsRoots/KotlinxDatetime.kt @@ -5,7 +5,7 @@ import jetbrains.buildServer.configs.kotlin.vcs.GitVcsRoot object KotlinxDatetime: GitVcsRoot({ name = "kotlinx-datetime vcs root" url = "git@github.com:Kotlin/kotlinx-datetime.git" - branch = "refs/heads/master"//"refs/tags/${BuildParams.KOTLINX_DATETIME_RELEASE_TAG}" + branch = "refs/heads/latest-release" branchSpec = """ +:refs/heads/(*) +:refs/tags/(*) diff --git a/.teamcity/builds/kotlinlang/buidTypes/BuildSitePages.kt b/.teamcity/builds/kotlinlang/buidTypes/BuildSitePages.kt index 4e59e89adc0..23c9ad2304c 100644 --- a/.teamcity/builds/kotlinlang/buidTypes/BuildSitePages.kt +++ b/.teamcity/builds/kotlinlang/buidTypes/BuildSitePages.kt @@ -2,6 +2,7 @@ package builds.kotlinlang.buidTypes import builds.apiReferences.kotlinx.coroutines.KotlinxCoroutinesBuildApiReference import builds.apiReferences.kotlinx.datetime.KotlinxDatetimeBuildApiReference +import builds.apiReferences.kotlinx.metadataJvm.KotlinxMetadataJvmBuildApiReference import builds.apiReferences.kotlinx.serialization.KotlinxSerializationBuildApiReference import builds.kotlinlang.templates.DockerImageBuilder import jetbrains.buildServer.configs.kotlin.* @@ -167,7 +168,18 @@ object BuildSitePages : BuildType({ } } - artifacts(AbsoluteId("Kotlin_KotlinRelease_1820_LibraryReferenceLegacyDocs")) { + dependency(KotlinxMetadataJvmBuildApiReference) { + snapshot { + reuseBuilds = ReuseBuilds.NO + onDependencyFailure = FailureAction.FAIL_TO_START + } + + artifacts { + artifactRules = "+:pages.zip!** => libs/kotlinx-metadata-jvm/" + } + } + + artifacts(AbsoluteId("Kotlin_KotlinRelease_190_LibraryReferenceLegacyDocs")) { buildRule = tag("publish", """ +: +:* diff --git a/.teamcity/settings.kts b/.teamcity/settings.kts index e629aba4d72..3719abcbc85 100644 --- a/.teamcity/settings.kts +++ b/.teamcity/settings.kts @@ -22,7 +22,7 @@ To debug in IntelliJ Idea, open the 'Maven Projects' tool window (View 'Debug' option is available in the context menu for the task. */ -version = "2022.10" +version = "2023.05" project { subProject(builds.kotlinlang.SiteProject) diff --git a/CODEOWNERS b/CODEOWNERS new file mode 100644 index 00000000000..a3775b6ea6f --- /dev/null +++ b/CODEOWNERS @@ -0,0 +1,11 @@ +* @zoobestik @nikpachoo @krutilov + +# Community events +/data/events.yml @MKrishtal +/data/user-groups.yml @MKrishtal + +# Tech Writers Team +/docs/ @JetBrains/kotlin-technical-writing +/assets/kotlin-reference.pdf @JetBrains/kotlin-technical-writing +/static/js/page/api/api.js @JetBrains/kotlin-technical-writing +/data/releases.yml @JetBrains/kotlin-technical-writing diff --git a/assets/images/index/banners/kotlin-conf-keynote.jpg b/assets/images/index/banners/kotlin-conf-keynote.jpg deleted file mode 100644 index 5c2d625fa36..00000000000 Binary files a/assets/images/index/banners/kotlin-conf-keynote.jpg and /dev/null differ diff --git a/assets/images/index/banners/kotlin-conf-keynote_mobile.jpg b/assets/images/index/banners/kotlin-conf-keynote_mobile.jpg deleted file mode 100644 index b9bce4b15b4..00000000000 Binary files a/assets/images/index/banners/kotlin-conf-keynote_mobile.jpg and /dev/null differ diff --git a/assets/images/index/banners/kotlin_2.0_blog-mobile.jpg b/assets/images/index/banners/kotlin_2.0_blog-mobile.jpg deleted file mode 100644 index 808f140f878..00000000000 Binary files a/assets/images/index/banners/kotlin_2.0_blog-mobile.jpg and /dev/null differ diff --git a/assets/images/index/banners/kotlin_2.0_blog.jpg b/assets/images/index/banners/kotlin_2.0_blog.jpg deleted file mode 100644 index b738bf14f0e..00000000000 Binary files a/assets/images/index/banners/kotlin_2.0_blog.jpg and /dev/null differ diff --git a/assets/images/index/banners/kotlinconf24.jpg b/assets/images/index/banners/kotlinconf24.jpg new file mode 100644 index 00000000000..ed17127522a Binary files /dev/null and b/assets/images/index/banners/kotlinconf24.jpg differ diff --git a/assets/images/index/banners/kotlinconf24_mobile.jpg b/assets/images/index/banners/kotlinconf24_mobile.jpg new file mode 100644 index 00000000000..5a346316548 Binary files /dev/null and b/assets/images/index/banners/kotlinconf24_mobile.jpg differ diff --git a/assets/images/ktl-component/teach/universities/harvard.jpg b/assets/images/ktl-component/teach/universities/harvard.jpg new file mode 100644 index 00000000000..e5c94cbc844 Binary files /dev/null and b/assets/images/ktl-component/teach/universities/harvard.jpg differ diff --git a/assets/kotlin-reference.pdf b/assets/kotlin-reference.pdf index 912f6f7a5dd..966f63c0f19 100644 Binary files a/assets/kotlin-reference.pdf and b/assets/kotlin-reference.pdf differ diff --git a/data/_nav.yml b/data/_nav.yml index ecfadd35f3b..5480641607f 100644 --- a/data/_nav.yml +++ b/data/_nav.yml @@ -374,6 +374,8 @@ reference: title: Compatibility Guide for Kotlin 1.7.20 - url: /docs/reference/compatibility-guide-18.html title: Compatibility Guide for Kotlin 1.8.0 + - url: /docs/reference/compatibility-guide-19.html + title: Compatibility Guide for Kotlin 1.9.0 - title: 常见问题 description: 你想到的问题可能会在这里得到解答。 diff --git a/data/events.yml b/data/events.yml index 6005bf2d180..ccd85bc4d98 100644 --- a/data/events.yml +++ b/data/events.yml @@ -1,3 +1,115 @@ +- lang: de + startDate: '2023-10-16' + endDate: '2023-10-17' + online: true + speaker : 'Sebastian Aigner' + title : '' + subject : 'KKON' + url: https://rheinwerk-kkon.de/ +- lang: en + startDate: '2023-09-21' + endDate: '2023-09-22' + location: Amsterdam, Netherlands + speaker : 'Garth Gilmour' + title : '' + subject : 'Kotlin Training Day' + url: https://pages.xebia.com/kotlin-training-day +- lang: en + startDate: '2023-09-14' + endDate: '2023-09-15' + location: New York, USA + speaker : '' + title : '' + subject : 'droidcon New York' + url: https://nyc.droidcon.com/ +- lang: en + startDate: '2023-06-27' + endDate: '2023-06-27' + location: Vienna, Austria + speaker : 'Kariem Hussein' + title : 'Kotlin User Group Vienna' + subject : 'AI support for Kotlin Development in Android Studio' + url: https://www.meetup.com/kotlin-vienna/events/290438424/ +- lang: en + startDate: '2023-06-28' + endDate: '2023-06-28' + location: Berlin, Germany + speaker : 'Karin-Aleksandra Monoid' + title : 'Kotlin User Group Berlin' + subject : 'Configuration Management in Kotlin: The Basics' + url: https://www.meetup.com/kotlin-berlin/events/294252176/ +- lang: en + startDate: '2023-07-12' + endDate: '2023-07-12' + location: Amsterdam, Netherlands + speaker : 'Alejandro Serrano Mena' + title : 'Dutch Kotlin User Group' + subject : 'Safe concurrency: resources and resilience' + url: https://www.meetup.com/nlkug-dutch-kotlin-user-group/events/294135157 +- lang: en + startDate: '2023-07-12' + endDate: '2023-07-12' + location: Amsterdam, Netherlands + speaker : 'René Bulsing' + title : 'Dutch Kotlin User Group' + subject : 'Beyond K2: What features are next and how you can use them' + url: https://www.meetup.com/nlkug-dutch-kotlin-user-group/events/294135157 +- lang: en + startDate: '2023-07-12' + endDate: '2023-07-12' + location: Amsterdam, Netherlands + speaker : 'Urs Peter' + title : 'Dutch Kotlin User Group' + subject : 'Unraveling the most Kotlin-Friendly Framework: Springboot vs. Quarkus vs. Micronaut. Who Claims the Krown?' + url: https://www.meetup.com/nlkug-dutch-kotlin-user-group/events/294135157 +- lang: en + startDate: '2023-07-18' + endDate: '2023-07-18' + location: Brighton, UK + speaker : 'Michele Sollecito' + title : 'Brighton Kotlin' + subject : 'Apache Pulsar with Kotlin couroutines and flows' + url: https://www.meetup.com/brighton-kotlin/events/294227622/ +- lang: en + startDate: '2023-06-24' + endDate: '2023-06-24' + location: Nairobi, Kenya + speaker : 'Dennis Githuku' + title : 'Kotlin Kenya - June Meetup' + subject : 'Side Effects in Jetpack Compose' + url: https://www.meetup.com/KotlinKenya/events/294262326 +- lang: en + startDate: '2023-06-24' + endDate: '2023-06-24' + location: Nairobi, Kenya + speaker : 'Kenneth Mathari' + title : 'Kotlin Kenya - June Meetup' + subject : 'Is Graphql replacing REST in Android Development' + url: https://www.meetup.com/KotlinKenya/events/294262326 +- lang: en + startDate: '2023-06-24' + endDate: '2023-06-24' + location: Nairobi, Kenya + speaker : 'Kenn Junior' + title : 'Kotlin Kenya - June Meetup' + subject : 'Notification : Past, Present & Future' + url: https://www.meetup.com/KotlinKenya/events/294262326 +- lang: en + startDate: '2023-06-13' + endDate: '2023-06-13' + location: Nieuwegein, Netherlands + speaker : '' + title : 'Utrecht Kotlin Meetup' + subject : 'Exploratory Testing | Navigating Through Uncharted Territory' + url: https://www.meetup.com/meetup-group-YgJEOzCn/events/293993904/ +- lang: en + startDate: '2023-06-13' + endDate: '2023-06-13' + location: Limassol, Cyprus + speaker : Nikita Lipsky + title : 'Kotlin User Group Cyprus' + subject : 'Compose Multiplatform on iOS' + url: https://www.eventbrite.com/e/cyprus-kotlin-user-group-meetup-1306-tickets-636457520577 - lang: en startDate: '2023-05-09' endDate: '2023-05-09' diff --git a/data/last-news.yml b/data/last-news.yml index 3949b20b03f..08da8f70c61 100644 --- a/data/last-news.yml +++ b/data/last-news.yml @@ -1,11 +1,11 @@ +- title: "KotlinConf 2024 Tickets Are Now Available!" + link: https://blog.jetbrains.com/kotlin/2023/07/kotlinconf-2024/ + - title: "Updated Kotlin roadmap for 2023" link: https://kotlinlang.org/docs/roadmap.html - title: "Kotlin Multiplatform Mobile Content Creators" link: https://blog.jetbrains.com/kotlin/2022/12/shout-out-to-kotlin-multiplatform-mobile-content-creators/ -- title: "KotlinDL 0.5 Has Come to Android!" - link: https://blog.jetbrains.com/kotlin/2022/12/kotlindl-0-5-has-come-to-android/ - - title: "Reproducible Kotlin Compiler Artifacts" link: https://blog.jetbrains.com/kotlin/2023/02/reproducible-kotlin-compiler-artifacts/ diff --git a/data/release-banner.yml b/data/release-banner.yml index 2ea8fe8831b..3a375496165 100644 --- a/data/release-banner.yml +++ b/data/release-banner.yml @@ -1,10 +1,9 @@ isActive: false -version: 1.8.20 +version: 1.9.0 versionSuffix: "" -url: https://blog.jetbrains.com/kotlin/2023/04/kotlin-1-8-20-released/ +url: https://blog.jetbrains.com/kotlin/2023/07/kotlin-1-9-0-released/ keyFeatures: - - New K2 compiler updates - - AutoCloseable interface and Base64 encoding in stdlib - - New JVM incremental compilation by default - - Preview of Gradle composite builds in Multiplatform - - New Kotlin/Wasm target + - The K2 compiler for the JVM is now in Beta + - Great improvements for the standard library + - Preview of custom memory allocator in Kotlin/Native + - Size-related optimizations in Kotlin/Wasm diff --git a/data/releases.yml b/data/releases.yml index fa29c437f18..46115006790 100644 --- a/data/releases.yml +++ b/data/releases.yml @@ -1,6 +1,6 @@ url: https://github.com/JetBrains/kotlin/releases latest: - version: 1.8.21 - url: https://github.com/JetBrains/kotlin/releases/tag/v1.8.21 + version: 1.9.10 + url: https://github.com/JetBrains/kotlin/releases/tag/v1.9.10 diff --git a/data/testimonials.yml b/data/testimonials.yml index 305d1f22e76..e355b4c8c04 100644 --- a/data/testimonials.yml +++ b/data/testimonials.yml @@ -5,7 +5,7 @@ url: https://www.corda.net/2017/01/10/kotlin/ text: Corda 是一个开源分布式分类账号平台,由各大银行提供支持,完全由 Kotlin 构建。 - company: Evernote - url: https://blog.evernote.com/tech/2017/01/26/android-state-library/ + url: https://evernote.com/blog/android-state-library/ text: Evernote 最近将 Kotlin 集成到了他们的 Android 客户端 - company: Coursera url: https://building.coursera.org/blog/2016/03/16/becoming-bilingual-coursera/ diff --git a/data/universities.yml b/data/universities.yml index 71a77746969..722233526a3 100644 --- a/data/universities.yml +++ b/data/universities.yml @@ -1,3 +1,19 @@ +- title: Harvard University + location: Cambridge, MA (US) + courses: + - name: 'CS50x Introduction to Computer Science' + url: https://cs50.harvard.edu/x/2022/gallery/ + geo: + lat: '42.3576808' + lng: '-71.1288621' +- title: University of Cambridge + location: Cambridge (UK) + courses: + - name: 'Kotlin: Essential Training' + url: https://training.cam.ac.uk/ucs/event/4426749 + geo: + lat: '52.205356' + lng: '-0.1109793' - title: Stanford University location: Stanford, CA (US) courses: @@ -14,11 +30,19 @@ geo: lat: '51.605515' lng: '-0.337587' +- title: University of Chicago + location: Chicago, IL (US) + courses: + - name: 'MPCS 51132. Full Stack Software Engineering' + url: https://mpcs-courses.cs.uchicago.edu/2022-23/summer/courses/mpcs-51132-1 + geo: + lat: '42.14880982' + lng: '-87.58542941' - title: University of Pennsylvania location: Philadelphia, PA (US) courses: - - name: 'CIS 195-202: Android' - url: https://www.imperial.ac.uk/computing/current-students/courses/40009/ + - name: 'CIS 1950 - Mobile App Development' + url: https://catalog.upenn.edu/courses/cis/ geo: lat: '39.966627' lng: '-75.178587' @@ -30,6 +54,22 @@ geo: lat: '39.297268' lng: '-76.594242' +- title: National University of Singapore + location: Singapore (Singapore) + courses: + - name: "CS5248: Systems Support for Continuous Media" + url: https://www.comp.nus.edu.sg/~cs5248/proj.html + geo: + lat: '1.29685712' + lng: '103.7763832' +- title: Cornell University + location: Ithaca, NY (US) + courses: + - name: CS 1998 Intro to Android Development + url: https://android-course.cornellappdev.com/ + geo: + lat: '42.45359958' + lng: '-76.47345979' - title: University of California, Los Angeles location: Los Angeles, CA (US) courses: @@ -38,22 +78,22 @@ geo: lat: '33.770015' lng: '-117.980202' +- title: University of Michigan-Ann Arbor + location: Ann Arbor, MI (US) + courses: + - name: EECS 441 Mobile App Development for Entrepreneurs + url: https://eecs441.eecs.umich.edu/ + geo: + lat: '42.27884877' + lng: '-83.73793244' - title: Duke University location: Durham, NC (US) courses: - - name: Mobile Development Track + - name: "Coding For Android: Kotlin" url: https://colab.duke.edu/roots/course/kotlin-intro geo: lat: '36.037694' lng: '-79.035584' -- title: Northwestern University - location: Evanston, IL (US) - courses: - - name: 'Hello Kotlin: Android Bootcamp with App Factory for grades 9-12' - url: https://www.ctd.northwestern.edu/courses?sort=alpha&fulltext=Hello%20Kotlin#8425 - geo: - lat: '41.440998' - lng: '-87.706986' - title: University of Washington location: Seattle, WA (US) courses: @@ -62,18 +102,18 @@ geo: lat: '47.601109' lng: '-122.303272' -- title: New York University - location: New York, NY (US) +- title: Carnegie Mellon University + location: Pittsburgh, PA (US) courses: - - name: INFO1-CE9416 Android App Development Intensive - url: https://www.sps.nyu.edu/professional-pathways/courses/INFO1-CE9416-android-app-development-intensive.html + - name: 67-443 Mobile Application Design and Development + url: http://coursecatalog.web.cmu.edu/search/?context=catalog&search=67-443 geo: - lat: '40.730544' - lng: '-73.992451' + lat: '40.44336597' + lng: '-79.94280699' - title: University of Edinburgh location: Edinburgh (UK) courses: - - name: Computer Science Large Practical 2017-2018 + - name: Computer Science Large Practical url: http://www.inf.ed.ac.uk/teaching/courses/cslp/ geo: lat: '55.951814' @@ -81,7 +121,7 @@ - title: University of Texas at Austin location: Austin, TX (US) courses: - - name: CS 395T Android Programming + - name: CS 371M Mobile Computing (Android Programming) url: https://www.cs.utexas.edu/users/witchel/371M/index.html geo: lat: '30.244396' @@ -97,8 +137,8 @@ - title: University of Illinois at Urbana-Champaign location: Champaign, IL (US) courses: - - name: CS 125 An Introduction to Computer Science - url: https://cs125.cs.illinois.edu/lessons/kotlin/#spring2021-compoundconditionals + - name: CS 124 An Introduction to Computer Science + url: https://www.cs124.org/ geo: lat: '40.039296' lng: '-88.277982' @@ -121,7 +161,7 @@ - title: Chinese University of Hong Kong location: Hong Kong (China) courses: - - name: 193-179280-01 Introduction to Android Programming using Kotlin 之Android流動程式編寫入門 + - name: Introduction to Android Programming using Kotlin 之Android流動程式編寫入門 url: http://www.scs.cuhk.edu.hk/en/part-time/system-development-and-programming/mobile-programming/introduction-to-android-programming-using-kotlin-kotlin-android/193-179280-01 geo: lat: '22.326371' @@ -145,8 +185,8 @@ - title: Michigan State University location: East Lansing, MI (US) courses: - - name: CSE498, Collaborative Design - url: https://www.cse.msu.edu/~cse498/2020-08/schedules/all-hands-meetings/notes/09-02-capstone-overview.pdf + - name: CSE 498 Collaborative Design + url: https://www.cse.msu.edu/Courses/cse498/ geo: lat: '42.735795' lng: '-84.486085' @@ -162,22 +202,22 @@ location: College Park, MD (US) courses: - name: 'CMSC 436: Programming Handheld Systems' - url: http://www.cs.umd.edu/class/fall2020/cmsc436/ + url: https://www.cs.umd.edu/class/fall2022/cmsc436/ geo: lat: '38.978174' lng: '-76.928451' - title: Dartmouth College location: Hanover, NH (US) courses: - - name: 'CS 65: Smartphone Programming, 2017' - url: https://www.cs.dartmouth.edu/~sergey/cs65/syllabus.pdf + - name: 'CS 65: Smartphone Programming' + url: https://www.cs.dartmouth.edu/~xingdong/Teaching/CS65/ geo: lat: '43.702198' lng: '-72.289686' - title: University of Sheffield location: Sheffield (UK) courses: - - name: COM4510 Software development for mobile devices + - name: COM6510 Software Development for Mobile Devices url: http://www.dcs.shef.ac.uk/intranet/teaching/public/modules/msc/com6510.html geo: lat: '53.385337' @@ -186,7 +226,7 @@ location: Oslo (Norway) courses: - name: IN2000 – Software Engineering - url: https://www.uio.no/studier/emner/matnat/ifi/IN2000/v21/videoer/kotlin/ + url: https://www.uio.no/studier/emner/matnat/ifi/IN2000/ geo: lat: '59.9399613' lng: '10.7195609' @@ -199,13 +239,13 @@ lat: '53.807488' lng: '-1.534502' - title: University of Notre Dame - location: Notre Dame, (France) + location: Notre Dame, IN, (US) courses: - name: CSE 40842 – Hackers in the Bazaar url: https://www3.nd.edu/~pbui/teaching/cse.40842.sp21/progress02.html geo: - lat: '35.9049122' - lng: '79.0491021' + lat: '41.70573177' + lng: '-86.23459851' - title: TU Dresden location: Dresden (Germany) courses: @@ -218,15 +258,15 @@ location: Bologna (Italy) courses: - name: 72940 - Computational Models And Languages M - url: https://www.unibo.it/en/teaching/course-unit-catalogue/course-unit/2019/385374 + url: https://www.unibo.it/en/teaching/course-unit-catalogue/course-unit/2022/468004 geo: lat: '44.504866' lng: '11.345111' - title: Rutgers, the State University of New Jersey location: New Brunswick, NJ (US) courses: - - name: ECE 453 mobile app engineering - url: https://www.coursehero.com/file/48846062/Fall2019-CLASS4-Kotlin-13September2019-publishedpdf/ + - name: 14:332:453 Mobile App Engineering and User Experience + url: https://www.ece.rutgers.edu/14332453-mobile-app-engineering-and-user-experience geo: lat: '40.489596' lng: '-74.413887' @@ -237,12 +277,12 @@ lng: '-96.3386659' courses: - name: 'ECEN 489: Mobile Applications with Android' - url: https://cesg.tamu.edu/courses/ecen-489-mob-apps-android/ + url: https://cesg.tamu.edu/people-2/faculty/srinivas-shakkottai/courses/ - title: Lomonosov Moscow State University location: Moscow (Russia) courses: - - name: 'JetBrains Kotlin: теория и практика программирования' - url: https://vk.com/@dc.csmsu-jetbrains + - name: 'Программирование на языке Котлин' + url: https://eclass.cmc.msu.ru/enrol/index.php?id=42 geo: lat: '55.7039379' lng: '37.5264809' @@ -254,22 +294,6 @@ geo: lat: '32.109584' lng: '34.805064' -- title: University of Barcelona - Escola de Noves Tecnologies Interactives (ENTI) - location: Barcelona (Spain) - geo: - lat: '41.3882176' - lng: '2.1607145' - courses: - - name: Disseny d'Interficies - url: https://enti.cat/new/wp-content/uploads/2019/01/CDI_1S_3r_Disseny_Interficies_vw.pdf -- title: University of Iowa - location: Iowa City, IA (US) - courses: - - name: CS:2820 Object-Oriented Software Development - url: https://weblog.cs.uiowa.edu/cs2820s18/Syllabus - geo: - lat: '41.639195' - lng: '-91.546385' - title: Moscow Institute of Physics and Technology location: Moscow (Russia) courses: @@ -281,12 +305,12 @@ - title: University of Utah location: Salt Lake City, UT (US) courses: - - name: 'CS4530-002 - Mobile Application Programming: Android' - url: https://student.apps.utah.edu/uofu/stu/classtools/syllabus/1178/14927/CS%204530-002%20Syllabus.pdf + - name: 'CS 6018 Application System Design' + url: https://www.cs.utah.edu/~shankar/teaching.html geo: - lat: '38.544192' - lng: '-109.76139' -- title: Higher School of Economics + lat: '40.76763758' + lng: '-111.8435805' +- title: HSE University location: Moscow (Russia) geo: lat: '55.7613485' @@ -305,8 +329,8 @@ - title: Simon Fraser University location: Burnaby (Canada) courses: - - name: 'CMPT 383: Comparative Programming Languages' - url: https://www2.cs.sfu.ca/~ggbaker/prog-langs/slide-content/lang-types.html#/coroutine-10 + - name: 'CMPT 415 Special Research Projects' + url: https://opencoursehub.cs.sfu.ca/bfraser/grav-cms/cmpt415/recruiting geo: lat: '49.253432' lng: '-122.918241' @@ -329,24 +353,24 @@ - title: Johannes Gutenberg University of Mainz location: Mainz (Germany) courses: - - name: Mobile Computing und Web Entwicklung - url: https://www.cs.uni-mainz.de/files/2019/02/Lehrangebot-SS2019-red-.pdf + - name: 08.079.10070 Mobile Computing und Web Entwicklung + url: https://jogustine.uni-mainz.de/scripts/mgrqispi.dll?APPNAME=CampusNet&PRGNAME=COURSEDETAILS&ARGUMENTS=-N000000000000001,-N000959,-N0,-N359003291860504,-N359003291831505,-N0,-N0,-N0 geo: lat: '49.908747' - lng: '7.916053' + lng: '8.241823418' - title: University of Tartu location: Tartu (Estonia) courses: - - name: Mobile Computing & Internet of Things LTAT.06.009 - url: https://courses.cs.ut.ee/2020/MCIoT/fall/Main/Lectures + - name: Mobile Application Development + url: https://courses.cs.ut.ee/2022/MAD/fall/Main/Lectures geo: lat: '58.370076' lng: '26.728509' - title: Clark University location: Worcester, MA (US) courses: - - name: CSCI 201 - Proseminar In Computer Science - url: http://catalog.clarku.edu/preview_course_nopop.php?catoid=25&coid=81349 + - name: CSCI 245 - Mobile Software Development + url: https://catalog.clarku.edu/preview_course_nopop.php?catoid=29&coid=99977 geo: lat: '42.2518712' lng: '-71.8259936' @@ -362,7 +386,7 @@ location: Ames, IA (US) courses: - name: 'COM S 430: CONCURRENT PROGRAMMING IN PRACTICE' - url: http://web.cs.iastate.edu/~smkautz/cs430s19/examples/kotlin/kotlin.pdf + url: https://www.cs.iastate.edu/courses/com-s-430 geo: lat: '42.025326' lng: '-93.633792' @@ -370,7 +394,7 @@ location: Perugia (Italy) courses: - name: GP004142 COMPUTER PROGRAMMING 3 / Informatics - url: https://www.unipg.it/en/ects/ects-course-catalogue-2020-21?idcorso=226&annoregolamento=2020&layout=insegnamento&idinsegnamento=133946 + url: https://www.unipg.it/en/ects/ects-course-catalogue-2021-22?annoregolamento=2021&layout=insegnamento&idcorso=226&idinsegnamento=173035 geo: lat: '43.104939' lng: '12.356605' @@ -378,7 +402,7 @@ location: Fisciano (Italy) courses: - name: (Android) Mobile Programming - url: http://www.di-srv.unisa.it/~robdep/MP/slides/slides2020.pdf + url: http://intranet.di.unisa.it/~robdep/MP/slides/slides2022.pdf geo: lat: '40.771806' lng: '14.7974' @@ -386,7 +410,7 @@ location: Aberystwyth (UK) courses: - name: CS31620 Mobile Development with Android - url: https://www.aber.ac.uk/en/modules/deptcurrent/CS31620/ + url: https://www.aber.ac.uk/en/modules/deptfuture/CS31620/ geo: lat: '52.410995' lng: '-4.075387' @@ -394,15 +418,15 @@ location: Houston, TX (US) courses: - name: DIGM 4381 Mobile Application Design - url: https://uh.edu/tech/digitalmedia/program/syllabi/4381.pdf + url: https://dot.egr.uh.edu/digitalmedia/program/degree-requirements geo: lat: '29.767392' lng: '-95.367289' - title: ITMO University location: Saint Petersburg (Russia) courses: - - name: Разработка Android-приложений на Kotlin - url: https://stepik.org/course/4792/syllabus + - name: Основы программирования на языке Kotlin + url: https://openedu.ru/course/ITMOUniversity/KOTLIN1/ geo: lat: '59.9574028' lng: '30.3061542' @@ -426,7 +450,7 @@ location: St. Louis, MO (US) courses: - name: 'CMP SCI 4020 Introduction to Android Apps: Android Fundamentals' - url: https://bulletin.umsl.edu/coursesofinstruction/cmpsci/ + url: https://github.com/zegster/android-fundamentals geo: lat: '38.6242' lng: '-90.20839' @@ -450,7 +474,7 @@ location: Stillwater, OK (US) courses: - name: 'CS4153: Mobile Applications Development' - url: https://computerscience.okstate.edu/images/courses/2020/CS4153_-_Mylavarapu.pdf + url: https://cas.okstate.edu/department_of_computer_science/students/undergraduate/course_syllabi/spring_2021/cs_4153_cs5153_combined-syllabus.pdf geo: lat: '36.115497' lng: '-97.058286' @@ -458,9 +482,9 @@ location: Istanbul (Turkey) courses: - name: IT 535 Wireless and Mobile Programming - url: https://www.sabanciuniv.edu/syllabus/?crn=21742&term=201902 + url: https://sucourse.sabanciuniv.edu/access/content/attachment/IT535-201702/Syllabus/94947bc0-3b22-4798-88c3-542a8c7fa0c6/it535_2018.pdf geo: - lat: '41.00704' + lat: '40.90095117' lng: '29.040422' - title: Technion Israel Institute of Technology location: Haifa (Israel) @@ -474,7 +498,7 @@ location: Guelph (Canada) courses: - name: CIS*4030 Mobile Computing - url: https://www.uoguelph.ca/sessional_ta/ta-posting/ta136981-winter-2020-cis4030-mobile-computing + url: https://www.uoguelph.ca/sessional_ta/ta-posting/ta202537-winter-2022-cis4030-mobile-computing geo: lat: '43.540798' lng: '-80.248885' @@ -482,7 +506,7 @@ location: Saint Petersburg (Russia) courses: - name: Введение в язык Котлин - url: https://www.coursera.org/learn/vvedenie-v-yazyk-kotlin + url: https://open.spbstu.ru/k-course/04kotlin/ geo: lat: '60.0076262' lng: '30.3710067' @@ -490,7 +514,7 @@ location: San Diego, CA (US) courses: - name: CS 635 Advanced Object-Oriented Design & Programming - url: http://www.eli.sdsu.edu/courses/fall20/cs635/Syllabus635Fall2020.pdf + url: http://www.eli.sdsu.edu/courses/fall22/cs635/Syllabus635Fall2022.pdf geo: lat: '32.715711' lng: '-117.154614' @@ -505,8 +529,8 @@ - title: Federal University of Minas Gerais location: Belo Horizonte (Brazil) courses: - - name: DCC024 - Linguagens de Programação - url: https://homepages.dcc.ufmg.br/~fernando/classes/dcc024/ + - name: PROGRAM ANALYSIS AND OPTIMIZATION – DCC888 + url: https://homepages.dcc.ufmg.br/~fernando/classes/dcc888/ementa/slides/Introduction.pdf geo: lat: '-19.914452' lng: '-43.940122' @@ -514,7 +538,7 @@ location: London (UK) courses: - name: COMP - 1815 - JVM Programming Languages - url: https://www.gre.ac.uk/undergraduate-courses/content/ajax/courses-ajax-call/?sq_content_src=%2BdXJsPWh0dHAlM0ElMkYlMkZuZWxzb24uZ3JlLmFjLnVrJTJGcGxzJTJGY3JzZSUyRnVvZ3dlYnNpdGUucF9jcnNlSW5mbyUzRnRlcm0lM0QyMDUwMDAlMjZzdWJqJTNEQ09NUCUyNmNyc2UlM0QxODE1JTI2Y29kZSUzRCZhbGw9MQ%3D%3D + url: https://www.gre.ac.uk/undergraduate-courses/content/ajax/courses-ajax-call?sq_content_src=%2BdXJsPWh0dHAlM0ElMkYlMkZuZWxzb24uZ3JlLmFjLnVrJTJGcGxzJTJGY3JzZSUyRnVvZ3dlYnNpdGUucF9jcnNlSW5mbyUzRnRlcm0lM0QyMDUwMDAlMjZzdWJqJTNEQ09NUCUyNmNyc2UlM0QxODE1JTI2Y29kZSUzRCZhbGw9MQ%3D%3D geo: lat: '51.480323' lng: '-0.007492' @@ -530,8 +554,8 @@ - title: Saint Petersburg State University location: Saint Petersburg (Russia) courses: - - name: Языки на базе Java VM 2MIT - url: https://bsse.compscicenter.ru/wiki/index.php?title=%D0%AF%D0%B7%D1%8B%D0%BA%D0%B8_%D0%BD%D0%B0_%D0%B1%D0%B0%D0%B7%D0%B5_Java_VM_2MIT_%D0%BE%D1%81%D0%B5%D0%BD%D1%8C_2019_-_%D0%B2%D0%B5%D1%81%D0%BD%D0%B0_2020 + - name: Основы технологий распределенных реестров + url: https://spbu.ru/postupayushchim/programms/dopolnitelnyeprogrammy/osnovy-tehnologiy-raspredelennyh-reestrov geo: lat: '59.9418967' lng: '30.2967312' @@ -539,7 +563,7 @@ location: Worcester, MA (US) courses: - name: 'CS 528: Ubiquitous and Mobile Computing' - url: https://web.cs.wpi.edu/~emmanuel/courses/cs528/F20/ + url: https://web.cs.wpi.edu/~emmanuel/courses/cs528/S23/ geo: lat: '42.2743054' lng: '-71.8103258' @@ -565,8 +589,8 @@ - name: ITEC399 – Mobile Application Development url: https://staff.emu.edu.tr/mobinabeheshti/Documents/courses/ITEC399/Kotlin%20structure.pdf geo: - lat: '25.38239' - lng: '51.493058' + lat: '35.1425986' + lng: '33.91210924' - title: Florida Institute of Technology location: Melbourne, FL (US) courses: @@ -575,15 +599,6 @@ geo: lat: '28.0646329' lng: '-80.625247' -- title: University of Maribor - location: Maribor (Slovenia) - courses: - - name: The Winter School “Development of Mobile Applications on the Android Platform - with the Kotlin Programming Language” - url: -https://2tm.si/the-winter-school-development-of-mobile-applications-on-the-android-platform-with-the-kotlin-programming-language-accepts-applications-for-participation/?lang=en - geo: - lat: '46.54215' - lng: '15.649092' - title: University of Texas at El Paso location: El Paso, TX (US) courses: @@ -595,7 +610,7 @@ - title: Budapest University of Technology and Economics location: Budapest (Hungary) courses: - - name: Kotlin-based Software Development + - name: Kotlin-Based Software Development url: https://portal.vik.bme.hu/kepzes/targyak/VIAUAV41/ geo: lat: '47.4813297' @@ -608,19 +623,11 @@ geo: lat: '48.144126' lng: '17.103851' -- title: Federal University of São Carlos - location: Sao Carlos (Brazil) - courses: - - name: Introdução à Kotlin - url: http://www.saci.ufscar.br/servico_release?id=113857&pro=3 - geo: - lat: '-22.016985' - lng: '-47.880582' - title: University of the Sinos Valley location: Sao Leopoldo (Brazil) courses: - name: Desenvolvimento de Aplicações para Plataformas Móveis - url: http://www.unisinos.br/noticias/minha-pos/especializacao-em-desenvolvimento-de-aplicacoes-para-dispositivos-moveis + url: https://www.unisinos.br/pos/especializacao/desenvolvimento-de-aplicacoes-para-dispositivos-moveis/ead geo: lat: '-29.769085' lng: '-51.141179' @@ -628,32 +635,24 @@ location: Saint Petersburg (Russia) courses: - name: Разработка Android-приложений на Kotlin - url: https://etu.ru/ru/on-line-obuchenie/novosti-i-obyavleniya/onlajn-kursy-leti-na-platformah-otkrytogo-obrazovaniya + url: https://stepik.org/course/4792/promo geo: lat: '59.9721944' lng: '30.3204669' -- title: University of West Bohemia - location: Pilsen (Czech Republic) - courses: - - name: KIV/UPS , Úvod do počítačových sítí - url: http://home.zcu.cz/~ublm/vyuka/ups/Pozadavky2019.pdf - geo: - lat: '49.7236474' - lng: '13.3493653' -- title: University of Ontario Institute of Technology +- title: Ontario Tech University location: Oshawa (Canada) courses: - - name: Programming Languages - url: http://db.science.uoit.ca/library/teaching/programming-languages + - name: CSCI 4020U Compilers + url: http://db.science.uoit.ca/teaching/csci4020u/0_introduction/compiler-1.1.pdf geo: lat: '43.901198' lng: '-78.852786' -- title: University of Auvergne +- title: University of Auvergne - Clermont location: Clermont-Ferrand (France) courses: - name: "Licence professionnelle Métiers de l'informatique : conception, développement\ \ et test de logiciels" - url: https://www.uca.fr/formation/nos-formations/catalogue-des-formations/lp-developpement-dapplications-pour-plateformes-mobiles + url: https://www.uca.fr/formation/devenir-des-etudiants/licence-professionnelle/licence-prof-metiers-de-linformatique-conception-developpement-et-test-de-logiciels geo: lat: '45.771132' lng: '3.088624' @@ -661,10 +660,10 @@ location: Greenville, NC (US) courses: - name: 'CSCI 6905: Topics in Computer Science. Topic: Mobile Development' - url: http://www.cs.ecu.edu/hillsma/syllabi/csci-6905-summer-2020.pdf + url: https://www.cs.ecu.edu/hillsma/syllabi/csci-6905-summer-2021.pdf geo: - lat: '36.037694' - lng: '-79.035584' + lat: '35.60702886' + lng: '-77.36650422' - title: University of Nevada - Reno location: Reno, NV (US) courses: @@ -677,15 +676,15 @@ location: Regensburg (Germany) courses: - name: Android Programming with Kotlin (KAPK) - url: https://www.oth-regensburg.de/fileadmin/media/fakultaeten/im/studiengaenge/programme_in_english/wise18_19/android-kotlin-course-descriptor.pdf + url: https://intra.fh-regensburg.de/fileadmin/media/fakultaeten/im/studiengaenge/programme_in_english/wise18_19/android-kotlin-course-descriptor.pdf geo: lat: '49.0028627' lng: '12.0937886' - title: University of Pannonia location: Veszprém (Hungary) courses: - - name: Kotlin programming (VEMISAB332K/2019/20/2) - url: https://oktatas.mik.uni-pannon.hu/enrol/index.php?id=3566 + - name: Kotlin programming (VEMISAB332K) + url: https://oktatas-regi.mik.uni-pannon.hu/enrol/index.php?id=4079 geo: lat: '47.0879094' lng: '17.9059747' @@ -701,7 +700,7 @@ location: Oslo (Norway) courses: - name: Enterpriseprogrammering 2 (PG6101) - url: https://www.kristiania.no/for-studenter/programbeskrivelser-emnebeskrivelser-og-pensum/bachelor/2018-2021/bachelor-i-informasjonsteknologi--programmering-wpg/enterpriseprogrammering-2-pg6101/ + url: https://www.kristiania.no/en/syllabus/school-of-economics-innovation-and-technology/first-cycle-degree/pg6101/enterprise-programming-2/ geo: lat: '59.9159993' lng: '10.7579211' @@ -717,7 +716,7 @@ location: Lisbon (Portugal) courses: - name: PROGRAMMING-LEIC - url: https://www.isel.pt/en/subjects/programming-leic + url: https://www.isel.pt/sites/default/files/FUC_LEIC/1sem/PG_LEIC.pdf geo: lat: '38.7561087' lng: '-9.1169233' @@ -725,7 +724,7 @@ location: Lisbon (Portugal) courses: - name: Computação Móvel - url: https://www.ulusofona.pt/licenciatura/engenharia-informatica/computacao-movel/ULHT260-16925 + url: https://www.ulusofona.pt/en/lisboa/undergraduate/computing-engineering/ULHT260-16925 geo: lat: '38.7580285' lng: '-9.1553047' @@ -757,18 +756,10 @@ location: Saint Peter, MN (US) courses: - name: 'MCS 178: Introduction to Computer Science II' - url: http://homepages.gac.edu/~sskulrat/Courses/2019F-178/syllabus.html + url: https://homepages.gac.edu/~sskulrat/Courses/2020S-178/lectures/intro.html geo: lat: '44.3221657' lng: '-93.9709658' -- title: Loyola University Chicago - location: Chicago, IL (US) - courses: - - name: 'COMP 313/413: Intermediate Object-Oriented Development' - url: http://laufer.cs.luc.edu/teaching/313/fall-2019-comp-313-001-413-001 - geo: - lat: '41.883795' - lng: '-87.64051' - title: University of Wyoming location: Laramie, WY (US) courses: @@ -780,7 +771,7 @@ - title: Utah State University location: Logan, UT (US) courses: - - name: CS 4700 - Programming Languages + - name: CS 1440 - Methods in Computer Science url: https://gitlab.cs.usu.edu/erik.falor/sp21-cs1440-lecturenotes/-/blob/2ee9ed0b75db6c3ad10ced887e99dbad688450d1/Module3/Lec22-Mon_Mar_15/README.md geo: lat: '41.735124' @@ -792,31 +783,7 @@ url: https://www.lakeheadu.ca/users/M/mohammed/my-recent-courses-flyers geo: lat: '46.4186908' - lng: '-88.8472074' -- title: Canakkale Onsekiz Mart University - location: Canakkale (Turkey) - courses: - - name: BLM-3026 Mobile Programming - url: https://ubys.comu.edu.tr/AIS/OutcomeBasedLearning/Home/CourseDetail?&isElectiveCourse=true&isIntegratedCourse=false&courseId=97032&curriculumId=7132&apid=6232&eqd=10602&progName=Faculty%20of%20Eng%C4%B1neer%C4%B1ng%20-%20Computer%20Engineering%20/%20%20DEPARTMENT%20OF%20COMPUTER%20ENGINEERING - geo: - lat: '40.1118946' - lng: '26.4138072' -- title: University of Michigan-Ann Arbor - location: Ann Arbor, MI (US) - courses: - - name: EECS 441 Mobile App Development for Entrepreneurs - url: https://eecs441.eecs.umich.edu/ - geo: - lat: '42.2780436' - lng: '-83.7382241' -- title: Carnegie Mellon University - location: Pittsburgh, PA (US) - courses: - - name: 15-295 Competition Programming and Problem Solving - url: https://csd.cmu.edu/course-profiles/15-295-Competition-Programming-and-Problem-Solving - geo: - lat: '40.4432027' - lng: '-79.9428499' + lng: '-89.21675395' - title: University of California, San Diego location: San Diego, CA (US) courses: @@ -845,7 +812,7 @@ location: Montreal (Canada) courses: - name: IFT 1155 - Programmation mobile à plateforme libre - url: http://www.iro.umontreal.ca/~dift1155/cours/ift1155/communs/Cours/2P/C01_RetourEnArriere_2P.pdf + url: https://admission.umontreal.ca/cours-et-horaires/cours/ift-1155/ geo: lat: '45.5056156' lng: '-73.61375919999999' @@ -866,10 +833,10 @@ lat: '22.3366793' lng: '114.1724234' - title: University of Southampton - location: Southhampton (UK) + location: Southampton (UK) courses: - name: COMP6239 Mobile Applications Development - url: https://www.uio.no/studier/emner/matnat/ifi/IN2000/v21/videoer/kotlin/ + url: https://www.southampton.ac.uk/courses/modules/comp6239#learning geo: lat: '50.9351092' lng: '-1.3957594' @@ -885,7 +852,7 @@ location: Edmonton (Canada) courses: - name: EXSM 3956 - Android Development Fundamentals - url: https://www.ualberta.ca/governance/media-library/documents/member-zone/gfc-standing-committees/pc-meeting-materials/2021-03-18-pc-meeting-materials.pdf + url: https://apps.ualberta.ca/catalogue/course/exsm/3956 geo: lat: '53.5232189' lng: '-113.5263186' @@ -893,7 +860,7 @@ location: Gainesville, FL (US) courses: - name: DIG4634 Wearable and Mobile App Development - url: https://arts.ufl.edu/site/assets/files/187303/dig4634_fall2020_wma_syllabusv1_0_ab.pdf + url: https://arts.ufl.edu/site/assets/files/213257/dig4634_wearables_online.pdf geo: lat: '29.6436325' lng: '-82.3549302' @@ -905,26 +872,18 @@ geo: lat: '33.4242399' lng: '-111.9280527' -- title: University of Barcelona (ENTI) - location: Barcelona (Spain) - courses: - - name: Disseny d'Interficies - url: https://enti.cat/new/wp-content/uploads/2019/01/CDI_1S_3r_Disseny_Interficies_vw.pdf - geo: - lat: '41.3867751' - lng: '2.1637278' - title: University of California, Santa Cruz location: Santa Cruz, CA (US) courses: - - name: CMPS 121 - Mobile Applications - url: https://cmps121-spring18-01.courses.soe.ucsc.edu/home.html + - name: Mobile Application Development - Android and iOS, Introduction | CMPR.X421 + url: https://www.ucsc-extension.edu/courses/mobile-application-development-android-and-ios-introduction/ geo: lat: '36.9880503' lng: '-122.0582093' - title: University of Twente location: Enschede (Netherlands) courses: - - name: M-CS-201600051-1B M-CS Software Security 201600051s + - name: Software Security 201600051 url: https://samenvattingen.inter-actief.utwente.nl/images/d/db/20210120_Software_Security.pdf geo: lat: '52.2396538' @@ -932,7 +891,7 @@ - title: Virginia Polytechnic Institute and State University - Virginia Tech location: Blacksburg, VA (US) courses: - - name: CS3304 Comparative Languages Schedule + - name: CS3304 Comparative Languages url: https://courses.cs.vt.edu/cs3304/fall20meng/schedule.html geo: lat: '37.22838429999999' @@ -940,8 +899,8 @@ - title: University of Waterloo location: Waterloo (Canada) courses: - - name: CS 349 User Interfaces - url: https://student.cs.uwaterloo.ca/~cs349/s21/ + - name: CS349 User Interfaces + url: https://student.cs.uwaterloo.ca/~cs349/1231/ geo: lat: '43.4722854' lng: '-80.5448576' @@ -957,15 +916,15 @@ location: Lugano (Switzerland) courses: - name: Engineering of Domain Specific Languages - url: https://search.usi.ch/it/corsi/35262207/engineering-of-domain-specific-languages + url: https://search.usi.ch/en/courses/35265665/engineering-of-domain-specific-languages geo: lat: '46.0107081' lng: '8.9581559' - title: Temple University location: Philadelphia, PA (US) courses: - - name: CIS 3515 Mobile Application Development - url: https://cis.temple.edu/~tuf80213/courses/temple/cis3515/slides/Presentation_Intro_What_is_Android.pdf + - name: CIS 3296 Software Design + url: https://github.com/cis3296s22 geo: lat: '39.9805942' lng: '-75.1557376' @@ -973,7 +932,7 @@ location: London (UK) courses: - name: Software Design and Programming - url: https://www.dcs.bbk.ac.uk/study/modules/software-design-and-programming/ + url: https://www.bbk.ac.uk/courses/modules/coiy/COIY062H7 geo: lat: '51.5218563' lng: '-0.1303146' @@ -989,7 +948,7 @@ location: Athens, GA (US) courses: - name: CSCI 4060/6060 Mobile Software Development - url: https://sdcse.engr.uconn.edu/Cse4102/cse4102.html + url: http://cobweb.cs.uga.edu/~kochut/teaching/x060/AddBooks.html geo: lat: '33.9480053' lng: '-83.3773221' @@ -997,7 +956,7 @@ location: Irbid (Jordan) courses: - name: Mobile Phones Apps Development Using Android-Kotlin Language - url: https://www.just.edu.jo/Centers/ConsultativeCenter/Lists/News/DispForm.aspx?ID=30 + url: https://www.just.edu.jo/Centers/ConsultativeCenter/CatalloagueCourse/CatalogueCourses2020.pdf#search=kotlin geo: lat: '32.4950392' lng: '35.9912257' @@ -1005,7 +964,7 @@ location: Columbia, MO (US) courses: - name: INFOTC 4410 - Android App Development I - url: http://catalog.missouri.edu/courseofferings/infotc/infotc.pdf + url: http://catalog.missouri.edu/courseofferings/infotc/ geo: lat: '38.9403808' lng: '-92.32773750000001' @@ -1021,14 +980,14 @@ location: Ottawa (Canada) courses: - name: Mobile App Development - url: https://homeostasis.scs.carleton.ca/wiki/index.php/Mobile_App_Development_2021W_Lecture_1 + url: https://web.uettaxila.edu.pk/cped/CourseDetails-FallLatest.asp?Id=CP-405 geo: lat: '45.3875812' lng: '-75.69602019999999' - title: University of Insubria location: Varese (Italy) courses: - - name: PROGRAMMING MOBILE DEVICES + - name: Programming mobile devices url: https://www.uninsubria.eu/ugov/degreecourse/131820#3 geo: lat: '45.8142904' @@ -1049,14 +1008,6 @@ geo: lat: '24.7868862' lng: '120.9974969' -- title: New Jersey Institute of Technology - location: Newark, NJ (US) - courses: - - name: 'CS 388-002: Android Application Development' - url: https://digitalcommons.njit.edu/cgi/viewcontent.cgi?article=1066&context=cs-syllabi - geo: - lat: '40.7427996' - lng: '-74.1770884' - title: Marche Polytechnic University location: Ancona (Italy) courses: @@ -1065,35 +1016,19 @@ geo: lat: '43.6173812' lng: '13.5139647' -- title: Montana State University - location: Bozeman, MT (US) - courses: - - name: 'CSCI: 494-002 - Industry Methods' - url: https://compscicenter.ru/courses/kotlinprogramming/nsk/2018-spring/classes/ - geo: - lat: '45.6673524' - lng: '-111.0546211' - title: Novosibirsk State University location: Novosibirsk (Russia) courses: - name: 'Computer Science Center: Программирование на Kotlin' - url: https://en.uniparthenope.it/ugov/degreecourse/36834 + url: https://compscicenter.ru/courses/kotlinprogramming/nsk/2018-spring/classes/ geo: lat: '54.8477462' lng: '83.0943884' -- title: Parthenope University of Naples - location: Naples (Italy) - courses: - - name: MOBILE COMPUTING - url: https://en.uniparthenope.it/ugov/degreecourse/36834 - geo: - lat: '40.8375178' - lng: '14.2531103' - title: TU Braunschweig location: Braunschweig (Germany) courses: - name: Programming Languages - Concepts and Applications - url: http://www.eli.sdsu.edu/courses/fall20/cs635/Syllabus635Fall2020.pdf + url: https://www.tu-braunschweig.de/en/isf/teaching/2020s/seminar geo: lat: '52.2740421' lng: '10.5292639' @@ -1101,15 +1036,15 @@ location: Bogota (Colombia) courses: - name: ISIS3510 | Construcción de Aplicaciones Móviles - url: https://baylor.kattis.com/sessions/jaa7qk/help/kotlin + url: https://cursos.virtual.uniandes.edu.co/isis3510/ geo: lat: '4.601458099999999' lng: '-74.0661334' - title: National Autonomous University of Mexico location: Mexico City (Mexico) courses: - - name: Diseño y desarrollo de aplicaciones Android - url: https://cs.fit.edu/~ryan/cse4250/ + - name: Introducción a la programación con Kotlin + url: https://docencia.tic.unam.mx/presenciales/Introduccion-a-la-programacion-con-kotlin.html geo: lat: '19.3228313' lng: '-99.18657739999999' @@ -1156,16 +1091,16 @@ - title: Government College University Lahore location: Lahore (Pakistan) courses: - - name: COMPUTER S 315 Mobile application development - url: https://www.coursehero.com/sitemap/schools/4088-GC-University-Lahore/courses/15471228-COMPUTER-S315/ + - name: Mobile Application Development + url: https://faculty.uol.edu.pk/Faculty/11077/Husnain%20Iqbal geo: lat: '31.573152' lng: '74.3078585' - title: University of Guadalajara location: Guadalajara (Mexico) courses: - - name: Desarrollo de Aplicaciones para Ambientes Moviles - url: http://mti.cucea.udg.mx/sites/default/files/adjuntos/desarrollo_de_aplicaciones_para_ambientes_moviles_2019.pdf + - name: Programación de Dispositivos Móviles + url: http://www.web.valles.udg.mx/sites/default/files/coordinaciones/coordinaciontecnologias54/prog2021_topicos_selectos_de_ti_i.pdf geo: lat: '20.6754309' lng: '-103.3589544' @@ -1180,8 +1115,8 @@ - title: Jawaharlal Nehru Technological University Anantapur (JNTUA) location: Anantapur (India) courses: - - name: Android Development with Kotlin ‘Train-The-Trainer session - url: https://fd.jntua.ac.in/fd-programmes/ + - name: (20A35601P) MOBILE APPLICATION DEVELOPMENT FOR IOT + url: https://dap.jntua.ac.in/wp-content/uploads/2022/07/JNTUA-R20-CSE-IOT-III-IV-Year-Course-structure-Syllabus.pdf geo: lat: '14.6513038' lng: '77.60633709999999' @@ -1197,14 +1132,14 @@ location: Moscow (Russia) courses: - name: Мобильная разработка - url: https://www.mirea.ru/education/the-institutes-and-faculties/institute-for-integrated-security-and-special-instrumentation/training-programs/bakalavriat/09-03-02-information-systems-and-technologies/ + url: https://www.mirea.ru/eventspage/it-akademiya-samsung-provedyet-kurs-po-razrabotke-android-prilozheniy-na-yazyke-kotlin-2/ geo: lat: '55.6699354' lng: '37.4802999' - title: National Technical University Kharkiv Polytechnic Institute location: Kharkiv (Ukraine) courses: - - name: ВБ 4.1 Java та Kotlin для мобільної розробки + - name: Розробка мобільних додатків url: http://blogs.kpi.kharkov.ua/v2/quality/wp-content/uploads/sites/25/2019/05/OPP_121_bakalavr_Ukr-Godlevskyj-.pdf geo: lat: '49.999029' @@ -1213,7 +1148,7 @@ location: Yakutsk (Russia) courses: - name: Б1.В.ДВ.05.02 Разработка мобильных приложений - url: https://www.s-vfu.ru/gos_fgos/d.php?id=5394&192799506 + url: https://yagu.s-vfu.ru/course/info.php?id=24474 geo: lat: '62.0199491' lng: '129.7094689' @@ -1230,15 +1165,15 @@ courses: - name: Технологии и инструментальные средства разработки программного обеспечения для мобильных устройств - url: https://ssau.ru/docs/sveden/education/Annot_Disc_INFORMATIVYCHISLITTEKHNIK-ASOIIU-M-O-PP_2019.pdf + url: https://ssau.ru/docs/sveden/education/Annot_Disc_INFORMATIVYCHISLITTEKHNIK-ASOIIU-M-Z-PP_2020.pdf geo: lat: '53.2120034' lng: '50.1774101' - title: University of Sargodha location: Sargodha (Pakistan) courses: - - name: IT 4548 Android Development - url: https://www.coursehero.com/sitemap/schools/125663-University-of-Sargodha-Sargodha/courses/7579841-IT4548/ + - name: CS-4548 Mobile Application Development + url: https://lms.su.edu.pk/course/3159# geo: lat: '32.0736519' lng: '72.68033919999999' @@ -1301,8 +1236,8 @@ - title: I. K. Gujral Punjab Technical University location: Kapurthala (India) courses: - - name: IKG PTU Faculty TTT Online Workshop on Kotlin in collaboration with Google - url: https://pitk.ptu.ac.in/Placements.aspx + - name: Android Development with Kotlin + url: https://drive.google.com/file/d/10FLy81TnTxTAkvYz4KVRoCv4IfpdLJ_F/view?usp=sharing geo: lat: '31.3534007' lng: '75.4586767' @@ -1326,7 +1261,7 @@ location: Timișoara (Romania) courses: - name: Mobile Systems and Applications - url: https://sites.google.com/site/claudiudgroza/sma + url: http://staff.cs.upt.ro/~mmarcu/teaching.html geo: lat: '45.7536393' lng: '21.2251615' @@ -1349,8 +1284,8 @@ - title: Ammersee-Gymnasium location: Munich (Germany) courses: - - name: Object-oriented programing - url: https://amseegym.de/fachschaften/informatik/ + - name: Informatik mit Kotlin + url: https://emig.me/ geo: lat: '47.9633321' lng: '11.1032012' @@ -1384,22 +1319,22 @@ - name: Tecnicatura en Desarrollo de Aplicaciones Móviles url: https://ingenieria.unlam.edu.ar/index.php?seccion=3&idArticulo=368 geo: - lat: '-34.6689958' - lng: '-58.566365' + lat: '-31.57998468' + lng: '-58.91436657' - title: The University of the Antilles - Université des Antilles location: Schoelcher (Martinique) courses: - name: Licence Professionnelle Métiers de l'informatique - Informatique Embarquée et Mobile - url: http://formations.univ-antilles.fr/#/formation/153 + url: https://www.lpiem.fr/presentation geo: lat: '14.6197775' lng: '-61.093989' - title: University of Fortaleza location: Fortaleza (Brazil) courses: - - name: Computer Science - url: https://www.unifor.br/web/graduacao/ciencia-da-computacao + - name: Desenvolvimento para plataformas móveis + url: https://unifor.br/web/graduacao/-/curso-de-analise-e-desenvolvimento-de-sistemas-explora-diversas-areas-do-mercado?p_l_back_url=https%3A%2F%2Fwww.unifor.br%2Fhome%3Fp_p_id%3Dcom_liferay_portal_search_web_portlet_SearchPortlet%26p_p_lifecycle%3D0%26p_p_state%3Dmaximized%26p_p_mode%3Dview%26_com_liferay_portal_search_web_portlet_SearchPortlet_redirect%3Dhttps%253A%252F%252Fwww.unifor.br%252Fhome%253Fp_p_id%253Dcom_liferay_portal_search_web_portlet_SearchPortlet%2526p_p_lifecycle%253D0%2526p_p_state%253Dnormal%2526p_p_mode%253Dview%26_com_liferay_portal_search_web_portlet_SearchPortlet_redirect%3Dhttps%253A%252F%252Fwww.unifor.br%252Fhome%253Fp_p_id%253Dcom_liferay_portal_search_web_portlet_SearchPortlet%2526p_p_lifecycle%253D0%2526p_p_state%253Dnormal%2526p_p_mode%253Dview%26_com_liferay_portal_search_web_portlet_SearchPortlet_mvcPath%3D%252Fsearch.jsp%26_com_liferay_portal_search_web_portlet_SearchPortlet_mvcPath%3D%252Fsearch.jsp%26_com_liferay_portal_search_web_portlet_SearchPortlet_keywords%3Dkotlin%26_com_liferay_portal_search_web_portlet_SearchPortlet_keywords%3Dkotlin%26_com_liferay_portal_search_web_portlet_SearchPortlet_formDate%3D1678383831408%26_com_liferay_portal_search_web_portlet_SearchPortlet_formDate%3D1678383831408%26_com_liferay_portal_search_web_portlet_SearchPortlet_scope%3Deverything%26_com_liferay_portal_search_web_portlet_SearchPortlet_scope%3Deverything geo: lat: '-3.7687753' lng: '-38.478061' @@ -1407,18 +1342,10 @@ location: Brugg (Switzerland) courses: - name: Entwicklung mobiler Applikationen - url: https://www.unifor.br/web/graduacao/ciencia-da-computacao + url: https://www.fhnw.ch/de/studium/technik/icompetence/media/studieninhalte-bachelor-informatik-icompetence-ht-fhnw.pdf geo: lat: '47.48188640000001' lng: '8.211477799999999' -- title: National Yang Ming Chiao Tung University - location: Taipei City (Taiwan) - courses: - - name: Android Programming - url: https://hscc.cs.nctu.edu.tw/~lincyu/ - geo: - lat: '25.123002' - lng: '121.513702' - title: ATMIYA University location: Rajkot (India) courses: @@ -1432,17 +1359,9 @@ courses: - name: 'PCCCS-706A: Mobile Computing' url: https://drive.google.com/file/d/13kOP72x8woD_lJHmRHcMgkUkonHWDN55/view?usp=sharing - geo: lat: '26.9124336' lng: '75.7872709' -- title: Gdansk University of Technology - location: Gdansk (Poland) - courses: - - name: Object-oriented programming, PG_00054485 - geo: - lat: '54.371070' - lng: '18.613456' - title: National Research Nuclear University MEPhI location: Moscow (Russia) courses: @@ -1471,7 +1390,7 @@ location: Malmo (Sweden) courses: - name: PROGRAMMERARE IPHONE OCH ANDROID - url: https://my.se/nyheter/nyhetsarkiv/ny-utbildning-affarsdriven-android-utvecklare-host-2020/ + url: https://my.se/sok-nu/programmerare-iphone-och-android/ geo: lat: '55.6112395' lng: '12.99441' @@ -1491,3 +1410,1131 @@ geo: lat: '44.9728923' lng: '-93.28327139999999' +- title: King’s College London + location: London (UK) + courses: + - name: 6CCS3CFL Compilers And Formal Languages + url: https://www.kcl.ac.uk/abroad/module-options/compiler-and-formal-languages-1 + geo: + lat: '53.15052782' + lng: '0.1692982392' +- title: École Polytechnique Fédérale de Lausanne (EPFL) + location: Lausanne (Switzerland) + courses: + - name: Lab on app development for tablets and smartphones + url: https://edu.epfl.ch/coursebook/en/lab-on-app-development-for-tablets-and-smartphones-EE-490-G + geo: + lat: '46.51922547' + lng: '6.566768326' +- title: KU Leuven + location: Leuven (Belgium) + courses: + - name: App Development + url: https://kuleuven-diepenbeek.github.io/appdev-course/ + geo: + lat: '50.87825954' + lng: '4.699737484' +- title: The Hong Kong University of Science and Technology + location: Hong Kong (China) + courses: + - name: ISOM3000G Mobile Applications Development for Business + url: https://isom.hkust.edu.hk/sites/isom/files/course-attachments/ISOM3000G%2520Syalbus%25202021Fall-updated%5B1%5D.pdf + geo: + lat: '22.33833454' + lng: '114.2677553' +- title: McMaster University + location: Hamilton (Canada) + courses: + - name: Computer Science 3MI3 - Principles of Programming Languages + url: http://www.cas.mcmaster.ca/~armstmp/3mi3-2019/homepage.html + geo: + lat: '43.27883474' + lng: '-79.91604115' +- title: Rice University + location: Houston, TX (US) + courses: + - name: "COMP 322: Fundamentals of Parallel Programming" + url: https://wiki.rice.edu/confluence/display/PARPROG/COMP322 + geo: + lat: '29.71757111' + lng: '-95.401681' +- title: University of Colorado Boulder + location: Boulder, CO (US) + courses: + - name: ATLS 4120/5120 Mobile Application Development + url: https://github.com/aileenjp/Fall22_AndroidMobileAppDev + geo: + lat: '40.00810694' + lng: '-105.2645255' +- title: Ulm University + location: Ulm (Germany) + courses: + - name: Parallele Programmierung + url: https://www.uni-ulm.de/en/in/sp/teaching/ss2018/parallele-programmierung/ + geo: + lat: '48.4633568' + lng: '9.941576281' +- title: Uppsala University + location: Uppsala (Sweden) + courses: + - name: Game Design + url: https://www.katalog.uu.se/profile/?id=N12-2450 + geo: + lat: '59.85101363' + lng: '17.63025606' +- title: University of Virginia + location: Charlottesville, VA (US) + courses: + - name: CS 4720 Mobile Application Development + url: https://f22.cs4720.org/syllabus.html + geo: + lat: '38.03371343' + lng: '-78.50798793' +- title: Aalto University + location: Espoo (Finland) + courses: + - name: CS-EJ4102 - Mobile Application Development with Android + url: https://mycourses.aalto.fi/mod/page/view.php?id=611801 + geo: + lat: '60.18678676' + lng: '24.82771419' +- title: George Washington University + location: Washington, D.C. (US) + courses: + - name: CSCI 6116. Advanced Application Development + url: http://bulletin.gwu.edu/courses/csci/ + geo: + lat: '38.89989816' + lng: '-77.04854556' +- title: Université Libre de Bruxelles + location: Brussels (Belgium) + courses: + - name: INFO-H2001 Programmation orientée objet + url: https://www.ulb.be/fr/programme/info-h2001-1 + geo: + lat: '50.81335591' + lng: '4.382458231' +- title: University of Luxembourg + location: Luxembourg (Luxembourg) + courses: + - name: Mobile Application Development + url: https://research.botev.net/teaching.html + geo: + lat: '49.50471322' + lng: '5.948707947' +- title: King Saud University + location: Riyadh (Saudi Arabia) + courses: + - name: "IS324: Modern Application Development" + url: https://sciences.ksu.edu.sa/sites/sciences.ksu.edu.sa/files/imce_images/ksubulletin_undergraduate.pdf + geo: + lat: '24.63752209' + lng: '46.66519814' +- title: Laval University + location: Quebec (Canada) + courses: + - name: GIF-3101 Informatique mobile et applications + url: https://www.ulaval.ca/etudes/cours/gif-3101-informatique-mobile-et-applications + geo: + lat: '46.78456791' + lng: '-71.27456546' +- title: Stellenbosch University + location: Stellenbosch (South Africa) + courses: + - name: "Computer Science 771: Honors Project" + url: http://www.cs.sun.ac.za/courses/cs771/ + geo: + lat: '-33.93260304' + lng: '18.86477959' +- title: Swansea University + location: Swansea (UK) + courses: + - name: CSC306 - Writing Mobile Apps + url: https://intranet.swan.ac.uk/catalogue/default.asp?type=moddetail&dept=any&mod=CSC306&ayr=23%2F24&psl=TB1&detailOnly=false + geo: + lat: '51.61124386' + lng: '-3.979609076' +- title: Autonomous University of Madrid + location: Madrid (Spain) + courses: + - name: 18771 - DESARROLLO DE APLICACIONES PARA DISPOSITIVOS MÓVILES + url: https://secretaria-virtual.uam.es/doa/consultaPublica/look%5Bconpub%5DMostrarPubGuiaDocAs?entradaPublica=true&idiomaPais=es.ES&_anoAcademico=2020&_codAsignatura=18771 + geo: + lat: '40.54686132' + lng: '-3.694941261' +- title: Dalhousie University + location: Halifax (Canada) + courses: + - name: "CSCI 5708: Mobile Computing" + url: https://www.dal.ca/academics/programs/graduate/applied-computer-science/program-overview/program-outline/web-mobile-computing.html + geo: + lat: '44.63577633' + lng: '-63.59465872' +- title: George Mason University + location: Fairfax, VA (US) + courses: + - name: SWE 642 Software Engineering for the World Wide Web + url: https://cs.gmu.edu/media/syllabi/Spring2022/SWE_642DubeyVDL1.pdf + geo: + lat: '38.83184337' + lng: '-77.3117941' +- title: Hasselt University + location: Hasselt (Belgium) + courses: + - name: App Development + url: https://kuleuven-diepenbeek.github.io/appdev-course/ + geo: + lat: '50.93357562' + lng: '5.342591598' +- title: Montpellier University + location: Montpellier (France) + courses: + - name: Développement mobile + url: https://www.polytech.umontpellier.fr/formation/cycle-ingenieur/devops/en-details-do + geo: + lat: '43.6165335' + lng: '3.872023118' +- title: University of Oulu + location: Oulu (Finland) + courses: + - name: 521046A Mobile Computing + url: https://opas.peppi.oulu.fi/en/course/521046A/11527 + geo: + lat: '65.05939006' + lng: '25.46665828' +- title: Politecnico di Milano + location: Milan (Italy) + courses: + - name: KOTLIN AND JETPACK FOR MODERN AND EFFICIENT ANDROID APPS - ED.1 + url: https://www.polimi.it/corsi/master-universitari-e-corsi-post-laurea/331 + geo: + lat: '45.61658854' + lng: '9.172324841' +- title: Swinburne University of Technology + location: Melbourne (Australia) + courses: + - name: Software Development for Mobile Devices + url: https://www.swinburne.edu.au/study/courses/units/Software-Development-for-Mobile-Devices-COS30017/local + geo: + lat: '-37.81509892' + lng: '145.0396412' +- title: University of Tasmania + location: Hobart (Australia) + courses: + - name: Mobile Application Development KIT305 + url: https://www.utas.edu.au/courses/cse/units/kit305-mobile-application-development + geo: + lat: '-42.81136204' + lng: '147.3036807' +- title: Technical University of Darmstadt + location: Darmstadt (Germany) + courses: + - name: Projektseminar Softwaresysteme + url: https://www.es.tu-darmstadt.de/lehre/aktuelle-veranstaltungen/ps-softwaresysteme + geo: + lat: '49.87538357' + lng: '8.656359572' +- title: University College Cork + location: Cork (Ireland) + courses: + - name: CS4092 Special Topics in Computing + url: https://ucc-ie-public.courseleaf.com/modules/?details&code=CS4092 + geo: + lat: '51.89361839' + lng: '-8.49144823' +- title: University of Rome II – Tor Vergata + location: Rome (Italy) + courses: + - name: Mobile programming + url: https://didatticaweb.uniroma2.it/informazioni/index/insegnamento/203554-Mobile-Programming/0 + geo: + lat: '41.85380789' + lng: '12.62772133' +- title: University of Turku + location: Turku (Finland) + courses: + - name: Käyttöliittymät + url: https://tech.utugit.fi/soft/tools/lectures/dtek0097/2022-fi/frameworks/index.html + geo: + lat: '60.45433249' + lng: '22.28502103' +- title: University of Alaska Fairbanks + location: Fairbanks, AK (US) + courses: + - name: CS331 Programming Languages + url: https://www.cs.uaf.edu/users/chappell/public_html/class/2020_spr/cs331/docs/p-proj01d.html + geo: + lat: '64.85820048' + lng: '-147.8333731' +- title: University of Pisa + location: Pisa (Italy) + courses: + - name: MOBILE AND SOCIAL SENSING SYSTEMS + url: https://esami.unipi.it/programma.php?c=56942&aa=2022 + geo: + lat: '43.71683203' + lng: '10.39967469' +- title: Pontifical Catholic University of Chile + location: Santiago (Chile) + courses: + - name: Desarrollo de aplicaciones móviles + url: https://educacionprofesional.ing.uc.cl/?diplomado=diplomado-en-desarrollo-de-aplicaciones-moviles + geo: + lat: '-33.44163505' + lng: '-70.63924395' +- title: Umeå University + location: Umea (Sweden) + courses: + - name: Utveckling av mobila applikationer + url: https://www.umu.se/utbildning/kursplan/5dv209/ + geo: + lat: '63.82032178' + lng: '20.30582161' +- title: Bauman Moscow State Technical University + location: Moscow (Russia) + courses: + - name: Разработка Android приложений на Kotlin + url: https://bmstu.ru/chair/teoreticeskaa-informatika-i-komputernye-tehnologii + geo: + lat: '55.76610759' + lng: '37.68569704' +- title: Beijing Institute of Technology + location: Beijing (China) + courses: + - name: Android programming + url: https://github.com/topics/beijing-institute-of-technology + geo: + lat: '39.96571167' + lng: '116.3118409' +- title: Bucharest University of Economic Studies + location: Bucharest (Romania) + courses: + - name: Multi-paradigm programming in Kotlin + url: https://www.acs.ase.ro/ + geo: + lat: '44.44762881' + lng: '26.09785714' +- title: Charles University in Prague + location: Prague (Czech Republic) + courses: + - name: Developing Applications for Mobile Devices + url: https://d3s.mff.cuni.cz/teaching/nprg056/ + geo: + lat: '50.0872276' + lng: '14.4234889' +- title: Durban University of Technology + location: Durban (South Africa) + courses: + - name: Mobile Computing IIA + url: https://www.dut.ac.za/wp-content/uploads/handbooks/ACCINFO%20IT.pdf + geo: + lat: '-29.83071128' + lng: '31.00394108' +- title: Iran University of Science and Technology + location: Tehran (Iran) + courses: + - name: Fundamentals of Computer Programming + url: http://www.sauleh.ir/fc98/lectures/ + geo: + lat: '35.79572344' + lng: '51.50211724' +- title: Constructor University - Jacobs University + location: Bremen (Germany) + courses: + - name: Kotlin and Kotlin Ecosystem + url: https://www.jacobs-university.de/news/constructor-university-lands-new-partnership-cutting-edge-software-engineering-vendor + geo: + lat: '53.16705078' + lng: '8.651976034' +- title: Johannes Kepler University of Linz + location: Linz (Austria) + courses: + - name: Programming in Kotlin + url: https://ssw.jku.at/Teaching/Lectures/SpezialLVA/Kotlin/ + geo: + lat: '48.33741505' + lng: '14.3164432' +- title: Open University of Catalonia + location: Barcelona (Spain) + courses: + - name: Mobile app development + url: https://campus.uoc.edu/tren/trenacc/web/GAT_EXP.PLANDOCENTE?any_academico=20221&cod_asignatura=22.603&idioma=ANG&pagina=PD_PREV_PORTAL + geo: + lat: '41.40676475' + lng: '2.194613783' +- title: University of South Carolina-Columbia + location: Columbia, SC (US) + courses: + - name: CSCE 490/492 Capstone Computing Project + url: https://capstone.cse.sc.edu/490syllabus/ + geo: + lat: '33.99393538' + lng: '-81.02995079' +- title: Victoria University + location: Melbourne (Australia) + courses: + - name: NIT3213 MOBILE APPLICATION DEVELOPMENT + url: https://www.vu.edu.au/units/NIT3213 + geo: + lat: '-37.78180158' + lng: '144.9000635' +- title: American University of Sharjah + location: Sharjah (United Arab Emirates) + courses: + - name: CMP 354 –Mobile Application Development + url: http://auscse.com/curriculum/syl/F21/CEN-CMP-354-F21-Syllabi.pdf + geo: + lat: '25.31171536' + lng: '55.4927254' +- title: University of Arkansas + location: Fayetteville, AR (US) + courses: + - name: CSCE 4623 – Mobile Programming + url: http://csce.uark.edu/~ahnelson/CSCE4623/syllabus-long.pdf + geo: + lat: '37.33702179' + lng: '-93.99906472' +- title: Bar-Ilan University + location: Ramat Gan (Israel) + courses: + - name: Application development course + url: https://is.biu.ac.il/app-development-course + geo: + lat: '32.0694261' + lng: '34.84303393' +- title: University of Engineering and Technology, Taxila + location: Taxila (Pakistan) + courses: + - name: Mobile Application Development + url: https://web.uettaxila.edu.pk/cped/CourseDetails-FallLatest.asp?Id=CP-405 + geo: + lat: '33.76665321' + lng: '72.82320908' +- title: Federation University Australia + location: Ballarat (Australia) + courses: + - name: Mobile Development Fundamentals (ITECH2000) + url: https://study.federation.edu.au/subject/ITECH2000 + geo: + lat: '-37.62627103' + lng: '143.8910952' +- title: Manchester Metropolitan University + location: Manchester (UK) + courses: + - name: Creating Your First Android App with Kotlin + url: https://rise.mmu.ac.uk/lil/digital-capabilities/# + geo: + lat: '53.47054006' + lng: '-2.239321361' +- title: University of Nantes + location: Nantes (France) + courses: + - name: Développement Orienté Objet + url: https://gitlab.univ-nantes.fr/iut.info1.dev.objets/dev.objets.ressources + geo: + lat: '47.20974366' + lng: '-1.555957803' +- title: National Cheng Kung University (NCKU) + location: Tainan (Taiwan) + courses: + - name: 雲端行動應用 - CLOUD AND MOBILE APPLICATIONS + url: http://class-qry.acad.ncku.edu.tw/syllabus/online_display.php?syear=0109&sem=1&co_no=H344900&class_code= + geo: + lat: '22.99700938' + lng: '120.2168135' +- title: National University of Science and Technology (MISiS) + location: Moscow (Russia) + courses: + - name: Программирование на Kotlin + url: https://misis.ru/applicants/admission/baccalaureate-and-specialty/faculties/prikladnayainformatika/uxuidesign/ + geo: + lat: '56.29346008' + lng: '37.653157' +- title: New Jersey Institute of Technology + location: Newark, NJ (US) + courses: + - name: "CS 388-002: Android Application Development" + url: https://digitalcommons.njit.edu/cs-syllabi/67/ + geo: + lat: '40.74250875' + lng: '-74.17926886' +- title: North South University + location: Dhaka (Bangladesh) + courses: + - name: CSE 499 Project/Internship/Special Laboratory Project + url: https://github.com/NSU-SP21-CSE499-18 + geo: + lat: '23.81530698' + lng: '90.4255566' +- title: Polytechnic University of Turin + location: Turin (Italy) + courses: + - name: Mobile application development + url: https://didattica.polito.it/pls/portal30/gap.pkg_guide.viewGap?p_cod_ins=01PFPBH + geo: + lat: '45.06257121' + lng: '7.662374674' +- title: University of Rovira i Virgili + location: Tarragona (Spain) + courses: + - name: MOBILE APPLICATIONS AND SERVICES + url: https://guiadocent.urv.cat/docnet/guia_docent/index.php?centre=17&ensenyament=1724&assignatura=17244115&idioma=eng&font=14&any_academic=2022_23 + geo: + lat: '41.14444708' + lng: '1.251882718' +- title: Savitribai Phule Pune University + location: Pune (India) + courses: + - name: CDS-242 Web and Mobile Application + url: http://collegecirculars.unipune.ac.in/sites/documents/Syllabus2021/S.Y.B.Sc.%20(Cyber%20and%20Digital%20Science)_14.09.2021.pdf?Mobile=1&Source=%2Fsites%2Fdocuments%2F%5Flayouts%2Fmobile%2Fdispform%2Easpx%3FList%3De863f80e%252D3186%252D47db%252D9e5d%252D75b1718a8bab%26View%3D62720b05%252D0c86%252D4245%252D9b8c%252D7dab74238a4e%26ID%3D156%26CurrentPage%3D1 + geo: + lat: '18.55540948' + lng: '73.82619918' +- title: Thapar University + location: Patiala (India) + courses: + - name: Experiential Learning (EL) + url: https://csed.thapar.edu/pages/experiential-learning-centre-elc-activities + geo: + lat: '30.35663713' + lng: '76.36469047' +- title: Tomsk State University + location: Tomsk (Russia) + courses: + - name: Разработчик мобильных приложений на платформе Android + url: https://www.tgu-dpo.ru/program/developandroidapplications + geo: + lat: '56.4695948' + lng: '84.94756664' +- title: The University of Aizu + location: Aizuwakamatsu (Japan) + courses: + - name: Android Programming with Kotlin online from OTH Regensburg + url: https://u-aizu.ac.jp/osip/en/dispatch/index.html + geo: + lat: '37.52409764' + lng: '139.937504' +- title: Anna University + location: Chennai (India) + courses: + - name: UNIT II NATIVE APP DEVELOPMENT USING JAVA + url: https://cac.annauniv.edu/aidetails/afug_2021_fu/Revised/IandC/B.E.CSE.pdf + geo: + lat: '13.01141148' + lng: '80.23542885' +- title: University of Belgrade + location: Belgrade (Serbia) + courses: + - name: Programming Languages + url: http://www.programskijezici.matf.bg.ac.rs/#1_tab + geo: + lat: '44.81856593' + lng: '20.45762348' +- title: Birla Institute of Technology and Science, Pilani + location: Pilani (India) + courses: + - name: Practice School - I + url: https://www.bits-pilani.ac.in/uploads/PSD/PS_I_Chronicles/2022/Part-IV-(Healthcare).pdf + geo: + lat: '28.35905233' + lng: '75.58807404' +- title: Boğaziçi University + location: Istanbul (Turkey) + courses: + - name: Kotlin ile Android Geliştirme + url: https://boun101.boun.edu.tr/classes/kotlin-ile-android-gelistirme/ + geo: + lat: '41.08489455' + lng: '29.0510399' +- title: University of Dayton + location: Dayton, OH (US) + courses: + - name: "CPS 452: Emerging Programming Languages" + url: https://perugini.cps.udayton.edu/teaching/courses/Fall2019/cps452/ + geo: + lat: '39.74029387' + lng: '-84.17903377' +- title: ISCTE-University Institute of Lisbon + location: Lisbon (Portugal) + courses: + - name: Advanced Programming + url: https://www.iscte-iul.pt/course/12/master-msc-in-computer-engineering/studyplan + geo: + lat: '38.74803216' + lng: '-9.153388788' +- title: University of Jaén + location: Jaen (Spain) + courses: + - name: 74012007 - Technology and Development in Mobile Devices + url: https://uvirtual.ujaen.es/pub/es/informacionacademica/catalogoguiasdocentes/p/patie/2022-23/4/740A/74012007/en/2022-23-74012007_en.html + geo: + lat: '37.78857245' + lng: '-3.777152431' +- title: Kazan Federal University + location: Kazan (Russia) + courses: + - name: Методы программирования мобильных приложений (Kotlin+Java) + url: https://kpfu.ru/pdf/portal/oop2/554360.pdf + geo: + lat: '55.79084324' + lng: '49.12161221' +- title: University of Latvia + location: Riga (Latvia) + courses: + - name: "2DAT4081-EN: Object Oriented Programming" + url: https://www.lu.lv/studijas/studiju-celvedis/programmu-un-kursu-katalogi/kursu-katalogs/?tx_lustudycatalogue_pi1%5Baction%5D=detail&tx_lustudycatalogue_pi1%5Bcontroller%5D=Course&tx_lustudycatalogue_pi1%5Bcourse%5D=DatZ4019&cHash=f75c023f05bf901c02d99827e488e21d + geo: + lat: '56.95094435' + lng: '24.11634538' +- title: University of Ljubljana + location: Ljubljiana (Slovenia) + courses: + - name: The First Look at Android Programming with Kotlin + url: https://cs.ijs.si/competencecenter/clec/news/Notifications/Workshop_Android_Kotlin.pdf + geo: + lat: '46.04936503' + lng: '14.50412301' +- title: Lovely Professional University + location: Phagwara (India) + courses: + - name: CSE 224 Android Development Using Kotlin Language + url: https://www.lpu.in/downloads/Summer-School-Brochure.pdf + geo: + lat: '31.25613872' + lng: '75.70520787' +- title: Mahidol University + location: Salaya (Thailand) + courses: + - name: EGCI 428 Mobile Device Programming + url: https://muic.mahidol.ac.th/eng/wp-content/downloads/course_description/Computer_Engineering.pdf + geo: + lat: '13.8007163' + lng: '100.3245974' +- title: Masaryk University + location: Brno (Czech Republic) + courses: + - name: PV256 Introduction to Development for Android + url: https://is.muni.cz/predmet/fi/PV256?lang=en + geo: + lat: '49.1987872' + lng: '16.60541159' +- title: Old Dominion University + location: Norfolk, VA (US) + courses: + - name: CS 410 Professional Workforce Development + url: https://www.cs.odu.edu/~cpi/ + geo: + lat: '36.88551904' + lng: '-76.30591079' +- title: University of South Bohemia in České Budějovice + location: Ceske Bedejovice (Czech Republic) + courses: + - name: SMART DEVICE SYSTEMS + url: https://wstag.jcu.cz/ects/predmet/UAI/692?lang=en + geo: + lat: '48.9792759' + lng: '14.448264' +- title: Al-Farabi Kazakh National University + location: Almaty (Kazakhstan) + courses: + - name: Object-oriented programming 4 + url: https://www.kaznu.kz/en/education_programs/bachelor/speciality/1940#. + geo: + lat: '43.22541653' + lng: '76.92264487' +- title: Amity University + location: Noida (India) + courses: + - name: KOTLIN + url: https://www.amity.edu/course-details.aspx?fd=HMvncVYU9XU=&cfn=T/mIS5iNLnQ= + geo: + lat: '28.74638533' + lng: '77.33310857' +- title: Don State Technical University + location: Rostov-on-Don (Russia) + courses: + - name: Программирование мобильных устройств (Android, Kotlin) + url: https://donstu.ru/applicants/napravleniya/programmnoe-obespechenie-vychislitelnoy-tekhniki-i-avtomatizirovannykh-sistem/ + geo: + lat: '47.23735605' + lng: '39.71203625' +- title: Ilia State University + location: Tbilisi (Georgia) + courses: + - name: Mobile Programming in Kotlin + url: https://iliauni.edu.ge/ge/siaxleebi-8/gonisdziebebi-346/teqnologiuri-laboratoria-unilabis-prezentacia.page + geo: + lat: '41.79905243' + lng: '44.75440724' +- title: Oakland University + location: Rochester, MI (US) + courses: + - name: Cross Platform Mobile and Cloud Development + url: https://oakland.edu/pace/stellantis + geo: + lat: '42.6680675' + lng: '-83.20828835' +- title: Palacký University Olomouc + location: Olomouc (Czech Republic) + courses: + - name: Tvorba mobilních aplikací + url: https://www.inf.upol.cz/lide/lukas-novak + geo: + lat: '49.59557281' + lng: '17.2600152' +- title: Pavol Jozef Šafárik University in Košice + location: Kosice (Slovakia) + courses: + - name: ÚINF/VMA1/21 - Vývoj mobilných aplikácií + url: https://ics.science.upjs.sk/vma/ + geo: + lat: '48.71979659' + lng: '21.25113863' +- title: Reichman University + location: Herzliya (Israel) + courses: + - name: 3695 Native Android Development with Kotlin + url: https://ydi.runi.ac.il/en/2022/degreetype/1/faculty/30/degree/9035/specialization/320/program/3320002 + geo: + lat: '32.17598334' + lng: '34.83776647' +- title: University of Westminster + location: London (UK) + courses: + - name: 5COSCW023W - Mobile Application Development + url: https://dracopd.users.ecs.westminster.ac.uk/DOCUM/courses/5cosc023w/5cosc023w.html + geo: + lat: '51.51711092' + lng: '-0.1432219183' +- title: University of Alicante + location: Alicante (Spain) + courses: + - name: Desarrollo de Aplicaciones Android con Kotlin + url: http://jtech.ua.es/mudsdm/EjerciciosDrawables.html + geo: + lat: '38.38483207' + lng: '-0.5140083326' +- title: Altai State University + location: Barnaul (Russia) + courses: + - name: Разработка кроссплатформенных мобильных приложений + url: http://www.math.asu.ru/%D1%83%D1%87%D0%B5%D0%B1%D0%BD%D1%8B%D0%B9-%D1%86%D0%B5%D0%BD%D1%82%D1%80-%D0%BF%D0%BE-%D0%B4%D0%BF%D0%BE-%D0%B8%D0%BC%D0%B8%D1%82/#five + geo: + lat: '53.34836879' + lng: '83.77579853' +- title: BINUS University + location: West Jakarta (Indonesia) + courses: + - name: MOBILE APPLICATION PROGRAMMING + url: https://curriculum.binus.ac.id/course/mobi6063004-mlg/ + geo: + lat: '-5.239788306' + lng: '106.782255' +- title: Chung Yuan Christian University + location: Taoyuan (Taiwan) + courses: + - name: Android Kotlin智慧APP開發班 + url: https://oce.cycu.edu.tw/course/detail/?course=1105L0044 + geo: + lat: '24.9576064' + lng: '121.2407764' +- title: Cochin University of Science and Technology + location: Kochi (India) + courses: + - name: KOTLIN PROGRAMMING + url: https://cusat.ac.in/naac/criteria1/1.1.3/ddk/c67.pdf + geo: + lat: '10.04326378' + lng: '76.32434424' +- title: Hasanuddin University + location: Makassar (Indonesia) + courses: + - name: Kotlin Language for Java Developers + url: https://pusatbahasa.unhas.ac.id/courses/kotlin-for-java-developers/ + geo: + lat: '-5.133941322' + lng: '119.4880357' +- title: IPB University + location: Bogor (Indonesia) + courses: + - name: Mobile apps development + url: https://cs.ipb.ac.id/id/kenapa-ilmu-komputer-ipb/ + geo: + lat: '-5.680055001' + lng: '106.6354325' +- title: Irkutsk National Research Technical University + location: Irkutsk (Russia) + courses: + - name: "Bootcamp 2021: Kotlin for Android" + url: https://www.istu.edu/news/62385/ + geo: + lat: '52.26270853' + lng: '104.2614115' +- title: Istanbul Medipol University + location: Istanbul (Turkey) + courses: + - name: BPR1213184 KOTLIN PROGRAMMING + url: https://www.medipol.edu.tr/en/academics/vocational-schools/imu-vocational-school/programs/computer-programming/program-information#aktsKredileri + geo: + lat: '41.09064313' + lng: '29.0888647' +- title: Universiti Malaysia Sarawak (UNIMAS) + location: Kota Samarahan (Malaysia) + courses: + - name: Samarahan App Challenge 3.0 + url: https://www.news.unimas.my/stories/eventdetail/8537/-/samarahan-app-challenge-3-0 + geo: + lat: '1.466915456' + lng: '110.4252016' +- title: Obafemi Awolowo University + location: Ife (Nigeria) + courses: + - name: Kotlin Language for Java Developers + url: https://mac.oauife.edu.ng/courses/kotlin-for-java-developers/ + geo: + lat: '7.498770327' + lng: '4.517408562' +- title: Pontifical Catholic University of Paraná + location: Curitiba (Brazil) + courses: + - name: Desenvolvimento de Aplicativos Móveis + url: https://www.pucpr.br/curso-especializacao/desenvolvimento-de-aplicativos-moveis + geo: + lat: '-25.45166344' + lng: '-49.25106679' +- title: Université Saint-Joseph de Beyrouth + location: Beirut (Lebanon) + courses: + - name: Programmation Android + url: https://www.usj.edu.lb/intranet/actu/pdf/10490_1517.pdf + geo: + lat: '33.88253661' + lng: '35.51208345' +- title: Silesian University of Technology + location: Gliwice (Poland) + courses: + - name: Inżynieria aplikacji mobilnych i baz danych + url: https://www.polsl.pl/ps_aktualnosci/inzynieria-aplikacji-mobilnych-i-baz-danych-trwa-nabor-na-jedyne-takie-na-slasku-studia-podyplomowe/ + geo: + lat: '50.29130053' + lng: '18.67464155' +- title: Universiti Teknikal Malaysia Melaka + location: Malacca (Malaysia) + courses: + - name: MSMD 5113 Native Mobile Development I + url: https://ftmk.utem.edu.my/web/wp-content/uploads/2021/09/Postgraduate_Handbook_August2021-Full-Time.pdf + geo: + lat: '2.315296296' + lng: '102.3206879' +- title: Tokyo University of Science + location: Tokyo (Japan) + courses: + - name: Introduction to multilingual programming for AI and IoT utilization + url: https://web.my-class.jp/manabi-tus/asp-webapp/web/WWebKozaShosaiNyuryoku.do?kozaId=486517 + geo: + lat: '36.88356664' + lng: '139.389018' +- title: Tunghai University + location: Taichung (Taiwan) + courses: + - name: Mobile Device Development and Applications + url: https://teacher.thu.edu.tw/102/teac2_desc/outline5/print_outline.php?setyear=109&setterm=1&curr_code=1057&ss_sysid=otr + geo: + lat: '24.18286039' + lng: '120.6025045' +- title: Ural Federal University + location: Ekaterinburg (Russia) + courses: + - name: 1156435 Язык программирования Kotlin + url: https://programs.edu.urfu.ru/media/rpm/00035497.pdf + geo: + lat: '56.84044781' + lng: '60.61605738' +- title: Veltech University + location: Morai (India) + courses: + - name: 1151CS201 Mobile Application Development + url: https://www.veltech.edu.in/wp-content/uploads/2019/12/23.06.2022-FN.pdf + geo: + lat: '13.17779956' + lng: '80.09813161' +- title: Vignan’s Foundation for Science, Technology and Research + location: Guntur (India) + courses: + - name: Android Development with Kotlin + url: https://www.vvitguntur.com/~vvitg749/index.php?option=com_content&view=article&id=254&Itemid=745&lang=en + geo: + lat: '16.23357031' + lng: '80.55091862' +- title: Başkent University + location: Ankara (Turkey) + courses: + - name: ANDROID GAME PROGRAMMING + url: http://truva.baskent.edu.tr/bilgipaketi/?dil=EN&menu=akademik&inner=katalog&birim=524&ders=272229 + geo: + lat: '39.88784882' + lng: '32.65434504' +- title: University of Colima + location: Colima (Mexico) + courses: + - name: Bases de datos en Android con Kotlin + url: https://www.ucol.mx/content/cms/2/file/Catalogo_2019-2020_V4.pdf + geo: + lat: '19.24783842' + lng: '-103.6974358' +- title: Federal University of Piauí + location: Teresina (Brazil) + courses: + - name: "Introdução à Linguagem Kotlin para Android: Desenvolvendo uma aplicação de autenticação e autorização integrado ao Firebase" + url: https://www.ufpi.br/ultimas-noticias-ufpi/23915-eripi-2018-divulga-palestras-do-evento-11 + geo: + lat: '-4.808662814' + lng: '-42.80966773' +- title: Lucian Blaga University of Sibiu + location: Sibiu (Romania) + courses: + - name: Informatica mobila + url: http://csac.ulbsibiu.ro/files/fd/C/C_7.10_Elemente_de_informatica_mobila.pdf + geo: + lat: '45.79120143' + lng: '24.14558509' +- title: University of Montenegro + location: Podgorica (Montenegro) + courses: + - name: PROGRAMIRANJE NAPREDNI KURS + url: https://www.ucg.ac.me/skladiste/blog_1983/objava_83005/fajlovi/PROGRAMIRANJE%20NAPREDNI%20KURS_2020_2021.pdf + geo: + lat: '42.44197427' + lng: '19.24258323' +- title: Mustansiriyah University + location: Baghdad (Iraq) + courses: + - name: Mobile Development Introduction to Android + url: https://uomustansiriyah.edu.iq/media/lectures/6/6_2021_09_15!09_12_56_PM.pdf + geo: + lat: '33.36745166' + lng: '44.4035716' +- title: Northern (Arctic) Federal University named after M.V. Lomonosov + location: Arkhangelsk (Russia) + courses: + - name: Практическое использование Kotlin в Android-разработке + url: https://narfu.ru/hsitas/struktura-i-kontakty/innovative_learning/raspisanie-kursov/index.php?sphrase_id=463925 + geo: + lat: '66.14218175' + lng: '40.90094794' +- title: Pedagogical and Technological University of Colombia + location: Tunja (Colombia) + courses: + - name: Programación Android con Kotlin + url: http://www.uptc.edu.co/export/sites/default/relaciones_internacionales/convocatorias/2020/doc/of_virt_ecci.pdf + geo: + lat: '5.563627598' + lng: '-73.35803789' +- title: Perm State University + location: Perm (Russia) + courses: + - name: Разработка приложений для Android (начальный уровень) + url: https://drive.google.com/file/d/12XgfA4VGFuDO3qR5MiJ4w0IQKvqS41X9/view + geo: + lat: '58.00866821' + lng: '56.18776088' +- title: Universidad de La Sabana - University of La Sabana + location: Chia (Colombia) + courses: + - name: PROGRAMACIÓN ANDROID CON KOTLIN Y JAVA + url: + geo: + lat: '4.861760429' + lng: '-74.03254753' +- title: Technical University of Cluj-Napoca + location: Cluj-Napoca (Romania) + courses: + - name: Comunicații Mobile + url: https://biblioteca.utcluj.ro/files/carti-online-cu-coperta/385-1.pdf + geo: + lat: '46.7693565' + lng: '23.58568634' +- title: Federal University of Technology – Paraná + location: Curitiba (Brazil) + courses: + - name: CURSO DE ESPECIALIZAÇÃO EM PROGRAMAÇÃO PARA DISPOSITIVOS MÓVEIS + url: http://www.utfpr.edu.br/editais/pesquisa-e-pos-graduacao/patobranco/i-curso-de-especializacao-em-programacao-para-dispositivos-moveis + geo: + lat: '-25.44332965' + lng: '-49.35349651' +- title: VSB - Technical University of Ostrava + location: Ostrava (Czech Republic) + courses: + - name: Design of Applications for Mobile Devices II + url: https://www.vsb.cz/e-vyuka/en/subject/460-4136 + geo: + lat: '49.83288942' + lng: '18.16235302' +- title: Wrocław University of Science and Technology + location: Wroclaw (Poland) + courses: + - name: "Application Programming: Mobile Computing" + url: http://marek.piasecki.staff.iiar.pwr.wroc.pl/dydaktyka/mc/index.html + geo: + lat: '51.107821' + lng: '17.06249032' +- title: Amrita Vishwa Vidyapeetham + location: Coimbatore (India) + courses: + - name: Workshop on Kotlin + url: https://www.amrita.edu/event/workshop-kotlin/ + geo: + lat: '10.90287926' + lng: '76.90067081' +- title: Università del Piemonte Orientale - UPO + location: Alessandria (Italy) + courses: + - name: Applicazioni mobili + url: https://of.uniupo.it/syllabus/didattica.php/en/2022/1932#176057 + geo: + lat: '45.32774072' + lng: '8.424520481' +- title: Institut Tecnològic de Barcelona + location: Barcelona (Spain) + courses: + - name: M03 - Programming + url: https://centellas.gitlab.io/teachingSite/DAM-M03/ + geo: + lat: '41.45357525' + lng: '2.186268539' +- title: Ivy Tech Community College + location: Indianapolis, IN (US) + courses: + - name: SDEV 264 - Mobile Application Development + url: https://catalog.ivytech.edu/search_advanced.php?cur_cat_oid=5&search_database=Search&search_db=Search&cpage=1&ecpage=1&ppage=1&spage=1&tpage=1&location=3&filter%5Bkeyword%5D=sdev+264&filter%5Bexact_match%5D=1 + geo: + lat: '39.95384826' + lng: '-86.13674919' +- title: Baku Higher Oil School + location: Baku (Azerbaijan) + courses: + - name: Mobile Development and Security + url: https://drive.google.com/drive/folders/1I-EtMwJ0GxapSGOAhQ9xDgSz0L2bjTFd + geo: + lat: '40.38250277' + lng: '49.87260473' +- title: Business Academy Aarhus + location: Aarhus (Denmark) + courses: + - name: Kotlin programming + url: + geo: + lat: '56.11998282' + lng: '10.15897346' +- title: Northern Michigan University + location: Marquette, MI (US) + courses: + - name: "CS 345-01-21F: Android Programming" + url: http://philos.nmu.edu/cs345-01-22w/syllabus.pdf + geo: + lat: '46.56036614' + lng: '-87.40758365' +- title: George Brown College + location: Toronto (Canada) + courses: + - name: Mobile Application Development and Strategy + url: https://www.georgebrown.ca/programs/mobile-application-development-and-strategy-program-postgraduate-t440 + geo: + lat: '43.67728424' + lng: '-79.4107284' +- title: Gujarat Technological University + location: (India) + courses: + - name: Mobile Computing using Android + url: https://www.vbtmca.ac.in/SYLLABUS/Sem%202/629402.pdf + geo: + lat: '23.10758288' + lng: '72.59404883' +- title: Astana International University + location: Astana (Kazakhstan) + courses: + - name: Kotlin Start вместе с Jusan Singularity + url: https://stepik.org/course/143445/promo + geo: + lat: '51.14479607' + lng: '71.42263321' +- title: Avans University of Applied Sciences - Avans Hogeschool + location: Breda (Netherlands) + courses: + - name: Full stack development met Android + url: https://studypath.avans.nl/p/Module/21392098230014715 + geo: + lat: '51.58475' + lng: '4.79787' +- title: Galgotias University + location: Greater Noida (India) + courses: + - name: Android App Development Using Kotlin + url: https://drive.google.com/file/d/17auzOW2NQT3dTnrH0vCqV81Dj-dYRpY5/view?usp=sharing + geo: + lat: '28.36992964' + lng: '77.54178669' +- title: Chandigarh University + location: Mohali (India) + courses: + - name: Android Development with Kotlin + url: https://drive.google.com/file/d/1SZgNys6D6wm_5H_lWAGvb3_Q_JDGOzu7/view?usp=sharing + geo: + lat: '30.77132339' + lng: '76.57834532' +- title: CVR College Of Engineering + location: Ibrahimpatnam (India) + courses: + - name: Mobile Application Development + url: https://drive.google.com/file/d/1dA5e1HkYEGGEmn5dHiS4_bOZ5KxK-IBV/view?usp=sharing + geo: + lat: '17.76959621' + lng: '78.49855577' +- title: Shivaji University + location: Kolhapur (India) + courses: + - name: Android Development with Kotlin + url: https://drive.google.com/file/d/1wCA29y1khTr2Z2D9SBqWxqamKzylmHfk/view?usp=sharing + geo: + lat: '16.67811165' + lng: '74.25558133' +- title: Manav Rachna International Institute of Research and Studies - MRIIRS + location: Faridabad (India) + courses: + - name: Mobile Computing with Android (CSH319) T & P + url: https://drive.google.com/file/d/1xL9raHbwl7WOZ34vxAA-ux4aZGso6nUy/view?usp=sharing + geo: + lat: '28.45060447' + lng: '77.28370448' +- title: GIET University + location: Gunupur (India) + courses: + - name: Android App Development Using Kotlin + url: https://drive.google.com/file/d/1F6wSx8m71LP0xAwmDpD-xhN45uimk5n2/view?usp=sharing + geo: + lat: '19.39797965' + lng: '83.90424399' +- title: Bennett University + location: Greater Noida (India) + courses: + - name: Android Development with Kotlin (CSET492) + url: https://docs.google.com/document/d/1xRUUl_TnY5rK1dNMF7Ek2HyKpbjl553I/edit?usp=sharing&ouid=100596030386092500850&rtpof=true&sd=true + geo: + lat: '28.45081627' + lng: '77.58421925' +- title: Grand View University in Des Moines + location: Des Moines, IA (US) + courses: + - name: CPSC 242 Computer Science II + url: https://www.grandview.edu/academics/undergraduate/minors/computer-science + geo: + lat: '41.6202382' + lng: '-93.6058123' +- title: Catholic University Of Colombia + location: Bogotá (Colombia) + courses: + - name: CT10126 Programación para Dispositivos Android + url: https://www.ucatolica.edu.co/portal/wp-content/uploads/adjuntos/facultades/electivas-programa-2023-1.pdf + geo: + lat: '4.634201277' + lng: '-74.06663640502144' diff --git a/data/user-groups.yml b/data/user-groups.yml index 63521f15d79..85e53cd6bda 100644 --- a/data/user-groups.yml +++ b/data/user-groups.yml @@ -521,6 +521,12 @@ position: lat: 21.1904494 lng: 81.2849169 + - name: Fuzhou KUG + country: China Mainland + url: https://fuzhou-kug.github.io/ + position: + lat: 26.050375 + lng: 119.1535778 - name: Guangzhou KUG country: China Mainland url: https://gzkug.com/ @@ -539,12 +545,6 @@ position: lat: 41.69465336184713 lng: 44.78250312871074 - - name: Hefei KUG - country: China Mainland - url: https://weibo.com/kotlinhfug - position: - lat: 31.820591 - lng: 117.227219 - name: Ho Chi Minh KUG country: Vietnam url: https://www.facebook.com/kughcmc/ @@ -731,6 +731,12 @@ position: lat: 31.1471305 lng: 75.34121789999999 + - name: Qingdao KUG + country: China Mainland + url: https://qingdao-kug.github.io/ + position: + lat: 36.136235 + lng: 120.2000272 - name: Rajkot KUG country: India url: https://sites.google.com/view/kugrajkot/home @@ -751,7 +757,7 @@ lng: 121.473701 - name: Shenzhen KUG country: China Mainland - url: https://szkug.github.io/website-hugo/ + url: https://github.com/szkug/ position: lat: 22.543096 lng: 114.057865 @@ -857,6 +863,12 @@ position: lat: 34.259376 lng: 108.947037 + - name: Zhengzhou KUG + country: China Mainland + url: https://zhengzhou-kug.github.io/ + position: + lat: 34.742732 + lng: 113.3335248 - section: North & South America anchorId: north-south-america groups: diff --git a/docs/images/data-science/kotlin-notebook.png b/docs/images/data-science/kotlin-notebook.png new file mode 100644 index 00000000000..f0980977064 Binary files /dev/null and b/docs/images/data-science/kotlin-notebook.png differ diff --git a/docs/images/get-started/js-new-project-1.png b/docs/images/get-started/js-new-project-1.png deleted file mode 100644 index f3c5c9dbd53..00000000000 Binary files a/docs/images/get-started/js-new-project-1.png and /dev/null differ diff --git a/docs/images/get-started/js-new-project-2.png b/docs/images/get-started/js-new-project-2.png deleted file mode 100644 index 30ccc193a56..00000000000 Binary files a/docs/images/get-started/js-new-project-2.png and /dev/null differ diff --git a/docs/images/get-started/jvm-new-project.png b/docs/images/get-started/jvm-new-project.png index 1809c3282c2..050f3cac1ab 100644 Binary files a/docs/images/get-started/jvm-new-project.png and b/docs/images/get-started/jvm-new-project.png differ diff --git a/docs/images/get-started/native-new-project-intellij-1.png b/docs/images/get-started/native-new-project-intellij-1.png deleted file mode 100644 index f52222ee026..00000000000 Binary files a/docs/images/get-started/native-new-project-intellij-1.png and /dev/null differ diff --git a/docs/images/gradle/gradle-build-scan-k1.png b/docs/images/gradle/gradle-build-scan-k1.png new file mode 100644 index 00000000000..a82998bf853 Binary files /dev/null and b/docs/images/gradle/gradle-build-scan-k1.png differ diff --git a/docs/images/gradle/gradle-build-scan-k2.png b/docs/images/gradle/gradle-build-scan-k2.png new file mode 100644 index 00000000000..1ec6d4aaa13 Binary files /dev/null and b/docs/images/gradle/gradle-build-scan-k2.png differ diff --git a/docs/images/gradle/jvm-new-gradle-project.png b/docs/images/gradle/jvm-new-gradle-project.png index e8bb5efce6c..2edcde60f8b 100644 Binary files a/docs/images/gradle/jvm-new-gradle-project.png and b/docs/images/gradle/jvm-new-gradle-project.png differ diff --git a/docs/images/icons/icon-5-done.svg b/docs/images/icons/icon-5-done.svg new file mode 100644 index 00000000000..ce264804a36 --- /dev/null +++ b/docs/images/icons/icon-5-done.svg @@ -0,0 +1,4 @@ + + + + diff --git a/docs/images/icons/icon-6-done.svg b/docs/images/icons/icon-6-done.svg new file mode 100644 index 00000000000..513defa5b27 --- /dev/null +++ b/docs/images/icons/icon-6-done.svg @@ -0,0 +1,4 @@ + + + + diff --git a/docs/images/icons/icon-6-todo.svg b/docs/images/icons/icon-6-todo.svg new file mode 100644 index 00000000000..96855e92356 --- /dev/null +++ b/docs/images/icons/icon-6-todo.svg @@ -0,0 +1,4 @@ + + + + diff --git a/docs/images/icons/icon-7-done.svg b/docs/images/icons/icon-7-done.svg new file mode 100644 index 00000000000..9755a698044 --- /dev/null +++ b/docs/images/icons/icon-7-done.svg @@ -0,0 +1,4 @@ + + + + diff --git a/docs/images/icons/icon-7-todo.svg b/docs/images/icons/icon-7-todo.svg new file mode 100644 index 00000000000..f16c0c8ec27 --- /dev/null +++ b/docs/images/icons/icon-7-todo.svg @@ -0,0 +1,4 @@ + + + + diff --git a/docs/images/icons/icon-7.svg b/docs/images/icons/icon-7.svg new file mode 100644 index 00000000000..bfbb8a07c28 --- /dev/null +++ b/docs/images/icons/icon-7.svg @@ -0,0 +1,4 @@ + + + + diff --git a/docs/images/multiplatform-mobile/create-first-app/common-kotlin-file.png b/docs/images/multiplatform-mobile/create-first-app/common-kotlin-file.png index 599015216fb..237c56aedd2 100644 Binary files a/docs/images/multiplatform-mobile/create-first-app/common-kotlin-file.png and b/docs/images/multiplatform-mobile/create-first-app/common-kotlin-file.png differ diff --git a/docs/images/multiplatform/kotlin-multiplatform-hierarchical-structure.svg b/docs/images/multiplatform/kotlin-multiplatform-hierarchical-structure.svg index ef71f387e62..7552a86bc74 100644 --- a/docs/images/multiplatform/kotlin-multiplatform-hierarchical-structure.svg +++ b/docs/images/multiplatform/kotlin-multiplatform-hierarchical-structure.svg @@ -1,32 +1,30 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/images/multiplatform/kotlin-multiplatform.svg b/docs/images/multiplatform/kotlin-multiplatform.svg new file mode 100644 index 00000000000..fc6dc3a14e2 --- /dev/null +++ b/docs/images/multiplatform/kotlin-multiplatform.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docs/images/multiplatform/multiplatform-compose.svg b/docs/images/multiplatform/multiplatform-compose.svg new file mode 100644 index 00000000000..5b45e8b817d --- /dev/null +++ b/docs/images/multiplatform/multiplatform-compose.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docs/images/multiplatform/multiplatform-project-1.png b/docs/images/multiplatform/multiplatform-project-1.png index 0cb23e5ffdf..2e4d200319c 100644 Binary files a/docs/images/multiplatform/multiplatform-project-1.png and b/docs/images/multiplatform/multiplatform-project-1.png differ diff --git a/docs/images/multiplatform/multiplatform-project-2.png b/docs/images/multiplatform/multiplatform-project-2.png deleted file mode 100644 index dbbd40375dc..00000000000 Binary files a/docs/images/multiplatform/multiplatform-project-2.png and /dev/null differ diff --git a/docs/images/multiplatform/multiplatform-project-3.png b/docs/images/multiplatform/multiplatform-project-3.png deleted file mode 100644 index c96cdc88245..00000000000 Binary files a/docs/images/multiplatform/multiplatform-project-3.png and /dev/null differ diff --git a/docs/images/reference/js-running-tests/browsertest-task.png b/docs/images/reference/js-running-tests/browsertest-task.png index 807fba97863..d7a240a280e 100644 Binary files a/docs/images/reference/js-running-tests/browsertest-task.png and b/docs/images/reference/js-running-tests/browsertest-task.png differ diff --git a/docs/images/reference/js-running-tests/failed-test.png b/docs/images/reference/js-running-tests/failed-test.png index 9f18af8027b..215350d4c61 100644 Binary files a/docs/images/reference/js-running-tests/failed-test.png and b/docs/images/reference/js-running-tests/failed-test.png differ diff --git a/docs/images/reference/js-running-tests/test-stacktrace-ide.png b/docs/images/reference/js-running-tests/test-stacktrace-ide.png index 16b00de822c..faa594c65fd 100644 Binary files a/docs/images/reference/js-running-tests/test-stacktrace-ide.png and b/docs/images/reference/js-running-tests/test-stacktrace-ide.png differ diff --git a/docs/images/reference/js-running-tests/test-summary.png b/docs/images/reference/js-running-tests/test-summary.png index 48e40bc587c..ed06948afbd 100644 Binary files a/docs/images/reference/js-running-tests/test-summary.png and b/docs/images/reference/js-running-tests/test-summary.png differ diff --git a/docs/images/reference/running-kotlin-js/browser-console-output.png b/docs/images/reference/running-kotlin-js/browser-console-output.png index c10bc69f250..6951b9985b1 100644 Binary files a/docs/images/reference/running-kotlin-js/browser-console-output.png and b/docs/images/reference/running-kotlin-js/browser-console-output.png differ diff --git a/docs/images/reference/running-kotlin-js/cli-output.png b/docs/images/reference/running-kotlin-js/cli-output.png index b6326e3b707..af5b2c99013 100644 Binary files a/docs/images/reference/running-kotlin-js/cli-output.png and b/docs/images/reference/running-kotlin-js/cli-output.png differ diff --git a/docs/images/reference/running-kotlin-js/run-gradle-task.png b/docs/images/reference/running-kotlin-js/run-gradle-task.png index 12e7322fb8b..71cef22394a 100644 Binary files a/docs/images/reference/running-kotlin-js/run-gradle-task.png and b/docs/images/reference/running-kotlin-js/run-gradle-task.png differ diff --git a/docs/images/roadmap/roadmap-board.png b/docs/images/roadmap/roadmap-board.png index 22bbf6d6d38..c45ee73e396 100644 Binary files a/docs/images/roadmap/roadmap-board.png and b/docs/images/roadmap/roadmap-board.png differ diff --git a/docs/images/spring-boot/create-spring-boot-project.png b/docs/images/spring-boot/create-spring-boot-project.png index 2304df126c7..d12389b11cb 100644 Binary files a/docs/images/spring-boot/create-spring-boot-project.png and b/docs/images/spring-boot/create-spring-boot-project.png differ diff --git a/docs/images/tour/start-kotlin-tour.svg b/docs/images/tour/start-kotlin-tour.svg new file mode 100644 index 00000000000..60dda339eb7 --- /dev/null +++ b/docs/images/tour/start-kotlin-tour.svg @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/images/tutorials/native/cinterop/native-file-new.png b/docs/images/tutorials/native/cinterop/native-file-new.png index 14d99814121..61c9efdb3e4 100644 Binary files a/docs/images/tutorials/native/cinterop/native-file-new.png and b/docs/images/tutorials/native/cinterop/native-file-new.png differ diff --git a/docs/images/tutorials/scripting/custom-script-deps/script-deps-create-root-project.png b/docs/images/tutorials/scripting/custom-script-deps/script-deps-create-root-project.png index 72034fc1e73..c4b460e440b 100644 Binary files a/docs/images/tutorials/scripting/custom-script-deps/script-deps-create-root-project.png and b/docs/images/tutorials/scripting/custom-script-deps/script-deps-create-root-project.png differ diff --git a/docs/images/tutorials/scripting/custom-script-deps/script-deps-module-definition.png b/docs/images/tutorials/scripting/custom-script-deps/script-deps-module-definition.png index 639ca5e0c42..87461e14d52 100644 Binary files a/docs/images/tutorials/scripting/custom-script-deps/script-deps-module-definition.png and b/docs/images/tutorials/scripting/custom-script-deps/script-deps-module-definition.png differ diff --git a/docs/images/tutorials/scripting/custom-script-deps/script-deps-run-config.png b/docs/images/tutorials/scripting/custom-script-deps/script-deps-run-config.png index de254a743d1..f0fedac44d5 100644 Binary files a/docs/images/tutorials/scripting/custom-script-deps/script-deps-run-config.png and b/docs/images/tutorials/scripting/custom-script-deps/script-deps-run-config.png differ diff --git a/docs/images/wasm/wasm-1-9-0-size-improvements.png b/docs/images/wasm/wasm-1-9-0-size-improvements.png new file mode 100644 index 00000000000..219243764d2 Binary files /dev/null and b/docs/images/wasm/wasm-1-9-0-size-improvements.png differ diff --git a/docs/images/wasm/wasm-new-project-intellij.png b/docs/images/wasm/wasm-new-project-intellij.png index 5f06c3bee09..e77dd986cb6 100644 Binary files a/docs/images/wasm/wasm-new-project-intellij.png and b/docs/images/wasm/wasm-new-project-intellij.png differ diff --git a/docs/kr.tree b/docs/kr.tree index 571a06ae45d..20c65acf3fe 100644 --- a/docs/kr.tree +++ b/docs/kr.tree @@ -11,21 +11,33 @@ + + + + + + + + + + - + + - - - + + + + @@ -129,7 +141,7 @@ - + @@ -139,6 +151,7 @@ + @@ -148,7 +161,7 @@ - + @@ -238,18 +251,19 @@ + - - + + @@ -263,8 +277,7 @@ - - + @@ -293,8 +306,9 @@ - + + @@ -314,6 +328,7 @@ + @@ -378,7 +393,8 @@ - + + @@ -401,6 +417,7 @@ + diff --git a/docs/topics/advent-of-code.md b/docs/topics/advent-of-code.md index b05105f992c..511c3bddd56 100644 --- a/docs/topics/advent-of-code.md +++ b/docs/topics/advent-of-code.md @@ -185,4 +185,4 @@ or watch the video: ## 下一步做什么? * Complete more tasks with [Kotlin Koans](koans.md) -* Create working applications with the free [Kotlin Basics track](https://hyperskill.org/join/fromdocstoJetSalesStat?redirect=true&next=/tracks/18) +* Create working applications with the free [Kotlin Core track](https://hyperskill.org/tracks?category=4&utm_source=jbkotlin_hs&utm_medium=referral&utm_campaign=kotlinlang-docs&utm_content=button_1&utm_term=22.03.23) by JetBrains Academy diff --git a/docs/topics/all-open-plugin.md b/docs/topics/all-open-plugin.md index 22afdac9899..660f457e4ac 100644 --- a/docs/topics/all-open-plugin.md +++ b/docs/topics/all-open-plugin.md @@ -15,23 +15,11 @@ We provide *all-open* plugin support both for Gradle and Maven with the complete ## Gradle -Add the plugin artifact to the build script dependencies and apply the plugin: - -```groovy -buildscript { - dependencies { - classpath "org.jetbrains.kotlin:kotlin-allopen:$kotlin_version" - } -} - -apply plugin: "kotlin-allopen" -``` - -As an alternative, you can enable it using the `plugins` block: +Add the plugin using Gradle's plugins DSL: ```groovy plugins { - id "org.jetbrains.kotlin.plugin.allopen" version "%kotlinVersion%" + id "org.jetbrains.kotlin.plugin.allopen" version "%kotlinVersion%" } ``` @@ -100,23 +88,11 @@ Please refer to the [Gradle](#gradle) section for the detailed information about If you use Spring, you can enable the *kotlin-spring* compiler plugin instead of specifying Spring annotations manually. The kotlin-spring is a wrapper on top of all-open, and it behaves exactly the same way. -As with all-open, add the plugin to the build script dependencies: - -```groovy -buildscript { - dependencies { - classpath "org.jetbrains.kotlin:kotlin-allopen:$kotlin_version" - } -} - -apply plugin: "kotlin-spring" // instead of "kotlin-allopen" -``` - -Or using the Gradle plugins DSL: +Add the plugin using Gradle's plugins DSL: ```groovy plugins { - id "org.jetbrains.kotlin.plugin.spring" version "%kotlinVersion%" + id "org.jetbrains.kotlin.plugin.spring" version "%kotlinVersion%" } ``` diff --git a/docs/topics/android-overview.md b/docs/topics/android-overview.md index 581f4b82094..2ef0df12cde 100644 --- a/docs/topics/android-overview.md +++ b/docs/topics/android-overview.md @@ -1,26 +1,38 @@ [//]: # (title: Kotlin 用于 Android 开发) -自 2019 年 Google I/O 以来,Kotlin 就成为了 Android 移动开发的首选。 +自 2019 年 Google I/O 以来,Kotlin 就成为了 Android 移动开发的[首选](https://developer.android.com/kotlin/first)。 + +Over 50% of professional Android developers use Kotlin as their primary language, while only 30% use Java as their +main language. 70% of developers whose primary language is Kotlin say that Kotlin makes them more productive. 使用 Kotlin 进行 Android 开发,可以受益于: -* **代码更少、可读性更强**。花更少的时间来编写代码与理解他人的代码。 -* **成熟的语言与环境**。自 2011 年创建以来,Kotlin 不仅通过语言而且通过强大的工具在整个生态系统中不断发展。 - 现在,它已无缝集成到 Android Studio 中, - 并被许多公司积极用于开发 Android 应用程序。 -* **Android Jetpack 与其他库中的 Kotlin 支持**。[KTX 扩展](https://developer.android.com/kotlin/ktx) - 为现有的 Android 库添加了 Kotlin 语言特性,如协程、扩展函数、lambdas 与命名参数。 -* **与 Java 的互操作性**。可以在应用程序中将 Kotlin 与 Java 编程语言一起使用, +* **代码更少、可读性更强**。花更少的时间来编写代码与理解他人的代码 + 。 +* **Fewer common errors**. Apps built with Kotlin are 20% less likely to crash based + on [Google's internal data](https://medium.com/androiddevelopers/fewer-crashes-and-more-stability-with-kotlin-b606c6a6ac04). +* **Kotlin support in Jetpack libraries**. [Jetpack Compose](https://developer.android.com/jetpack/compose) is Android's + recommended modern toolkit for building native UI in Kotlin. + [KTX 扩展](https://developer.android.com/kotlin/ktx)为现有的 Android 库添加了 Kotlin 语言特性,如协程、 + 扩展函数、 lambda 表达式与命名参数。 +* **支持多平台开发**。 Kotlin Multiplatform allows development for not only Android but + also [iOS](https://kotlinlang.org/lp/multiplatform/), backend, and web applications. + [Some Jetpack libraries](https://developer.android.com/kotlin/multiplatform) are already multiplatform. + [Compose Multiplatform](https://www.jetbrains.com/lp/compose-multiplatform/), JetBrains' declarative UI framework + based on Kotlin and Jetpack Compose, makes it possible to share UIs across platforms – iOS, Android, desktop, and web. +* **成熟的语言与环境**。 自 2011 年创建以来,Kotlin 不仅通过语言而且通过强大的工具在整个生态系统中不断发展。 现在,它已无缝集成到 [Android Studio](https://developer.android.com/studio) + 中, 并被许多公司积极用于开发 Android 应用程序。 +* **与 Java 的互操作性**。 可以在应用程序中将 Kotlin 与 Java 编程语言一起使用, 而无需将所有代码迁移到 Kotlin。 -* **支持多平台开发**。不仅可以使用 Kotlin 开发 Android,还可以开发 [iOS](https://kotlinlang.org/lp/multiplatform/)、后端与 Web 应用程序。 - 享受在平台之间共享公共代码的好处。 -* **代码安全**。更少的代码与更好的可读性导致更少的错误。Kotlin 编译器检测这些剩余的错误,从而使代码安全。 * **易学易用**。Kotlin 非常易于学习,尤其是对于 Java 开发人员而言。 -* **大社区**。Kotlin 得到了社区的大力支持与许多贡献,该社区在全世界范围内都在增长。 - 根据 Google 的说法,Play 商店前 1000 个应用中有 60% 以上使用 Kotlin。 +* **大社区**。 Kotlin 得到了社区的大力支持与许多贡献,该社区在全世界范围内都在增长 + 。 Over 95% of the top thousand Android apps use Kotlin. -许多初创公司与财富 500 强公司已经使用 Kotlin 开发了 Android 应用程序——详情请见[面向 Kotlin 开发者的谷歌网站](https://developer.android.com/kotlin)。 +许多初创公司与财富 500 强公司已经使用 Kotlin 开发了 Android 应用程序,参见 +[面向 Android 开发者的谷歌网站](https://developer.android.com/kotlin/stories)上的列表。 -如果想开始使用 Kotlin 进行 Android 开发,请参阅[在 Android 开发中开始使用 Kotlin](https://developer.android.com/kotlin/get-started)。 +To start using Kotlin for: -如果是 Android 的新手,并且想学习使用 Kotlin 创建应用程序,请查看[这门 Udacity 课程](https://www.udacity.com/course/developing-android-apps-with-kotlin--ud9012)。 \ No newline at end of file +* Android development, read [Google's documentation for developing Android apps with Kotlin](https://developer.android.com/kotlin/get-started). +* Developing cross-platform mobile applications, see [Get started with Kotlin Multiplatform for Android and iOS](multiplatform-mobile-getting-started.md). diff --git a/docs/topics/async-programming.md b/docs/topics/async-programming.md index a67837d09b3..9950aa84bc1 100644 --- a/docs/topics/async-programming.md +++ b/docs/topics/async-programming.md @@ -37,7 +37,7 @@ fun preparePost(): Token { * 线程并非廉价的。线程需要昂贵的上下文切换。 * 线程不是无限的。可被启动的线程数受底层操作系统的限制。在服务器端应用程序中,这可能会导致严重的瓶颈。 * 线程并不总是可用。在一些平台中,比如 JavaScript 甚至不支持线程。 -* 线程不容易使用。线程的 Debug,避免竞争条件是我们在多线程编程中遇到的常见问题。 +* 线程不容易使用。调试线程与避免竞争条件是我们在多线程编程中遇到的常见问题。 ## 回调 diff --git a/docs/topics/basic-syntax.md b/docs/topics/basic-syntax.md index cf1241fe292..460c1b47ec7 100644 --- a/docs/topics/basic-syntax.md +++ b/docs/topics/basic-syntax.md @@ -3,7 +3,7 @@ 这是一组基本语法元素及示例。在每段的末尾都有一个指向相关主题详述的链接。 -也可以通过 JetBrains 学院上的免费 [Kotlin 基础课程](https://hyperskill.org/join/fromdocstoJetSalesStat?redirect=true&next=/tracks/18)学习所有 +也可以通过 JetBrains 学院的免费 [Kotlin 核心课程](https://hyperskill.org/tracks?category=4&utm_source=jbkotlin_hs&utm_medium=referral&utm_campaign=kotlinlang-docs&utm_content=button_1&utm_term=22.03.23)学习所有 Kotlin 要领。 ## 包的定义与导入 @@ -31,7 +31,7 @@ fun main() { println("Hello world!") } ``` -{kotlin-runnable="true" kotlin-min-compiler-version="1.3"} +{kotlin-runnable="true" kotlin-min-compiler-version="1.3" id="kotlin-basic-syntax-hello-world"} `main` 的另一种形式接受可变数量的 `String` 参数。 @@ -54,7 +54,7 @@ fun main() { //sampleEnd } ``` -{kotlin-runnable="true" kotlin-min-compiler-version="1.3"} +{kotlin-runnable="true" kotlin-min-compiler-version="1.3" id="kotlin-basic-syntax-print"} `println` 输出其参数并添加换行符,以便接下来输出的内容出现在下一行。 @@ -66,7 +66,7 @@ fun main() { //sampleEnd } ``` -{kotlin-runnable="true" kotlin-min-compiler-version="1.3"} +{kotlin-runnable="true" kotlin-min-compiler-version="1.3" id="kotlin-basic-syntax-println"} ## 函数 @@ -84,7 +84,7 @@ fun main() { println(sum(3, 5)) } ``` -{kotlin-runnable="true" kotlin-min-compiler-version="1.3"} +{kotlin-runnable="true" kotlin-min-compiler-version="1.3" id="kotlin-basic-syntax-return-int"} 函数体可以是表达式。其返回类型可以推断出来。 @@ -97,7 +97,7 @@ fun main() { println("sum of 19 and 23 is ${sum(19, 23)}") } ``` -{kotlin-runnable="true" kotlin-min-compiler-version="1.3"} +{kotlin-runnable="true" kotlin-min-compiler-version="1.3" id="kotlin-basic-syntax-function-expression"} 返回无意义的值的函数。 @@ -112,7 +112,7 @@ fun main() { printSum(-1, 8) } ``` -{kotlin-runnable="true" kotlin-min-compiler-version="1.3"} +{kotlin-runnable="true" kotlin-min-compiler-version="1.3" id="kotlin-basic-syntax-return-unit"} `Unit` 返回类型可以省略。 @@ -127,7 +127,7 @@ fun main() { printSum(-1, 8) } ``` -{kotlin-runnable="true" kotlin-min-compiler-version="1.3"} +{kotlin-runnable="true" kotlin-min-compiler-version="1.3" id="kotlin-basic-syntax-function-omit-unit"} 参见[函数](functions.md)。 @@ -146,7 +146,7 @@ fun main() { println("a = $a, b = $b, c = $c") } ``` -{kotlin-runnable="true" kotlin-min-compiler-version="1.3"} +{kotlin-runnable="true" kotlin-min-compiler-version="1.3" id="kotlin-basic-syntax-val"} 可重新赋值的变量使用 `var` 关键字。 @@ -159,7 +159,7 @@ fun main() { println("x = $x") } ``` -{kotlin-runnable="true" kotlin-min-compiler-version="1.3"} +{kotlin-runnable="true" kotlin-min-compiler-version="1.3" id="kotlin-basic-syntax-var"} 可以在顶层声明变量。 @@ -180,7 +180,7 @@ fun main() { println("x = $x; PI = $PI") } ``` -{kotlin-runnable="true" kotlin-min-compiler-version="1.3"} +{kotlin-runnable="true" kotlin-min-compiler-version="1.3" id="kotlin-basic-syntax-variable-top-level"} 参见[属性](properties.md)。 @@ -212,7 +212,7 @@ fun main() { //sampleEnd } ``` -{kotlin-runnable="true" kotlin-min-compiler-version="1.3"} +{kotlin-runnable="true" kotlin-min-compiler-version="1.3" id="kotlin-basic-syntax-class-constructor"} 类之间继承由冒号(`:`)声明。默认情况下类都是 final 的;如需让一个类可继承, 请将其标记为 `open`。 @@ -264,7 +264,7 @@ fun main() { println(s2) } ``` -{kotlin-runnable="true" kotlin-min-compiler-version="1.3"} +{kotlin-runnable="true" kotlin-min-compiler-version="1.3" id="kotlin-basic-syntax-string-templates"} 参见[字符串模板](strings.md#字符串模板)。 @@ -285,7 +285,7 @@ fun main() { println("max of 0 and 42 is ${maxOf(0, 42)}") } ``` -{kotlin-runnable="true" kotlin-min-compiler-version="1.3"} +{kotlin-runnable="true" kotlin-min-compiler-version="1.3" id="kotlin-basic-syntax-conditional-expressions"} 在 Kotlin 中,`if` 也可以用作表达式。 @@ -298,7 +298,7 @@ fun main() { println("max of 0 and 42 is ${maxOf(0, 42)}") } ``` -{kotlin-runnable="true" kotlin-min-compiler-version="1.3"} +{kotlin-runnable="true" kotlin-min-compiler-version="1.3" id="kotlin-basic-syntax-if-expression"} 参见[`if` 表达式](control-flow.md#if-表达式)。 @@ -314,7 +314,7 @@ fun main() { //sampleEnd } ``` -{kotlin-runnable="true" kotlin-min-compiler-version="1.3"} +{kotlin-runnable="true" kotlin-min-compiler-version="1.3" id="kotlin-basic-syntax-for-loop"} 或者 @@ -328,7 +328,7 @@ fun main() { //sampleEnd } ``` -{kotlin-runnable="true" kotlin-min-compiler-version="1.3"} +{kotlin-runnable="true" kotlin-min-compiler-version="1.3" id="kotlin-basic-syntax-for-loop-indices"} 参见 [for 循环](control-flow.md#for-循环)。 @@ -346,7 +346,7 @@ fun main() { //sampleEnd } ``` -{kotlin-runnable="true" kotlin-min-compiler-version="1.3"} +{kotlin-runnable="true" kotlin-min-compiler-version="1.3" id="kotlin-basic-syntax-while-loop"} 参见 [while 循环](control-flow.md#while-循环)。 @@ -372,7 +372,7 @@ fun main() { println(describe("other")) } ``` -{kotlin-runnable="true" kotlin-min-compiler-version="1.3"} +{kotlin-runnable="true" kotlin-min-compiler-version="1.3" id="kotlin-basic-syntax-when-expression"} 参见 [when 表达式](control-flow.md#when-表达式)。 @@ -391,7 +391,7 @@ fun main() { //sampleEnd } ``` -{kotlin-runnable="true" kotlin-min-compiler-version="1.3"} +{kotlin-runnable="true" kotlin-min-compiler-version="1.3" id="kotlin-basic-syntax-range-in"} 检测某个数字是否在指定区间外。 @@ -409,7 +409,7 @@ fun main() { //sampleEnd } ``` -{kotlin-runnable="true" kotlin-min-compiler-version="1.3"} +{kotlin-runnable="true" kotlin-min-compiler-version="1.3" id="kotlin-basic-syntax-out-of-range"} 区间迭代。 @@ -422,7 +422,7 @@ fun main() { //sampleEnd } ``` -{kotlin-runnable="true" kotlin-min-compiler-version="1.3"} +{kotlin-runnable="true" kotlin-min-compiler-version="1.3" id="kotlin-basic-syntax-iterate-range"} 或数列迭代。 @@ -439,7 +439,7 @@ fun main() { //sampleEnd } ``` -{kotlin-runnable="true" kotlin-min-compiler-version="1.3"} +{kotlin-runnable="true" kotlin-min-compiler-version="1.3" id="kotlin-basic-syntax-iterate-progression"} 参见[区间与数列](ranges.md)。 @@ -457,7 +457,7 @@ fun main() { //sampleEnd } ``` -{kotlin-runnable="true" kotlin-min-compiler-version="1.3"} +{kotlin-runnable="true" kotlin-min-compiler-version="1.3" id="kotlin-basic-syntax-iterate-collection"} 使用 `in` 操作符来判断集合内是否包含某实例。 @@ -472,7 +472,7 @@ fun main() { //sampleEnd } ``` -{kotlin-runnable="true" kotlin-min-compiler-version="1.3"} +{kotlin-runnable="true" kotlin-min-compiler-version="1.3" id="kotlin-basic-syntax-collection-in"} 使用 lambda 表达式来过滤(filter)与映射(map)集合: @@ -488,7 +488,7 @@ fun main() { //sampleEnd } ``` -{kotlin-runnable="true" kotlin-min-compiler-version="1.3"} +{kotlin-runnable="true" kotlin-min-compiler-version="1.3" id="kotlin-basic-syntax-collection-filter-map"} 参见[集合概述](collections-overview.md)。 @@ -533,7 +533,7 @@ fun main() { printProduct("a", "b") } ``` -{kotlin-runnable="true" kotlin-min-compiler-version="1.3"} +{kotlin-runnable="true" kotlin-min-compiler-version="1.3" id="kotlin-basic-syntax-function-nullable-value"} 或者 @@ -568,7 +568,7 @@ fun main() { printProduct("99", "b") } ``` -{kotlin-runnable="true" kotlin-min-compiler-version="1.3"} +{kotlin-runnable="true" kotlin-min-compiler-version="1.3" id="kotlin-basic-syntax-function-null-check"} 参见[空安全](null-safety.md)。 @@ -599,7 +599,7 @@ fun main() { printLength(listOf(Any())) } ``` -{kotlin-runnable="true" kotlin-min-compiler-version="1.3"} +{kotlin-runnable="true" kotlin-min-compiler-version="1.3" id="kotlin-basic-syntax-is-operator"} 或者 @@ -622,7 +622,7 @@ fun main() { printLength(listOf(Any())) } ``` -{kotlin-runnable="true" kotlin-min-compiler-version="1.3"} +{kotlin-runnable="true" kotlin-min-compiler-version="1.3" id="kotlin-basic-syntax-is-operator-expression"} 甚至 @@ -647,7 +647,7 @@ fun main() { printLength(1000) } ``` -{kotlin-runnable="true" kotlin-min-compiler-version="1.3"} +{kotlin-runnable="true" kotlin-min-compiler-version="1.3" id="kotlin-basic-syntax-is-operator-logic"} 参见[类](classes.md)以及[类型转换](typecasts.md)。 diff --git a/docs/topics/classes.md b/docs/topics/classes.md index 92a9e0da6c0..bc333546dcc 100644 --- a/docs/topics/classes.md +++ b/docs/topics/classes.md @@ -16,8 +16,8 @@ class Empty ## 构造函数 -在 Kotlin 中的一个类可以有一个*主构造函数*以及一个或多个*次构造函数*。主构造函数是类头的一部分:它跟在类名与可选的类型参数后。 +在 Kotlin 中的一个类有一个*主构造函数*并可能有一个或多个*次构造函数*。主构造函数在类头中声明,它跟在类名与可选的类型参数后。 ```kotlin class Person constructor(firstName: String) { /*……*/ } @@ -29,8 +29,10 @@ class Person constructor(firstName: String) { /*……*/ } class Person(firstName: String) { /*……*/ } ``` -主构造函数不能包含任何的代码。初始化的代码可以放到以 `init` 关键字作为前缀的*初始化块(initializer blocks)*中。 +The primary constructor initializes a class instance and its properties in the class header. The class header can't contain +any runnable code. If you want to run some code during object creation, use _initializer blocks_ inside the class body. +Initializer blocks are declared with the `init` keyword followed by curly braces. Write any code that you want to run +within the curly braces. 在实例初始化期间,初始化块按照它们出现在类体中的顺序执行,与属性初始化器交织在一起: diff --git a/docs/topics/coding-conventions.md b/docs/topics/coding-conventions.md index af920e15d2e..9983be4880b 100644 --- a/docs/topics/coding-conventions.md +++ b/docs/topics/coding-conventions.md @@ -47,6 +47,52 @@ 文件的名称应该描述文件中代码的作用。因此,应避免在文件名中使用诸如 `Util` 之类的无意义词语。 +#### Multiplatform projects + +In multiplatform projects, files with top-level declarations in platform-specific source sets should have a suffix +associated with the name of the source set. For example: + +* **jvm**Main/kotlin/Platform.**jvm**.kt +* **android**Main/kotlin/Platform.**android**.kt +* **ios**Main/kotlin/Platform.**ios**.kt + +As for the common source set, files with top-level declarations should not have a suffix. For example, `commonMain/kotlin/Platform.kt`. + +##### Technical details {initial-collapse-state="collapsed"} + +We recommend following this file naming scheme in multiplatform projects due to JVM limitations: it doesn't allow +top-level members (functions, properties). + +To work around this, the Kotlin JVM compiler creates wrapper classes (so-called "file facades") that contain top-level +member declarations. File facades have an internal name derived from the file name. + +In turn, JVM doesn't allow several classes with the same fully qualified name (FQN). This might lead to situations when +a Kotlin project cannot be compiled to JVM: + +```none +root +|- commonMain/kotlin/myPackage/Platform.kt // contains 'fun count() { }' +|- jvmMain/kotlin/myPackage/Platform.kt // contains 'fun multiply() { }' +``` + +Here both `Platform.kt` files are in the same package, so the Kotlin JVM compiler produces two file facades, both of which +have FQN `myPackage.PlatformKt`. This produces the "Duplicate JVM classes" error. + +The simplest way to avoid that is renaming one of the files according to the guideline above. This naming scheme helps +avoid clashes while retaining code readability. + +> There are two cases when these recommendations may seem redundant, but we still advise to follow them: +> +> * Non-JVM platforms don't have issues with duplicating file facades. However, this naming scheme can help you keep +> file naming consistent. +> * On JVM, if source files don't have top-level declarations, the file facades aren't generated, and you won't face +> naming clashes. +> +> However, this naming scheme can help you avoid situations when a simple refactoring +> or an addition could include a top-level function and result in the same "Duplicate JVM classes" error. +> +{type="tip"} + ### 源文件组织 鼓励多个声明(类、顶级函数或者属性)放在同一个 Kotlin 源文件中, @@ -575,7 +621,7 @@ foo { ### Trailing commas -A trailing comma is a comma symbol after the last item of a series of elements: +A trailing comma is a comma symbol after the last item in a series of elements: ```kotlin class Person( @@ -967,11 +1013,11 @@ when (x) { ### 区间上循环 -使用 `until` 函数在一个开区间上循环: +使用 `..<` 操作符在一个左闭右开区间上循环: ```kotlin for (i in 0..n - 1) { /*……*/ } // 不良 -for (i in 0 until n) { /*……*/ } // 良好 +for (i in 0..意外更改返回类型) * 为所有公有成员提供 [KDoc](kotlin-doc.md) 注释,不需要任何新文档的覆盖成员除外 (以支持为该库生成文档) + +Learn more about best practices and ideas to consider when writing an API for your library in [library creators' guidelines](jvm-api-guidelines-introduction.md). diff --git a/docs/topics/compatibility-guide-19.md b/docs/topics/compatibility-guide-19.md new file mode 100644 index 00000000000..c2c40dc4bef --- /dev/null +++ b/docs/topics/compatibility-guide-19.md @@ -0,0 +1,554 @@ +[//]: # (title: Compatibility guide for Kotlin 1.9) + +_[Keeping the Language Modern](kotlin-evolution.md)_ and _[Comfortable Updates](kotlin-evolution.md)_ are among the fundamental principles in +Kotlin Language Design. The former says that constructs which obstruct language evolution should be removed, and the +latter says that this removal should be well-communicated beforehand to make code migration as smooth as possible. + +While most of the language changes were already announced through other channels, like update changelogs or compiler +warnings, this document summarizes them all, providing a complete reference for migration from Kotlin 1.8 to Kotlin 1.9. + +## Basic terms + +In this document we introduce several kinds of compatibility: + +- _source_: source-incompatible change stops code that used to compile fine (without errors or warnings) from compiling + anymore +- _binary_: two binary artifacts are said to be binary-compatible if interchanging them doesn't lead to loading or + linkage errors +- _behavioral_: a change is said to be behavioral-incompatible if the same program demonstrates different behavior + before and after applying the change + +Remember that those definitions are given only for pure Kotlin. Compatibility of Kotlin code from the other languages +perspective +(for example, from Java) is out of the scope of this document. + +## Language + + + +### Remove language version 1.3 + +> **Issue**: [KT-61111](https://youtrack.jetbrains.com/issue/KT-61111/Remove-language-version-1.3) +> +> **Component**: Core language +> +> **Incompatible change type**: source +> +> **Short summary**: Kotlin 1.9 introduces language version 1.9 and removes support for language version 1.3. +> +> **Deprecation cycle**: +> +> - 1.6.0: report a warning +> - 1.9.0: raise the warning to an error + +### Prohibit super constructor call when the super interface type is a function literal + +> **Issue**: [KT-46344](https://youtrack.jetbrains.com/issue/KT-46344) +> +> **Component**: Core language +> +> **Incompatible change type**: source +> +> **Short summary**: If an interface inherits from a function literal type, Kotlin 1.9 prohibits super constructor calls because no such constructor exists. +> +> **Deprecation cycle**: +> * 1.7.0: report a warning (or an error in progressive mode) +> * 1.9.0: raise the warning to an error + +### Prohibit cycles in annotation parameter types + +> **Issue**: [KT-47932](https://youtrack.jetbrains.com/issue/KT-47932) +> +> **Component**: Core language +> +> **Incompatible change type**: source +> +> **Short summary**: Kotlin 1.9 prohibits the type of an annotation being used as one of its parameter types, either directly or indirectly. This prevents cycles from being created. +> However, you are allowed to have parameter types that are an `Array` or a `vararg` of the annotation type. +> +> **Deprecation cycle**: +> * 1.7.0: report a warning (or an error in progressive mode) on cycles in types of annotation parameters +> * 1.9.0: raise the warning to an error, `-XXLanguage:-ProhibitCyclesInAnnotations` can be used to temporarily revert to pre-1.9 behavior + +### Prohibit use of `@ExtensionFunctionType` annotation on function types with no parameters + +> **Issue**: [KT-43527](https://youtrack.jetbrains.com/issue/KT-43527) +> +> **Component**: Core language +> +> **Incompatible change type**: source +> +> **Short summary**: Kotlin 1.9 prohibits using the `@ExtensionFunctionType` annotation on function types with no parameters, or on types that aren't function types. +> +> **Deprecation cycle**: +> * 1.7.0: report a warning for annotations on types that aren't function types, report an error for annotations on types that **are** function types +> * 1.9.0: raise the warning for function types to an error + +### Prohibit Java field type mismatch on assignment + +> **Issue**: [KT-48994](https://youtrack.jetbrains.com/issue/KT-48994) +> +> **Component**: Kotlin/JVM +> +> **Incompatible change type**: source +> +> **Short summary**: Kotlin 1.9 reports a compiler error if it detects that the type of a value assigned to a Java field doesn't match the Java field's projected type. +> +> **Deprecation cycle**: +> * 1.6.0: report a warning (or an error in the progressive mode) when a projected Java field type doesn't match the assigned value type +> * 1.9.0: raise the warning to an error, `-XXLanguage:-RefineTypeCheckingOnAssignmentsToJavaFields` can be used to temporarily revert to pre-1.9 behavior + +### No source code excerpts in platform-type nullability assertion exceptions + +> **Issue**: [KT-57570](https://youtrack.jetbrains.com/issue/KT-57570) +> +> **Component**: Kotlin/JVM +> +> **Incompatible change type**: behavioral +> +> **Short summary**: In Kotlin 1.9, exception messages for expression null checks do not include source code excerpts. Instead, the name of the method or field is displayed. +> If the expression is not a method or field, there is no additional information provided in the message. +> +> **Deprecation cycle**: +> * < 1.9.0: exception messages generated by expression null checks contain source code excerpts +> * 1.9.0: exception messages generated by expression null checks contain method or field names only, `-XXLanguage:-NoSourceCodeInNotNullAssertionExceptions` can be used to temporarily revert to pre-1.9 behavior + + +### Prohibit the delegation of super calls to an abstract superclass member + +> **Issues**: [KT-45508](https://youtrack.jetbrains.com/issue/KT-45508), [KT-49017](https://youtrack.jetbrains.com/issue/KT-49017), [KT-38078](https://youtrack.jetbrains.com/issue/KT-38078) +> +> **Component**: Core language +> +> **Incompatible change type**: source +> +> **Short summary**: Kotlin will report a compile error when an explicit or implicit super call is delegated +> to an _abstract_ member of the superclass, even if there's a default implementation in a super interface. +> +> **Deprecation cycle**: +> +> - 1.5.20: introduce a warning when non-abstract classes that do not override all abstract members are used +> - 1.7.0: report a warning if a super call, in fact, accesses an abstract member from a superclass +> - 1.7.0: report an error in all affected cases if the `-Xjvm-default=all` or `-Xjvm-default=all-compatibility` compatibility modes are enabled; +> report an error in the progressive mode +> - 1.8.0: report an error in cases of declaring a concrete class with a non-overridden abstract method from the superclass, and +> super calls of `Any` methods are overridden as abstract in the superclass +> - 1.9.0: report an error in all affected cases, including explicit super calls to an abstract method from the super class + +### Deprecate confusing grammar in `when-with-subject` + +> **Issue**: [KT-48385](https://youtrack.jetbrains.com/issue/KT-48385) +> +> **Component**: Core language +> +> **Incompatible change type**: source +> +> **Short summary**: Kotlin 1.6 deprecated several confusing grammar constructs in `when` condition expressions. +> +> **Deprecation cycle**: +> +> - 1.6.20: introduce a deprecation warning on the affected expressions +> - 1.8.0: raise this warning to an error, +> `-XXLanguage:-ProhibitConfusingSyntaxInWhenBranches` can be used to temporarily revert to the pre-1.8 behavior +> - \>= 2.1: repurpose some deprecated constructs for new language features + +### Prevent implicit coercions between different numeric types + +> **Issue**: [KT-48645](https://youtrack.jetbrains.com/issue/KT-48645) +> +> **Component**: Kotlin/JVM +> +> **Incompatible change type**: behavioral +> +> **Short summary**: Kotlin will avoid converting numeric values automatically to a primitive numeric type where only a downcast to that type is needed semantically. +> +> **Deprecation cycle**: +> +> - < 1.5.30: the old behavior in all affected cases +> - 1.5.30: fix the downcast behavior in generated property delegate accessors, +> `-Xuse-old-backend` can be used to temporarily revert to the pre-1.5.30 fix behavior +> - \>= 2.0: fix the downcast behavior in other affected cases + +### Prohibit upper bound violation in a generic type alias usage (a type parameter used in a generic type argument of a type argument of the aliased type) + +> **Issue**: [KT-54066](https://youtrack.jetbrains.com/issue/KT-54066) +> +> **Component**: Core language +> +> **Incompatible change type**: source +> +> **Short summary**: Kotlin will prohibit using a type alias with type arguments that violate the upper bound +> restrictions of the corresponding type parameters of the aliased type in case when the typealias type parameter is used as +> a generic type argument of a type argument of the aliased type, for example, `typealias Alias = Base>`. +> +> **Deprecation cycle**: +> +> - 1.8.0: report a warning when a generic typealias usage has type arguments violating upper bound constraints of +> the corresponding type parameters of the aliased type +> - 2.0.0: raise the warning to an error + +### Keep nullability when approximating local types in public signatures + +> **Issue**: [KT-53982](https://youtrack.jetbrains.com/issue/KT-53982) +> +> **Component**: Core language +> +> **Incompatible change type**: source, binary +> +> **Short summary**: when a local or anonymous type is returned from an expression-body function without an explicitly specified return type, +> Kotlin compiler infers (or approximates) the return type using the known supertype of that type. +> During this, the compiler can infer a non-nullable type where the null value could in fact be returned. +> +> **Deprecation cycle**: +> +> - 1.8.0: approximate flexible types by flexible supertypes +> - 1.8.0: report a warning when a declaration is inferred to have a non-nullable type that should be nullable, prompting users to specify the type explicitly +> - 2.0.0: approximate nullable types by nullable supertypes, +> `-XXLanguage:-KeepNullabilityWhenApproximatingLocalType` can be used to temporarily revert to the pre-2.0 behavior + +### Do not propagate deprecation through overrides + +> **Issue**: [KT-47902](https://youtrack.jetbrains.com/issue/KT-47902) +> +> **Component**: Core language +> +> **Incompatible change type**: source +> +> **Short summary**: Kotlin 1.9 will no longer propagate deprecation from a deprecated member in the superclass +> to its overriding member in the subclass, thus providing an explicit mechanism for deprecating a member of +> the superclass while leaving it non-deprecated in the subclass. +> +> **Deprecation cycle**: +> +> - 1.6.20: reporting a warning with the message of the future behavior change and a prompt to either suppress this warning +> or explicitly write a `@Deprecated` annotation on an override of a deprecated member +> - 1.9.0: stop propagating deprecation status to the overridden members. This change also takes effect immediately in the progressive mode + +### Prohibit using collection literals in annotation classes anywhere except their parameters declaration + +> **Issue**: [KT-39041](https://youtrack.jetbrains.com/issue/KT-39041) +> +> **Component**: Core language +> +> **Incompatible change type**: source +> +> **Short summary**: Kotlin allows using collection literals in a restricted way - for passing arrays to parameters of annotation classes +> or specifying default values for these parameters. +> However besides that, Kotlin allowed using collections literals anywhere else inside an annotation class, for example, +> in its nested object. Kotlin 1.9 will prohibit using collection literals in annotation classes anywhere except +> their parameters' default values. +> +> **Deprecation cycle**: +> +> - 1.7.0: report a warning (or an error in the progressive mode) on array literals in nested objects in annotation classes +> - 1.9.0: raise the warning to an error + +### Prohibit forward referencing of parameters in default value expressions + +> **Issue**: [KT-25694](https://youtrack.jetbrains.com/issue/KT-25694) +> +> **Component**: Core language +> +> **Incompatible change type**: source +> +> **Short summary**: Kotlin 1.9 will prohibit forward referencing of parameters in default value expressions +> of other parameters. This ensures that by the time the parameter is accessed in a default value expression, +> it would already have a value either passed to the function or initialized by its own default value expression. +> +> **Deprecation cycle**: +> +> - 1.7.0: report a warning (or an error in the progressive mode) when a parameter with default value is references in default value of another parameter that comes before it +> - 1.9.0: raise the warning to an error, +> `-XXLanguage:-ProhibitIllegalValueParameterUsageInDefaultArguments` can be used to temporarily revert to the pre-1.9 behavior + +### Prohibit extension calls on inline functional parameters + +> **Issue**: [KT-52502](https://youtrack.jetbrains.com/issue/KT-52502) +> +> **Component**: Core language +> +> **Incompatible change type**: source +> +> **Short summary**: while Kotlin allowed passing an inline functional parameter to another inline function +> as a receiver, it always resulted in compiler exceptions when compiling such code. +> Kotlin 1.9 will prohibit this, thus reporting an error instead of crashing the compiler. +> +> **Deprecation cycle**: +> +> - 1.7.20: report a warning (or an error in the progressive mode) for inline extension calls on inline functional parameters +> - 1.9.0: raise the warning to an error + +### Prohibit calls to infix functions named `suspend` with an anonymous function argument + +> **Issue**: [KT-49264](https://youtrack.jetbrains.com/issue/KT-49264) +> +> **Component**: Core language +> +> **Incompatible change type**: source +> +> **Short summary**: Kotlin 1.9 will no longer allow calling infix functions named `suspend` that have a single argument of +> a functional type passed as an anonymous function literal. +> +> **Deprecation cycle**: +> +> - 1.7.20: report a warning on suspend infix calls with an anonymous function literal +> - 1.9.0: raise the warning to an error, +> `-XXLanguage:-ModifierNonBuiltinSuspendFunError` can be used to temporarily revert to the pre-1.9 behavior +> - TODO: Change how the `suspend fun` token sequence is interpreted by the parser + +### Prohibit using captured type parameters in inner classes against their variance + +> **Issue**: [KT-50947](https://youtrack.jetbrains.com/issue/KT-50947) +> +> **Component**: Core language +> +> **Incompatible change type**: source +> +> **Short summary**: Kotlin 1.9 will prohibit using type parameters of an outer class having `in` or `out` variance in +> an inner class of that class in positions violating that type parameters' declared variance. +> +> **Deprecation cycle**: +> +> - 1.7.0: report a warning (or an error in the progressive mode) when an outer class' type parameter usage position violates the variance rules of that parameter +> - 1.9.0: raise the warning to an error, +> `-XXLanguage:-ReportTypeVarianceConflictOnQualifierArguments` can be used to temporarily revert to the pre-1.9 behavior + +### Prohibit recursive call of a function without explicit return type in compound assignment operators + +> **Issue**: [KT-48546](https://youtrack.jetbrains.com/issue/KT-48546) +> +> **Component**: Core language +> +> **Incompatible change type**: source +> +> **Short summary**: Kotlin 1.9 will prohibit calling a function without explicitly specified return type in an argument +> of a compound assignment operator inside that function's body, as it currently does in other expressions inside the body of that function. +> +> **Deprecation cycle**: +> +> - 1.7.0: report a warning (or an error in the progressive mode) when a function without explicitly specified return type is +> called recursively in that function's body in a compound assignment operator argument +> - 1.9.0: raise the warning to an error + +### Prohibit unsound calls with expected `@NotNull T` and given Kotlin generic parameter with nullable bound + +> **Issue**: [KT-36770](https://youtrack.jetbrains.com/issue/KT-36770) +> +> **Component**: Kotlin/JVM +> +> **Incompatible change type**: source +> +> **Short summary**: Kotlin 1.9 will prohibit method calls where a value of a potentially nullable generic type is passed +> for a `@NotNull`-annotated parameter of a Java method. +> +> **Deprecation cycle**: +> +> - 1.5.20: report a warning when an unconstrained generic type parameter is passed where a non-nullable type is expected +> - 1.9.0: report a type mismatch error instead of the warning above, +> `-XXLanguage:-ProhibitUsingNullableTypeParameterAgainstNotNullAnnotated` can be used to temporarily revert to the pre-1.8 behavior + +### Prohibit access to members of a companion of an enum class from entry initializers of this enum + +> **Issue**: [KT-49110](https://youtrack.jetbrains.com/issue/KT-49110) +> +> **Component**: Core language +> +> **Incompatible change type**: source +> +> **Short summary**: Kotlin 1.9 will prohibit all kinds of access to the companion object of an enum from an enum entry initializer. +> +> **Deprecation cycle**: +> +> - 1.6.20: report a warning (or an error in the progressive mode) on such companion member access +> - 1.9.0: raise the warning to an error, +> `-XXLanguage:-ProhibitAccessToEnumCompanionMembersInEnumConstructorCall` can be used to temporarily revert to the pre-1.8 behavior + +### Deprecate and remove Enum.declaringClass synthetic property + +> **Issue**: [KT-49653](https://youtrack.jetbrains.com/issue/KT-49653) +> +> **Component**: Kotlin/JVM +> +> **Incompatible change type**: source +> +> **Short summary**: Kotlin allowed using the synthetic property `declaringClass` on `Enum` values produced from +> the method `getDeclaringClass()` of the underlying Java class `java.lang.Enum` even though this method is not available +> for Kotlin `Enum` type. Kotlin 1.9 will prohibit using this property, proposing to migrate to the extension property +> `declaringJavaClass` instead. +> +> **Deprecation cycle**: +> +> - 1.7.0: report a warning (or an error in the progressive mode) on `declaringClass` property usages, +> propose the migration to `declaringJavaClass` extension +> - 1.9.0: raise the warning to an error, +> `-XXLanguage:-ProhibitEnumDeclaringClass` can be used to temporarily revert to the pre-1.9 behavior +> - 2.0.0: remove `declaringClass` synthetic property + +### Deprecate enable and compatibility modes of the compiler option -Xjvm-default + +> **Issues**: [KT-46329](https://youtrack.jetbrains.com/issue/KT-46329), [KT-54746](https://youtrack.jetbrains.com/issue/KT-54746) +> +> **Component**: Kotlin/JVM +> +> **Incompatible change type**: source +> +> **Short summary**: Kotlin 1.9 prohibits using the `enable` and `compatibility` modes of the `-Xjvm-default` compiler option. +> +> **Deprecation cycle**: +> +> - 1.6.20: introduce a warning on the `enable` and `compatibility` modes of the `-Xjvm-default` compiler option +> - 1.9.0: raise this warning to an error + +### Prohibit implicit inferring a type variable into an upper bound in the builder inference context + +> **Issue**: [KT-47986](https://youtrack.jetbrains.com/issue/KT-47986) +> +> **Component**: Core language +> +> **Incompatible change type**: source +> +> **Short summary**: Kotlin 2.0 will prohibit inferring a type variable into the corresponding type parameter's upper bound +> in the absence of any use-site type information in the scope of builder inference lambda functions, the same way as it does currently in other contexts. +> +> **Deprecation cycle**: +> +> - 1.7.20: report a warning (or an error in the progressive mode) when a type parameter is inferred into declared upper bounds in the absence of use-site type information +> - 2.0.0: raise the warning to an error + +## Standard library + +### Warn about potential overload resolution change when Range/Progression starts implementing Collection + +> **Issue**: [KT-49276](https://youtrack.jetbrains.com/issue/KT-49276) +> +> **Component**: Core language / kotlin-stdlib +> +> **Incompatible change type**: source +> +> **Short summary**: it is planned to implement the `Collection` interface in the standard progressions and concrete ranges +> inherited from them in Kotlin 1.9. This could make a different overload selected in the overload resolution if there +> are two overloads of some method, one accepting an element and another accepting a collection. +> Kotlin will make this situation visible by reporting a warning or an error when such overloaded method is called +> with a range or progression argument. +> +> **Deprecation cycle**: +> +> - 1.6.20: report a warning when an overloaded method is called with the standard progression or its range inheritor as an argument +> if implementing the `Collection` interface by this progression/range leads to another overload being selected in this call in future +> - 1.8.0: raise this warning to an error +> - 2.1.0: stop reporting the error, implement `Collection` interface in progressions thus changing +> the overload resolution result in the affected cases + +### Migrate declarations from `kotlin.dom` and `kotlin.browser` packages to `kotlinx.*` + +> **Issue**: [KT-39330](https://youtrack.jetbrains.com/issue/KT-39330) +> +> **Component**: kotlin-stdlib (JS) +> +> **Incompatible change type**: source +> +> **Short summary**: declarations from the `kotlin.dom` and `kotlin.browser` packages are moved to the corresponding `kotlinx.*` packages to prepare for extracting them from stdlib. +> +> **Deprecation cycle**: +> +> - 1.4.0: introduce the replacement API in `kotlinx.dom` and `kotlinx.browser` packages +> - 1.4.0: deprecate the API in `kotlin.dom` and `kotlin.browser` packages and propose the new API above as a replacement +> - 1.6.0: raise the deprecation level to an error +> - 1.8.20: remove the deprecated functions from stdlib for JS-IR target +> - \>= 2.0: move the API in kotlinx.* packages to a separate library + +### Deprecate some JS-only API + +> **Issue**: [KT-48587](https://youtrack.jetbrains.com/issue/KT-48587) +> +> **Component**: kotlin-stdlib (JS) +> +> **Incompatible change type**: source +> +> **Short summary**: a number of JS-only functions in stdlib are deprecated for removal. They include: `String.concat(String)`, `String.match(regex: String)`, `String.matches(regex: String)`, and the `sort` functions on arrays taking a comparison function, for example, `Array.sort(comparison: (a: T, b: T) -> Int)`. +> +> **Deprecation cycle**: +> +> - 1.6.0: deprecate the affected functions with a warning +> - 1.9.0: raise the deprecation level to an error +> - \>=2.0: remove the deprecated functions from the public API + +## Tools + +### Remove enableEndorsedLibs flag from Gradle setup + +> **Issue**: [KT-54098](https://youtrack.jetbrains.com/issue/KT-54098) +> +> **Component**: Gradle +> +> **Incompatible change type**: source +> +> **Short summary**: the `enableEndorsedLibs` flag is no longer supported in Gradle setup. +> +> **Deprecation cycle**: +> +> - < 1.9.0: `enableEndorsedLibs` flag is supported in Gradle setup +> - 1.9.0: `enableEndorsedLibs` flag is **not** supported in Gradle setup + +### Remove Gradle conventions + +> **Issue**: [KT-52976](https://youtrack.jetbrains.com/issue/KT-52976) +> +> **Component**: Gradle +> +> **Incompatible change type**: source +> +> **Short summary**: Gradle conventions were deprecated in Gradle 7.1 and have been removed in Gradle 8. +> +> **Deprecation cycle**: +> +> - 1.7.20: Gradle conventions deprecated +> - 1.9.0: Gradle conventions removed + +### Remove classpath property of KotlinCompile task + +> **Issue**: [KT-53748](https://youtrack.jetbrains.com/issue/KT-53748) +> +> **Component**: Gradle +> +> **Incompatible change type**: source +> +> **Short summary**: the `classpath` property of the `KotlinCompile` task is removed. +> +> **Deprecation cycle**: +> +> - 1.7.0: the `classpath` property is deprecated +> - 1.8.0: raise the deprecation level to an error +> - 1.9.0: remove the deprecated functions from the public API + +### Deprecate kotlin.internal.single.build.metrics.file property + +> **Issue**: [KT-53357](https://youtrack.jetbrains.com/issue/KT-53357) +> +> **Component**: Gradle +> +> **Incompatible change type**: source +> +> **Short summary**: deprecate the `kotlin.internal.single.build.metrics.file` property used to define a single file for +> build reports. +> Use the property `kotlin.build.report.single_file` instead with `kotlin.build.report.output=single_file`. +> +> **Deprecation cycle:** +> +> * 1.8.0: raise the deprecation level to a warning +> * \>= 1.9: delete the property diff --git a/docs/topics/compiler-reference.md b/docs/topics/compiler-reference.md index a464fe5d71d..028a19c4d7b 100644 --- a/docs/topics/compiler-reference.md +++ b/docs/topics/compiler-reference.md @@ -162,7 +162,7 @@ Use a custom JDK home directory to include into the classpath if it differs from Specify the target version of the generated JVM bytecode. Limit the API of the JDK in the classpath to the specified Java version. Automatically sets [`-jvm-target version`](#jvm-target-version). -Possible values are `1.8`, `9`, `10`, ..., `19`. The default value is `%defaultJvmTargetVersion%`. +Possible values are `1.8`, `9`, `10`, ..., `20`. The default value is `%defaultJvmTargetVersion%`. > This option is [not guaranteed](https://youtrack.jetbrains.com/issue/KT-29974) to be effective for each JDK distribution. > @@ -170,7 +170,7 @@ Possible values are `1.8`, `9`, `10`, ..., `19`. The default value is `%defaultJ ### -jvm-target _version_ -Specify the target version of the generated JVM bytecode. Possible values are `1.8`, `9`, `10`, ..., `19`. +Specify the target version of the generated JVM bytecode. Possible values are `1.8`, `9`, `10`, ..., `20`. The default value is `%defaultJvmTargetVersion%`. ### -java-parameters diff --git a/docs/topics/components-stability.md b/docs/topics/components-stability.md index 16fbb08bea9..86514964641 100644 --- a/docs/topics/components-stability.md +++ b/docs/topics/components-stability.md @@ -71,7 +71,7 @@ We make sure to document precisely which subcomponents are not stable. We also d | Kotlin/JS(基于 IR) | 已稳定 | 1.8 | | | Kotlin/Native 运行时 | Beta | 1.3 | | | Kotlin/Native 新版内存管理器 | Beta | 1.7.20 | | -| klib 二进制 | Alpha | 1.4 | | +| klib 二进制 | Beta | 1.9.0 | | | Kotlin 多平台 | Beta | 1.7.20 | | | Kotlin/Native 与 C 语言及 Objective C 互操作 | Beta | 1.3 | | | CocoaPods 集成 | Beta | 1.3 | | diff --git a/docs/topics/constructing-collections.md b/docs/topics/constructing-collections.md index 2565d1eb3f2..ad48b5a49e6 100644 --- a/docs/topics/constructing-collections.md +++ b/docs/topics/constructing-collections.md @@ -175,7 +175,7 @@ fun main() { ``` {kotlin-runnable="true" kotlin-min-compiler-version="1.3"} -[映射](collection-transformations.md#映射)生成转换结果列表: +[映射](collection-transformations.md#映射)由转换结果生成列表: ```kotlin fun main() { diff --git a/docs/topics/contribute.md b/docs/topics/contribute.md index 8a7378d31d8..cbe125461a5 100644 --- a/docs/topics/contribute.md +++ b/docs/topics/contribute.md @@ -140,7 +140,7 @@ Kotlin 编程语言中文站翻译贡献者如下(排名不分先后): * [easyfirst](https://github.com/easyfirst) * [Guolianxing](https://github.com/Guolianxing) * [BobEve](https://github.com/BobEve) -* [7forz ](https://github.com/7forz) +* [7forz](https://github.com/7forz) * [Andy1245-dot](https://github.com/Andy1245-dot) * [Aaro0n](https://github.com/Aaro0n) * [plain-dev](https://github.com/plain-dev) @@ -155,3 +155,5 @@ Kotlin 编程语言中文站翻译贡献者如下(排名不分先后): * [oncealong](https://github.com/oncealong) * [gtn1024](https://github.com/gtn1024) * [jixiaoyong](https://github.com/jixiaoyong) +* [shisheng1998](https://github.com/shisheng1998) +* [Smileslime47](https://github.com/Smileslime47) diff --git a/docs/topics/control-flow.md b/docs/topics/control-flow.md index 9436a532c22..76ecf7e6f06 100644 --- a/docs/topics/control-flow.md +++ b/docs/topics/control-flow.md @@ -7,30 +7,30 @@ ```kotlin fun main() { - val a = 2 - val b = 3 - - //sampleStart - var max = a - if (a < b) max = b - - // With else - if (a > b) { - max = a - } else { - max = b - } + val a = 2 + val b = 3 + + //sampleStart + var max = a + if (a < b) max = b + + // With else + if (a > b) { + max = a + } else { + max = b + } // 作为表达式 max = if (a > b) a else b - // You can also use `else if` in expressions: - val maxLimit = 1 - val maxOrLimit = if (maxLimit > a) maxLimit else if (a > b) a else b + // You can also use `else if` in expressions: + val maxLimit = 1 + val maxOrLimit = if (maxLimit > a) maxLimit else if (a > b) a else b - //sampleEnd - println("max is $max") - println("maxOrLimit is $maxOrLimit") + //sampleEnd + println("max is $max") + println("maxOrLimit is $maxOrLimit") } ``` {kotlin-runnable="true" kotlin-min-compiler-version="1.3" id="if-else-if-kotlin"} @@ -79,7 +79,7 @@ when (x) { ```kotlin enum class Bit { - ZERO, ONE + ZERO, ONE } val numericValue = when (getRandomBit()) { @@ -96,7 +96,7 @@ or [`sealed`](sealed-classes.md) type, or their nullable counterparts. ```kotlin enum class Color { - RED, GREEN, BLUE + RED, GREEN, BLUE } when (getColor()) { @@ -107,8 +107,8 @@ when (getColor()) { } when (getColor()) { - Color.RED -> println("red") // no branches for GREEN and BLUE - else -> println("not red") // 'else' is required + Color.RED -> println("red") // no branches for GREEN and BLUE + else -> println("not red") // 'else' is required } ``` @@ -268,4 +268,3 @@ do { ## 循环中的 break 与 continue 在循环中 Kotlin 支持传统的 `break` 与 `continue` 操作符。参见[返回与跳转](returns.md)。 - diff --git a/docs/topics/cross-platform-frameworks.md b/docs/topics/cross-platform-frameworks.md index 3850c61bd16..5c8a23b651f 100644 --- a/docs/topics/cross-platform-frameworks.md +++ b/docs/topics/cross-platform-frameworks.md @@ -64,7 +64,7 @@ Kotlin Multiplatform Mobile is an SDK developed by JetBrains for creating Androi **Key features:** -* You can easily start using Multiplatform Mobile in existing projects. +* You can easily start using Kotlin Multiplatform Mobile in existing projects. * Kotlin Multiplatform Mobile provides you with full access over the user interface. You can utilize the latest UI frameworks, such as SwiftUI and Jetpack Compose. * Developers have easy access to the Android and iOS SDKs without any restrictions. @@ -166,5 +166,3 @@ The volume and quality of available learning resources about a framework can als ## Key takeaways Without considering these factors, it's difficult to choose the framework for cross-platform mobile development that will best meet your specific needs. Take a closer look at your future application requirements and weigh them against capabilities of various frameworks. Doing so will allow you to find the right cross-platform solution to help you deliver high-quality apps. - - diff --git a/docs/topics/cross-platform-mobile-development.md b/docs/topics/cross-platform-mobile-development.md index 52e8b6341f1..b063ca546e1 100644 --- a/docs/topics/cross-platform-mobile-development.md +++ b/docs/topics/cross-platform-mobile-development.md @@ -104,7 +104,7 @@ In our [Kotlin Multiplatform survey from Q1-Q2 2021](https://blog.jetbrains.com/ ![How are users satisfied with the quality of their app after Kotlin Multiplatform Mobile adoption?](survey-results-q1-q2-21.png){width=700} -Another concern is the inability to seamlessly support the native features of applications. Nevertheless, if you're building a multiplatform app that needs to access platform-specific APIs, you can use Kotlin's [expected and actual declarations](https://kotlinlang.org/docs/multiplatform-connect-to-apis.html). They allow you to define in common code that you "expect" to be able to call the same function across multiple platforms and provide the "actual" implementations, which can interact with any platform-specific libraries thanks to Kotlin interoperability with Java and Objective-C/Swift. +Another concern is the inability to seamlessly support the native features of applications. Nevertheless, if you're building a multiplatform app that needs to access platform-specific APIs, you can use Kotlin's [expected and actual declarations](multiplatform-connect-to-apis.md). They allow you to define in common code that you "expect" to be able to call the same function across multiple platforms and provide the "actual" implementations, which can interact with any platform-specific libraries thanks to Kotlin interoperability with Java and Objective-C/Swift. These issues raise the question of whether the end-user will notice a difference between native and cross-platform apps. @@ -149,7 +149,7 @@ Kotlin Multiplatform Mobile is an SDK for cross-platform mobile development prov * Full control over the UI, along with the ability to use the latest UI frameworks, such as SwiftUI and Jetpack Compose. * Easy access to Android and iOS SDKs without any restrictions. -> Share the logic of your iOS and Android apps. Get started with [Kotlin Multiplatform Mobile](https://kotlinlang.org/docs/multiplatform-mobile-getting-started.html). +> Share the logic of your iOS and Android apps. Get started with [Kotlin Multiplatform Mobile](multiplatform-mobile-getting-started.md). > {type="note"} diff --git a/docs/topics/data-classes.md b/docs/topics/data-classes.md index 01d66aa9dc3..b96b5162142 100644 --- a/docs/topics/data-classes.md +++ b/docs/topics/data-classes.md @@ -1,8 +1,8 @@ [//]: # (title: 数据类) -创建一些只保存数据的类是件寻常的事。 -在这些类中,一些标准功能以及一些工具函数往往是由数据机械推导而来的。在 Kotlin 中,这叫做 _数据类_ 并以 `data` 标记: +Data classes in Kotlin are classes whose main purpose is to hold data. Data classes come automatically with additional +member functions that allow you to print an instance to readable output, compare instances, copy instances, and more. +Data classes are marked with `data`: ```kotlin data class User(val name: String, val age: Int) @@ -10,10 +10,10 @@ data class User(val name: String, val age: Int) 编译器自动从主构造函数中声明的所有属性导出以下成员: -* `equals()`/`hashCode()` 对 -* `toString()` 格式是 `"User(name=John, age=42)"` -* [`componentN()` 函数](destructuring-declarations.md) 按声明顺序对应于所有属性。 -* `copy()` 函数(见下文) +* `.equals()`/`.hashCode()` 对 +* `.toString()` 格式是 `"User(name=John, age=42)"` +* [`.componentN()` 函数](destructuring-declarations.md) 按声明顺序对应于所有属性。 +* `.copy()` 函数(见下文) 为了确保生成的代码的一致性以及有意义的行为,数据类必须满足以下要求: @@ -23,13 +23,13 @@ data class User(val name: String, val age: Int) 此外,数据类成员的生成遵循关于成员继承的这些规则: -* 如果在数据类体中有显式实现 `equals()`、 `hashCode()` 或者 `toString()`,或者这些函数在父类中有 +* 如果在数据类体中有显式实现 `.equals()`、 `.hashCode()` 或者 `.toString()`,或者这些函数在父类中有 `final` 实现,那么不会生成这些函数,而会使用现有函数。 -* 如果超类型具有 `open` 的 `componentN()` 函数并且返回兼容的类型, +* 如果超类型具有 `open` 的 `.componentN()` 函数并且返回兼容的类型, 那么会为数据类生成相应的函数,并覆盖超类的实现。如果超类型的这些函数由于签名不兼容或者是 final 而导致无法覆盖,那么会报错。 -* 不允许为 `componentN()` 以及 `copy()` 函数提供显式实现。 +* 不允许为 `.componentN()` 以及 `.copy()` 函数提供显式实现。 数据类可以扩展其他类(示例请参见[密封类](sealed-classes.md))。 @@ -53,9 +53,11 @@ data class Person(val name: String) { } ``` -在 `toString()`、 `equals()`、 `hashCode()` 以及 `copy()` 的实现中只会用到 `name` 属性, -并且只有一个 component 函数 `component1()`。虽然两个 `Person` 对象可以有不同的年龄, -但它们会视为相等。 +In this example, only the `name` property can be used inside the `.toString()`, `.equals()`, `.hashCode()`, and `.copy()` implementations, +and there is only one component function `.component1()`. The `age` property can't be used inside the `.toString()`, +`.equals()`, `.hashCode()`, and `.copy()` implementations because it's declared inside the class body. If two `Person` +objects have different ages but the same `name`, then they are treated as equal. This is because the `.equals()` function +can only check for equality of the `name` property. For example: ```kotlin data class Person(val name: String) { @@ -67,17 +69,23 @@ fun main() { val person2 = Person("John") person1.age = 10 person2.age = 20 -//sampleEnd + println("person1 == person2: ${person1 == person2}") + // person1 == person2: true + println("person1 with age ${person1.age}: ${person1}") + // person1 with age 10: Person(name=John) + println("person2 with age ${person2.age}: ${person2}") + // person2 with age 20: Person(name=John) +//sampleEnd } ``` {kotlin-runnable="true" kotlin-min-compiler-version="1.3"} ## 复制 -Use the `copy()` function to copy an object, allowing you to alter _some_ of its properties while keeping the rest unchanged. The implementation of this function for the `User` class above would be as follows: +Use the `.copy()` function to copy an object, allowing you to alter _some_ of its properties while keeping the rest unchanged. The implementation of this function for the `User` class above would be as follows: ```kotlin fun copy(name: String = this.name, age: Int = this.age) = User(name, age) @@ -97,7 +105,8 @@ val olderJack = jack.copy(age = 2) ```kotlin val jane = User("Jane", 35) val (name, age) = jane -println("$name, $age years of age") // 输出 "Jane, 35 years of age" +println("$name, $age years of age") +// Jane, 35 years of age ``` ## 标准数据类 diff --git a/docs/topics/data-science-overview.md b/docs/topics/data-science-overview.md index 2be54282b30..f2818da6bbf 100644 --- a/docs/topics/data-science-overview.md +++ b/docs/topics/data-science-overview.md @@ -14,6 +14,15 @@ Kotlin 可能是处理数据的绝佳选择: Kotlin 与这些工具集成在一起,可以帮助探索数据、与同事共享发现或建立数据科学和机器学习技能。 +### Kotlin Notebook + +The [Kotlin Notebook](https://plugins.jetbrains.com/plugin/16340-kotlin-notebook) is a plugin for IntelliJ IDEA that +allows you to create notebooks in Kotlin. It leverages the [Kotlin kernel](#jupyter-kotlin-内核) for executing the +cells and harnesses the powerful Kotlin IDE support to offer real-time code insights. It is now the preferred method +for working with Kotlin notebooks. Be sure to check out our [blog post](https://blog.jetbrains.com/kotlin/2023/07/introducing-kotlin-notebook/) about it. + +![Kotlin Notebook](kotlin-notebook.png){width=800} + ### Jupyter Kotlin 内核 Jupyter Notebook 是一个开源 Web 应用程序, diff --git a/docs/topics/eap.md b/docs/topics/eap.md index dbaf091297d..292a95bd434 100644 --- a/docs/topics/eap.md +++ b/docs/topics/eap.md @@ -34,4 +34,38 @@ check [our instructions on how to configure your build to support this version]( ## Build details -_No preview versions are currently available._ + _No preview versions are currently available._ + + \ No newline at end of file diff --git a/docs/topics/enum-classes.md b/docs/topics/enum-classes.md index 49918a7e7a0..7ae6778a107 100644 --- a/docs/topics/enum-classes.md +++ b/docs/topics/enum-classes.md @@ -119,26 +119,20 @@ printAllValues() // 输出 RED, GREEN, BLUE > > {type="tip"} -In Kotlin 1.8.20, the `entries` property is introduced as a future replacement for the `values()` function. The +In Kotlin 1.9.0, the `entries` property is introduced as a replacement for the `values()` function. The `entries` property returns a pre-allocated immutable list of your enum constants. This is particularly useful when you -are working with [collections](collections-overview.md) and can you help you avoid [performance issues](https://github.com/Kotlin/KEEP/blob/master/proposals/enum-entries.md#examples-of-performance-issues). +are working with [collections](collections-overview.md) and can help you avoid [performance issues](https://github.com/Kotlin/KEEP/blob/master/proposals/enum-entries.md#examples-of-performance-issues). For example: ```kotlin enum class RGB { RED, GREEN, BLUE } -@OptIn(ExperimentalStdlibApi::class) fun main() { for (color in RGB.entries) println(color.toString()) // prints RED, GREEN, BLUE } ``` -> The `entries` property is Experimental. To use it, opt in with `@OptIn(ExperimentalStdlibApi)`, and -> [set the language version to 1.9](gradle-compiler-options.md#jvm-与-js-的公共属性). -> -{type="warning"} - 每个枚举常量也都具有这两个属性:[`name`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-enum/name.html) 与 [`ordinal`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-enum/ordinal.html), 用于在枚举类声明中获取其名称与(自 0 起的)位置: diff --git a/docs/topics/extensions.md b/docs/topics/extensions.md index ab6ce9acc4c..7059a881947 100644 --- a/docs/topics/extensions.md +++ b/docs/topics/extensions.md @@ -48,9 +48,8 @@ For more information about generics, 参见[泛型函数](generics.md)。 扩展不能真正的修改他们所扩展的类。通过定义一个扩展,并没有在一个类中插入新成员, 只不过是可以通过该类型的变量用点表达式去调用这个新函数。 -扩展函数是*静态*分发的,即他们不是根据接收者类型的虚方法。 -调用的扩展函数是由函数调用所在的表达式的类型来决定的, -而不是由表达式运行时求值结果决定的。例如: +Extension functions are dispatched _statically_. So which extension function is called is already known at compile time +based on the receiver type. For example: ```kotlin fun main() { @@ -75,8 +74,7 @@ fun main() { -->参数 `s` 的声明类型,该类型是 `Shape` 类。 如果一个类定义有一个成员函数与一个扩展函数,而这两个函数又有相同的接收者类型、 -相同的名字,并且都适用给定的参数,这种情况*总是取成员函数*。 -例如: +相同的名字,并且都适用给定的参数,这种情况*总是取成员函数*。 例如: ```kotlin fun main() { @@ -115,9 +113,10 @@ fun main() { ## 可空接收者 注意可以为可空的接收者类型定义扩展。这样的扩展可以在对象变量上调用, -即使其值为 null,并且可以在函数体内检测 `this == null`。 +即使其值为 null。 If the receiver is `null`, then `this` is also `null`. So when defining an extension with a +nullable receiver type, we recommend performing a `this == null` check inside the function body to avoid compiler errors. -这样,就可以在没有检测 null 的时候调用 Kotlin 中的toString():检测发生在扩展函数的内部: +可以在没有检测 null 的时候调用 Kotlin 中的 `toString()`:检测已发生在扩展函数的内部: ```kotlin fun Any?.toString(): String { diff --git a/docs/topics/faq.md b/docs/topics/faq.md index ac1e7e6c854..0bef897a213 100644 --- a/docs/topics/faq.md +++ b/docs/topics/faq.md @@ -2,13 +2,14 @@ ### Kotlin 是什么? -Kotlin 是一门面向 JVM、Android、JavaScript 以及原生平台的开源静态类型编程语言。 +Kotlin 是一门面向 JVM、Android、JavaScript、Wasm 以及原生平台的开源静态类型编程语言。 它是由 [JetBrains](https://www.jetbrains.com) 开发的。该项目开始于 2010 年并且很早就已开源。 第一个官方 1.0 版发布于 2016 年 2 月。 ### Kotlin 的当前版本是多少? -目前发布的版本是 %kotlinVersion%,发布于 %kotlinReleaseDate%。 +目前发布的版本是 %kotlinVersion%,发布于 %kotlinReleaseDate%。 +You can find more information [on GitHub](https://github.com/jetbrains/kotlin). ### Kotlin 是免费的吗? @@ -54,10 +55,7 @@ vert.x 或 JSF。另外还有一些 Kotlin 写的特定框架,例如 [Ktor](ht ### 我可以用 Kotlin 进行 web 开发吗? -可以。除了用于后端 Web,你还可以使用 Kotlin/JS 用于客户端 Web。Kotlin 可以使用 -[DefinitelyTyped](https://definitelytyped.org) 中的定义来获取常见 JavaScript 库的静态类型版,并且它与现有的模块系统(如 AMD 和 CommonJS)兼容。 -更多信息请查看[客户端开发中的资源](js-overview.md)。 +可以。除了用于后端 Web,你还可以使用 Kotlin/Wasm 用于客户端 Web。 Learn how to [get started with Kotlin/Wasm](wasm-get-started.md). ### 我可以用 Kotlin 进行桌面开发吗? @@ -67,13 +65,15 @@ vert.x 或 JSF。另外还有一些 Kotlin 写的特定框架,例如 [Ktor](ht ### 我可以用 Kotlin 进行原生开发吗? 可以。Kotlin/Native 是 Kotlin 项目的一部分。它将 Kotlin 编译成无需虚拟机(VM)即可运行的原生代码。 -仍处于 beta 测试阶段,不过已经可以在主流的桌面与移动端平台甚至某些物联网(IoT)设备上试用。 +可以在主流的桌面与移动端平台甚至某些物联网(IoT)设备上试用。 更多详细信息请查阅 [Kotlin/Native 文档](native-overview.md)。 ### 哪些 IDE 支持 Kotlin? -Kotlin has full out-of-the-box support in [IntelliJ IDEA](https://www.jetbrains.com/idea/download/) and -[Android Studio](https://developer.android.com/kotlin/get-started) with an official Kotlin plugin developed by JetBrains. +Kotlin has full out-of-the-box support in [IntelliJ IDEA](https://www.jetbrains.com/idea/download/), +[Android Studio](https://developer.android.com/kotlin/get-started), and [JetBrains Fleet](https://www.jetbrains.com/help/fleet/getting-started-with-kotlin-in-fleet.html) +with an official Kotlin plugin developed by JetBrains. + Other IDEs and source editors, such as Eclipse, Visual Studio Code, and Atom, have Kotlin community-supported plugins. You can also try [Kotlin Playground](https://play.kotlinlang.org) for writing, running, and sharing @@ -100,7 +100,7 @@ JavaScript 的构建工具。 Kotlin 会让你选择用于执行的 JVM 版本。默认情况下,Kotlin/JVM 编译器会生成兼容 Java 8 的字节码。 如果要利用 Java 新版本中提供的优化功能,可以将目标 Java -版本显式指定为 9 到 19。 请注意,这种情况下生成的字节码可能无法在较低版本中运行。 +版本显式指定为 9 到 20。 请注意,这种情况下生成的字节码可能无法在较低版本中运行。 Starting with [Kotlin 1.5](whatsnew15.md#新的默认-jvm-目标-1-8), the compiler does not support producing bytecode compatible with Java versions below 8. ### Kotlin 难吗? @@ -120,7 +120,7 @@ Kotlin,分别通过博文、Github 版本库或者演讲宣布,包括 ### 谁开发 Kotlin? -Kotlin 主要由 JetBrains 的一个工程师团队开发(目前团队规模为 100+)。其首席语言设计师是 +Kotlin 主要由 [JetBrains 的一个工程师团队开发(目前团队规模为 100+)](https://www.jetbrains.com/)。其首席语言设计师是 [Roman Elizarov](https://twitter.com/relizarov)。除了核心团队,GitHub 上还有 250 多个外部贡献者。 ### 在哪里可以了解关于 Kotlin 更多? @@ -135,7 +135,7 @@ on the [Books](books.md) page. For more books, see the community-maintained list ### Kotlin 有没有在线课程? -You can learn all the Kotlin essentials while creating working applications with the [Kotlin Basics track](https://hyperskill.org/join/fromdocstoJetSalesStat?redirect=true&next=/tracks/18) on JetBrains Academy. +You can learn all the Kotlin essentials while creating working applications with the [Kotlin Core track](https://hyperskill.org/tracks?category=4&utm_source=jbkotlin_hs&utm_medium=referral&utm_campaign=kotlinlang-docs&utm_content=button_1&utm_term=22.03.23) by JetBrains Academy. A few other courses you can take: * [Pluralsight Course: Getting Started with Kotlin](https://www.pluralsight.com/courses/kotlin-getting-started) by Kevin Jones @@ -146,26 +146,31 @@ You can also check out the other tutorials and content on our [YouTube channel]( ### 有没有 Kotlin 社区? -有。Kotlin 有一个非常有活力的社区。Kotlin 开发人员常出现在 [Kotlin 论坛](https://discuss.kotlinlang.org)、 +有!Kotlin 有一个非常有活力的社区。Kotlin 开发人员常出现在 [Kotlin 论坛](https://discuss.kotlinlang.org)、 [StackOverflow](https://stackoverflow.com/questions/tagged/kotlin) 上并且更积极地活跃在 [Kotlin Slack](https://slack.kotlinlang.org) (截至 2020 年 4 月有近 30000 名成员)上。 ### 有没有 Kotlin 活动? -有。现在有很多用户组和集会组专注于 Kotlin。你可以[在网站上找到一个列表](https://kotlinlang.org/user-groups/user-group-list.html)。 +有!现在有很多用户组和集会组专注于 Kotlin。你可以[在网站上找到一个列表](https://kotlinlang.org/user-groups/user-group-list.html)。 此外,还有世界各地的社区组织的 [Kotlin 之夜](https://kotlinlang.org/community/events.html)活动。 ### 有没有 Kotlin 大会? -有。官方的年度 [KotlinConf](https://kotlinconf.com/) 由 JetBrains 主办。 -分别于 [2017 年](https://kotlinconf.com/2017/) 在旧金山、[2018 年](https://kotlinconf.com/2018/)在阿姆斯特丹、 -[2019 年](https://kotlinconf.com/2019/)在哥本哈根举行。 +有! [KotlinConf](https://kotlinconf.com/) is an annual conference hosted by JetBrains, which brings together developers, enthusiasts, +and experts from around the world to share their knowledge and experience with Kotlin. + +In addition to technical talks and workshops, KotlinConf also offers networking opportunities, community interactions, +and social events where attendees can connect with fellow Kotliners and exchange ideas. +It serves as a platform for fostering collaboration and community building within the Kotlin ecosystem. + Kotlin 也会在全球不同地方举行大会。你可以在 [官网上找到即将到来的会谈](https://kotlinlang.org/community/talks.html?time=upcoming)列表。 ### Kotlin 上社交媒体吗? -上。最活跃的 Kotlin 帐号是 [Twitter 上的](https://twitter.com/kotlin)。 +上。 +Subscribe to the [Kotlin YouTube channel](https://www.youtube.com/c/Kotlin) and follow Kotlin [on Twitter](https://twitter.com/kotlin). ### 其他在线 Kotlin 资源呢? @@ -176,3 +181,5 @@ Kotlin 也会在全球不同地方举行大会。你可以在 徽标可以在[这里](https://resources.jetbrains.com/storage/products/kotlin/docs/kotlin_logos.zip)下载。 使用该徽标时,请遵循压缩包中的 `guidelines.pdf` 以及 [Kotlin 品牌使用指南](https://kotlinfoundation.org/guidelines/) 中的简单规则。 + +For more information, check out the page about [Kotlin brand assets](kotlin-brand-assets.md). diff --git a/docs/topics/functions.md b/docs/topics/functions.md index 8f8c1678fd0..c414b3b2fdc 100644 --- a/docs/topics/functions.md +++ b/docs/topics/functions.md @@ -173,7 +173,7 @@ fun printHello(name: String?) { …… } ### 单表达式函数 -当函数返回单个表达式时,可以省略花括号并且在 `=` 符号之后指定代码体即可: +当函数体由单个表达式构成时,可以省略花括号并且在 `=` 符号之后指定代码体即可: ```kotlin fun double(x: Int): Int = x * 2 diff --git a/docs/topics/generics.md b/docs/topics/generics.md index fa009f20435..c6e36ddf9ba 100644 --- a/docs/topics/generics.md +++ b/docs/topics/generics.md @@ -322,6 +322,41 @@ fun copyWhenGreater(list: List, threshold: T): List 所传递的类型必须同时满足 `where` 子句的所有条件。在上述示例中,类型 `T` 必须 *既*实现了 `CharSequence` *也*实现了 `Comparable`。 +## Definitely non-nullable types + +To make interoperability with generic Java classes and interfaces easier, Kotlin supports declaring a generic type parameter +as **definitely non-nullable**. + +To declare a generic type `T` as definitely non-nullable, declare the type with `& Any`. For example: `T & Any`. + +A definitely non-nullable type must have a nullable [upper bound](#upper-bounds). + +The most common use case for declaring definitely non-nullable types is when you want to override a Java method that +contains `@NotNull` as an argument. For example, consider the `load()` method: + +```java +import org.jetbrains.annotations.*; + +public interface Game { + public T save(T x) {} + @NotNull + public T load(@NotNull T x) {} +} +``` + +To override the `load()` method in Kotlin successfully, you need `T1` to be declared as definitely non-nullable: + +```kotlin +interface ArcadeGame : Game { + override fun save(x: T1): T1 + // T1 is definitely non-nullable + override fun load(x: T1 & Any): T1 & Any +} +``` + +When working only with Kotlin, it's unlikely that you will need to declare definitely non-nullable types explicitly because +Kotlin's type inference takes care of this for you. + ## 类型擦除 Kotlin 为泛型声明用法执行的类型安全检测在编译期进行。 @@ -468,4 +503,4 @@ fun main() { val n = Runner.run() assert(n == 42) } -``` \ No newline at end of file +``` diff --git a/docs/topics/getting-started.md b/docs/topics/getting-started.md index fc6d00995e2..ad297150045 100644 --- a/docs/topics/getting-started.md +++ b/docs/topics/getting-started.md @@ -1,15 +1,11 @@ [//]: # (title: Kotlin 入门) -[Kotlin](https://kotlinlang.org) 是一门现代但已成熟的编程语言,旨在让开发人员更幸福快乐。 +Kotlin 是一门现代但已成熟的编程语言,旨在让开发人员更幸福快乐。 它简洁、安全、可与 Java 及其他语言互操作,并提供了多种方式在多个平台间复用代码,以实现高效编程。 -选择它来构建强大的应用程序吧! +To start, why not take our tour of Kotlin? This tour covers the fundamentals of the Kotlin programming language. -## 学习 Kotlin 基础知识 - -* 如果你已熟悉一门或多门编程语言并想学习 Kotlin,请从这些 [Kotlin 学习资料](learning-materials-overview.md)开始。 -* 如果 Kotlin 是你的第一门编程语言,我们建议从[《Atomic Kotlin》这本书](https://www.atomickotlin.com/atomickotlin/)开始, -或者在 JetBrains 学院报名免费的[Kotlin 基础课程](https://hyperskill.org/join/fromdocstoJetSalesStat?redirect=true&next=/tracks/18)。 +Start the Kotlin tour ## 安装 Kotlin @@ -118,50 +114,7 @@ Kotlin 已包含在每个 [IntelliJ IDEA](https://www.jetbrains.com/idea/downloa - - -Kotlin 能够将 Kotlin 代码、Kotlin 标准库以及任何兼容的依赖项转换为 JavaScript。 - -在此可以了解到如何使用 [Kotlin/JS](js-overview.md) 开发及改进前端 web 应用程序。 - -1. **创建第一个前端 web 应用程序:** - - * 从头开始,[使用 IntelliJ IDEA 项目向导创建一个基本的浏览器应用程序](js-project-setup.md)。 - * 如果倾向于更健壮的示例,那么请完成[使用 React 与 Kotlin/JS 构建 web 应用程序](js-react.md)教程。 它有一个可以作为你自己项目良好起点的范例项目,其中包含有用的片段和模板。 - * 查看 [Kotlin/JS 范例](js-samples.md)列表,了解关于如何使用 Kotlin/JS 的更多看法。 - -2. **在应用程序中使用库。** 了解[添加依赖项](js-project-setup.md#依赖项)的更多信息。 - - |库 | 详情 | - |--------|---------| - |[stdlib](https://kotlinlang.org/api/latest/jvm/stdlib/) | 默认所有项目都包含了的 Kotlin 标准库。 | - |[kotlinx.browser](browser-api-dom.md)| 用于访问浏览器相关功能的 Kotlin 库,包括典型的顶层对象,如 document 与 window。 | - |[kotlinx.html](typesafe-html-dsl.md) | 使用静态类型的 HTML 构建器生成 DOM 元素的 Kotlin 库。| - |[Ktor](https://ktor.io/) | 用于联网的 Kotlin 多平台库。 | - |[KVision](https://kvision.io/) | 用于 Kotlin/JS 的一个第三方面向对象 web 框架。| - |[fritz2](https://www.fritz2.dev/)| 一个轻量级、高性能、独立的第三方库,用于在 Kotlin 中构建高度依赖协程与流的反应式 web 应用。| - |[Doodle](https://nacular.github.io/doodle/) | 一个基于矢量的第三方 UI 框架,使用浏览器的功能来绘制用户界面。| - |Compose for Web,[Compose Multiplatform](https://www.jetbrains.com/lp/compose-mpp/) 的一部分 | 将 [谷歌的 Jetpack Compose UI 工具包](https://developer.android.com/jetpack/compose)带到浏览器的 JetBrains 框架。| - |[kotlin-wrappers](https://github.com/JetBrains/kotlin-wrappers) | 为最流行的 JavaScript 框架之一提供方便的抽象与深度集成。 Kotlin wrappers 还为许多类似技术提供支持,例如 `react-redux`、 `react-router` 或者 `styled-components`。 | - -3. **了解关于 Kotlin 用于前端 web 开发的更多信息:** - - * [新版 Kotlin/JS IR 编译器](js-ir-compiler.md)。 - * [使用来自 npm 的依赖项](using-packages-from-npm.md)。 - * [在 JavaScript 中使用 Kotlin 代码](js-to-kotlin-interop.md)。 - -4. **加入 Kotlin 前端 web 社区:** - - * ![Slack](slack.svg){width=25}{type="joined"} Slack:[获取邀请](https://surveys.jetbrains.com/s3/kotlin-slack-sign-up)并加入 [#getting-started](https://kotlinlang.slack.com/archives/C0B8MA7FA) 与 [#javascript](https://kotlinlang.slack.com/archives/C0B8L3U69) 频道。 - * ![StackOverflow](stackoverflow.svg){width=25}{type="joined"} StackOverflow:订阅[“kotlin-js” 标签](https://stackoverflow.com/questions/tagged/kotlin-js)。 - -5. **关注 Kotlin**: ![Twitter](twitter.svg){width=25}{type="joined"} [Twitter](https://twitter.com/kotlin)、 ![Reddit](reddit.svg){width=25}{type="joined"} [Reddit](https://www.reddit.com/r/Kotlin/)、 ![YouTube](youtube.svg){width=25}{type="joined"} [Youtube](https://www.youtube.com/channel/UCP7uiEZIqci43m22KDl0sNw), 不要错过任何重要的生态系统更新。 - -如果遇到任何困难和问题,请在我们的[问题跟踪系统](https://youtrack.jetbrains.com/issues/KT)提报。 - - - - + * 如果希望开始使用 Kotlin 用于 Android 开发,请阅读 [谷歌对 Android 上 Kotlin 入门的建议](https://developer.android.com/kotlin/get-started)。 @@ -180,17 +133,15 @@ Kotlin 能够将 Kotlin 代码、Kotlin 标准库以及任何兼容的依赖项 1. **创建多平台库:** * 完成[创建并发布多平台库](multiplatform-library.md)教程。 它展示了如何为 JVM、 JS 与原生平台创建多平台库,对其进行测试并发布到本地 Maven 仓库。 - * 使用[这个教程](multiplatform-full-stack-app.md)构建一个全栈 web 应用程序。 -2. **在应用程序中使用库。** 了解关于[添加对库的依赖](multiplatform-add-dependencies.md)的更多内容。 +2. **在应用程序中使用库:** - |库|详情 | - |---------------------------------------------------------------------------------------------------------|-------| - | Ktor | [文档](https://ktor.io/docs/)与[范例](multiplatform-full-stack-app.md#build-the-backend)。 | - | Serialization | [文档](serialization.md)与[范例](multiplatform-full-stack-app.md)。 | - | Coroutines | [文档](coroutines-overview.md)。 | - | DateTime | [文档](https://github.com/Kotlin/kotlinx-datetime#readme)。 | + * [Ktor](https://ktor.io/docs/) + * [序列化](serialization.md) + * [协程](coroutines-overview.md) + * [日期时间](https://github.com/Kotlin/kotlinx-datetime#readme) + > Learn more about [adding dependencies on libraries](multiplatform-add-dependencies.md). > 还可以在[社区驱动列表](https://libs.kmp.icerock.dev/)中找到多平台库。 > {type="tip"} diff --git a/docs/topics/gradle/get-started-with-jvm-gradle-project.md b/docs/topics/gradle/get-started-with-jvm-gradle-project.md index 78d1a1bc2ec..32f1c704b0a 100644 --- a/docs/topics/gradle/get-started-with-jvm-gradle-project.md +++ b/docs/topics/gradle/get-started-with-jvm-gradle-project.md @@ -57,7 +57,7 @@ tasks.test { // 见下方 5️⃣ 注释 } kotlin { // 额外的扩展选项 - jvmToolchain(8) // 生成 JVM 字节码的目标版本,见下方 7️⃣ 注释 + jvmToolchain(%jvmLTSVersionSupportedByKotlin%) // 生成 JVM 字节码的目标版本,见下方 7️⃣ 注释 } application { diff --git a/docs/topics/gradle/gradle-compilation-and-caches.md b/docs/topics/gradle/gradle-compilation-and-caches.md index 96fad2285ee..c6af215f115 100644 --- a/docs/topics/gradle/gradle-compilation-and-caches.md +++ b/docs/topics/gradle/gradle-compilation-and-caches.md @@ -142,15 +142,9 @@ the build outputs for reuse in future builds. 如需禁用所有 Kotlin 任务的缓存,请将系统属性 `kotlin.caching.enabled` 设置为 `false` (运行构建带上参数 `-Dkotlin.caching.enabled=false`)。 -如果使用 [kapt](kapt.md),请注意默认情况下不会缓存注解处理任务。不过,可以[手动为它们启用缓存](kapt.md#gradle-构建缓存支持)。 - ## Gradle configuration cache support -> Gradle configuration cache support has some constraints: -> * The configuration cache is available in Gradle 6.5 and later as an experimental feature. -> You can check the [Gradle releases page](https://gradle.org/releases/) to see whether it has been promoted to stable. -> * The feature is supported only by the following Gradle plugins: +> The Gradle configuration cache is supported only by the following Gradle plugins: > * `org.jetbrains.kotlin.jvm` > * `org.jetbrains.kotlin.js` > * `org.jetbrains.kotlin.android` @@ -291,6 +285,31 @@ When configuring the Kotlin daemon's JVM arguments, note that: {type="note"} * If the `Xmx` argument is not specified, the Kotlin daemon will inherit it from the Gradle daemon. +## The new Kotlin compiler + +The new Kotlin K2 compiler is in [Alpha](components-stability.md#stability-levels-explained). +It has basic support for Kotlin JVM, JS, and Native projects. + +The new compiler aims to speed up the development of new language features, unify all of the platforms Kotlin supports, +bring performance improvements, and provide an API for compiler extensions. + +The K2 compiler will become the default starting with Kotlin 2.0. To try it in your projects now and check the performance, +use the `kotlin.experimental.tryK2=true` Gradle property or run the following command: + +```shell +./gradlew assemble -Pkotlin.experimental.tryK2=true +``` + +This Gradle property automatically sets the default language version to 2.0 and updates the [build report](#build-reports) +with the number of Kotlin tasks compiled using the K2 compiler compared to the current compiler. + +> Build reports don't provide information about Kotlin/Native tasks yet. Despite that, +> we still recommend that you use Kotlin 2.0 as the default version. +> +{type="tip"} + +Learn more about the stabilization of the K2 compiler in our [Kotlin blog](https://blog.jetbrains.com/kotlin/2023/02/k2-kotlin-2-0/) + ## Defining Kotlin compiler execution strategy _Kotlin compiler execution strategy_ defines where the Kotlin compiler is executed and if incremental compilation is supported in each case. @@ -418,22 +437,23 @@ If there is insufficient memory to run the compilation, you can see a message ab > {type="warning"} -Build reports for tracking compiler performance are available starting from Kotlin 1.7.0. Reports contain the durations -of different compilation phases and reasons why compilation couldn't be incremental. - +Build reports contain the durations of different compilation phases and any reasons why compilation couldn't be incremental. Use build reports to investigate performance issues when the compilation time is too long or when it differs for the same project. -Kotlin build reports help examine problems more efficiently than [Gradle build scans](https://scans.gradle.com/). -Lots of engineers use them to investigate build performance, but the unit of granularity in Gradle scans is a single Gradle task. +Kotlin build reports help you to investigate problems with build performance more efficiently than with [Gradle build scans](https://scans.gradle.com/) +that have a single Gradle task as the unit of granularity. There are two common cases that analyzing build reports for long-running compilations can help you resolve: * The build wasn't incremental. Analyze the reasons and fix underlying problems. * The build was incremental but took too much time. Try reorganizing source files — split big files, save separate classes in different files, refactor large classes, declare top-level functions in different files, and so on. +Build reports also show the Kotlin version used in the project. In addition, starting with Kotlin 1.9.0, +you can see whether the current or the [K2 compiler](#the-new-kotlin-compiler) was used to compile the code in your [Gradle build scans](https://scans.gradle.com/). + Learn [how to read build reports](https://blog.jetbrains.com/kotlin/2022/06/introducing-kotlin-build-reports/#how_to_read_build_reports) -and [how JetBrains uses build reports](https://blog.jetbrains.com/kotlin/2022/06/introducing-kotlin-build-reports/#how_we_use_build_reports_in_jetbrains). +and about [how JetBrains uses build reports](https://blog.jetbrains.com/kotlin/2022/06/introducing-kotlin-build-reports/#how_we_use_build_reports_in_jetbrains). ### Enabling build reports diff --git a/docs/topics/gradle/gradle-compiler-options.md b/docs/topics/gradle/gradle-compiler-options.md index 43589a4f968..aceb4d7f8aa 100644 --- a/docs/topics/gradle/gradle-compiler-options.md +++ b/docs/topics/gradle/gradle-compiler-options.md @@ -306,4 +306,4 @@ tasks 了解更多关于: * [增量编译、缓存支持、构建日志以及 Kotlin 守护进程](gradle-compilation-and-caches.md)。 * [Gradle 的基础知识和特性](https://docs.gradle.org/current/userguide/userguide.html)。 -* [对 Gradle 插件变体的支持](gradle-plugin-variants.md)。 +* [对 Gradle 插件变体的支持](gradle-plugin-variants.md)。 \ No newline at end of file diff --git a/docs/topics/gradle/gradle-configure-project.md b/docs/topics/gradle/gradle-configure-project.md index efe15ceaaf5..c942141c226 100644 --- a/docs/topics/gradle/gradle-configure-project.md +++ b/docs/topics/gradle/gradle-configure-project.md @@ -37,16 +37,24 @@ plugins { -When configuring your project, check the Kotlin Gradle plugin compatibility with available Gradle versions. -In the following table, there are the minimum and maximum **fully supported** versions of Gradle and Android Gradle plugin: +> The Kotlin Gradle plugin (KGP) and Kotlin share the same version numbering. +> +{type="note"} + +When configuring your project, check the Kotlin Gradle plugin (KGP) compatibility with available Gradle versions. +In the following table, there are the minimum and maximum **fully supported** versions of Gradle and Android Gradle plugin (AGP): -| Kotlin version | Gradle min and max versions | Android Gradle plugin min and max versions | -|----------------|------------------------------------------|-------------------------------------------------------| -| 1.8.20 | %minGradleVersion% – %maxGradleVersion% | %minAndroidGradleVersion% – %maxAndroidGradleVersion% | -| 1.8.0 | 6.8.3 – 7.3.3 | 4.1.3 – 7.2.1 | -| 1.7.20 | 6.7.1 – 7.1.1 | 3.6.4 – 7.0.4 | +| KGP version | Gradle min and max versions | AGP min and max versions | +|-------------|-----------------------------------------|-------------------------------------------------------| +| 1.9.0 | %minGradleVersion% – %maxGradleVersion% | %minAndroidGradleVersion% – %maxAndroidGradleVersion% | +| 1.8.20 | 6.8.3 – 7.6.0 | 4.1.3 – 7.4.0 | +| 1.8.0 | 6.8.3 – 7.3.3 | 4.1.3 – 7.2.1 | +| 1.7.20 | 6.7.1 – 7.1.1 | 3.6.4 – 7.0.4 | +| 1.7.0 | 6.7.1 – 7.0.2 | 3.4.3 – 7.0.2 | +| 1.6.20 | 6.1.1 - 7.0.2 | 3.4.3 - 7.0.2 | -> Latest Gradle and AGP versions should generally work without issues. +> You can also use Gradle and AGP versions up to the latest releases, but if you do, keep in mind that you might encounter +> deprecation warnings or some new features might not work. > {type="note"} @@ -85,7 +93,9 @@ plugins { ### Kotlin and Java sources -Kotlin 源代码可以与 Java 源代码放在相同文件夹或者不同文件夹中。默认约定是使用不同的文件夹: +Kotlin 源代码可以与 Java 源代码放在相同目录或者不同目录中。 + +默认约定是使用不同的目录: ```text project @@ -95,6 +105,12 @@ project - java ``` +> Do not store Java `.java` files in the `src/*/kotlin` directory, as the `.java` files will not be compiled. +> +> Instead, you can use `src/main/java`. +> +{type="warning"} + 如果不使用默认约定,那么应该更新相应的 `sourceSets` 属性: @@ -119,6 +135,8 @@ sourceSets { + + ### Check for JVM target compatibility of related compile tasks In the build module, you may have related compile tasks, for example: @@ -136,13 +154,36 @@ in the `java` extension or task cause JVM target incompatibility. For example: the `compileKotlin` task has `jvmTarget=1.8`, and the `compileJava` task has (or [inherits](https://docs.gradle.org/current/userguide/java_plugin.html#sec:java-extension)) `targetCompatibility=15`. -Configure the behavior of this check by setting the `kotlin.jvm.target.validation.mode` property in the `build.gradle(.kts)` +Configure the behavior of this check for the whole project by setting the `kotlin.jvm.target.validation.mode` property in the `build.gradle(.kts)` file to: * `error` – the plugin fails the build; the default value for projects on Gradle 8.0+. * `warning` – the plugin prints a warning message; the default value for projects on Gradle less than 8.0. * `ignore` – the plugin skips the check and doesn't produce any messages. +You can also configure it at task level in your `build.gradle(.kts)` file: + + + + +```kotlin +tasks.withType().configureEach { + jvmTargetValidationMode.set(org.jetbrains.kotlin.gradle.dsl.jvm.JvmTargetValidationMode.WARNING) +} +``` + + + + +```groovy +tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile.class).configureEach { + jvmTargetValidationMode = org.jetbrains.kotlin.gradle.dsl.jvm.JvmTargetValidationMode.WARNING +} +``` + + + + To avoid JVM target incompatibility, [configure a toolchain](#gradle-java-toolchains-support) or align JVM versions manually. #### What can go wrong if not checking targets compatibility {initial-collapse-state="collapsed"} @@ -182,11 +223,12 @@ plugins { When there is no explicit information about the `jvmTarget` value in the build script, its default value is `null`, and the compiler translates it to the default value `1.8`. The `targetCompatibility` equals -a current Gradle's JDK version, which is equal to your JDK version (unless you use -a [Java toolchain approach](gradle-configure-project.md#gradle-java-toolchains-support)). Assume that this version is `11`. -Your published library artifact will [declare the compatibility](https://docs.gradle.org/current/userguide/publishing_gradle_module_metadata.html) -with JDK 11+: `org.gradle.jvm.version=11`, which is wrong. You will have to use Java 11 in your main project to add -this library, although the bytecode's version is `1.8`. [Configure a toolchain](gradle-configure-project.md#gradle-java-toolchains-support) +the current Gradle's JDK version, which is equal to your JDK version (unless you use +a [Java toolchain approach](gradle-configure-project.md#gradle-java-toolchains-support)). Assuming that your JDK version is +`%jvmLTSVersionSupportedByKotlin%`, your published library artifact will [declare itself compatible](https://docs.gradle.org/current/userguide/publishing_gradle_module_metadata.html) +with JDK %jvmLTSVersionSupportedByKotlin%+: `org.gradle.jvm.version=%jvmLTSVersionSupportedByKotlin%`, which is wrong. +In this case, you have to use Java %jvmLTSVersionSupportedByKotlin% in your main project to add this library, even though the bytecode's +version is `1.8`. [Configure a toolchain](gradle-configure-project.md#gradle-java-toolchains-support) to solve this issue. ### Gradle Java toolchains support @@ -243,7 +285,7 @@ kotlin { // Or shorter: jvmToolchain() // For example: - jvmToolchain(8) + jvmToolchain(%jvmLTSVersionSupportedByKotlin%) } ``` @@ -258,7 +300,7 @@ kotlin { // Or shorter: jvmToolchain() // For example: - jvmToolchain(8) + jvmToolchain(%jvmLTSVersionSupportedByKotlin%) } ``` @@ -294,15 +336,43 @@ java { +If you use Gradle 8.0.2 or higher, you also need to add a [toolchain resolver plugin](https://docs.gradle.org/current/userguide/toolchains.html#sub:download_repositories). +This type of plugin manages which repositories to download a toolchain from. As an example, add to your `settings.gradle(.kts)` the following plugin: + + + + +```kotlin +plugins { + id("org.gradle.toolchains.foojay-resolver-convention") version("0.5.0") +} +``` + + + + +```groovy +plugins { + id 'org.gradle.toolchains.foojay-resolver-convention' version '0.5.0' +} +``` + + + + +Check that the version of `foojay-resolver-convention` corresponds to your Gradle version on the [Gradle site](https://docs.gradle.org/current/userguide/toolchains.html#sub:download_repositories). + > To understand which toolchain Gradle uses, run your Gradle build with the [log level `--info`](https://docs.gradle.org/current/userguide/logging.html#sec:choosing_a_log_level) > and find a string in the output starting with `[KOTLIN] Kotlin compilation 'jdkHome' argument:`. > The part after the colon will be the JDK version from the toolchain. > {type="note"} -To set any JDK (even local) for the specific task, use the Task DSL. +To set any JDK (even local) for a specific task, use the [Task DSL](#set-jdk-version-with-the-task-dsl). + +Learn more about [Gradle JVM toolchain support in the Kotlin plugin](https://blog.jetbrains.com/kotlin/2021/11/gradle-jvm-toolchain-support-in-the-kotlin-plugin/). -### Setting JDK version with the Task DSL +### Set JDK version with the Task DSL The Task DSL allows setting any JDK version for any task implementing the `UsesKotlinJavaToolchain` interface. At the moment, these tasks are `KotlinCompile` and `KaptTask`. @@ -386,8 +456,68 @@ integrationTestCompilation { Here, the `integrationTest` compilation is associated with the `main` compilation that gives access to `internal` objects from functional tests. +### Configure with Java Modules (JPMS) enabled + +To make the Kotlin Gradle plugin work with [Java Modules](https://www.oracle.com/corporate/features/understanding-java-9-modules.html), +add the following lines to your build script and replace `YOUR_MODULE_NAME` with a reference to your JPMS module, for example, +`org.company.module`: + + + + +```kotlin +// Add the following three lines if you use a Gradle version less than 7.0 +java { + modularity.inferModulePath.set(true) +} + +tasks.named("compileJava", JavaCompile::class.java) { + options.compilerArgumentProviders.add(CommandLineArgumentProvider { + // Provide compiled Kotlin classes to javac – needed for Java/Kotlin mixed sources to work + listOf("--patch-module", "YOUR_MODULE_NAME=${sourceSets["main"].output.asPath}") + }) +} +``` + + + + +```groovy +// Add the following three lines if you use a Gradle version less than 7.0 +java { + modularity.inferModulePath = true +} + +tasks.named("compileJava", JavaCompile.class) { + options.compilerArgumentProviders.add(new CommandLineArgumentProvider() { + @Override + Iterable asArguments() { + // Provide compiled Kotlin classes to javac – needed for Java/Kotlin mixed sources to work + return ["--patch-module", "YOUR_MODULE_NAME=${sourceSets["main"].output.asPath}"] + } + }) +} +``` + + + + +> Put `module-info.java` into the `src/main/java` directory as usual. +> +> For a module, a package name in Kotlin files should be equal to the package name from `module-info.java` to avoid a +> "package is empty or does not exist" build failure. +> +{type="note"} + +Learn more about: +* [Building modules for the Java Module System](https://docs.gradle.org/current/userguide/java_library_plugin.html#sec:java_library_modular) +* [Building applications using the Java Module System](https://docs.gradle.org/current/userguide/application_plugin.html#sec:application_modular) +* [What "module" means in Kotlin](visibility-modifiers.md#模块) + ### Other details +Learn more about [Kotlin/JVM](jvm-get-started.md). + #### Lazy Kotlin/JVM task creation Starting from Kotlin 1.8.20, the Kotlin Gradle plugin registers all tasks and doesn't configure them on a dry run. @@ -435,20 +565,23 @@ plugins { +Learn more about [Kotlin Multiplatform for different platforms](multiplatform-get-started.md) and +[Kotlin Multiplatform for iOS and Android](multiplatform-mobile-getting-started.md). + ## 面向 Android -It's recommended to use Android Studio for creating Android applications. [Learn how to use Android Gradle plugin](https://developer.android.com/studio/releases/gradle-plugin). +It's recommended to use Android Studio for creating Android applications. [Learn how to use the Android Gradle plugin](https://developer.android.com/studio/releases/gradle-plugin). ## Targeting JavaScript -When targeting only JavaScript, use the `kotlin-js` plugin. [Learn more](js-project-setup.md) +When targeting JavaScript, use the `kotlin-multiplatform` plugin as well. [Learn more about setting up a Kotlin/JS project](js-project-setup.md) ```kotlin plugins { - kotlin("js") version "%kotlinVersion%" + kotlin("multiplatform") version "%kotlinVersion%" } ``` @@ -457,7 +590,7 @@ plugins { ```groovy plugins { - id 'org.jetbrains.kotlin.js' version '%kotlinVersion%' + id 'org.jetbrains.kotlin.multiplatform' version '%kotlinVersion%' } ``` @@ -508,7 +641,7 @@ import org.jetbrains.kotlin.gradle.plugin.KotlinBasePlugin // ... project.plugins.withType() { -// Configure your action here + // Configure your action here } ``` @@ -521,7 +654,7 @@ import org.jetbrains.kotlin.gradle.plugin.KotlinBasePlugin // ... project.plugins.withType(KotlinBasePlugin.class) { -// Configure your action here + // Configure your action here } ``` @@ -666,7 +799,7 @@ kotlin.stdlib.jdk.variants.version.alignment=false - ```kotlin + ```kotlin dependencies { constraints { add("implementation", "org.jetbrains.kotlin:kotlin-stdlib-jdk7") { @@ -714,8 +847,8 @@ kotlin.stdlib.jdk.variants.version.alignment=false ```kotlin - // replace `<...>` with the plugin name plugins { + // replace `<...>` with the plugin name kotlin("<...>") version "%kotlinVersion%" } ``` @@ -724,8 +857,8 @@ kotlin.stdlib.jdk.variants.version.alignment=false ```groovy - // replace `<...>` with the plugin name plugins { + // replace `<...>` with the plugin name id "org.jetbrains.kotlin.<...>" version "%kotlinVersion%" } ``` @@ -755,9 +888,9 @@ kotlin.stdlib.jdk.variants.version.alignment=false ```groovy dependencies { - implementation("com.example:lib:1.0") { - exclude group: "org.jetbrains.kotlin", module: "kotlin-stdlib" - } + implementation("com.example:lib:1.0") { + exclude group: "org.jetbrains.kotlin", module: "kotlin-stdlib" + } } ``` @@ -912,9 +1045,9 @@ see [this issue in the Compatibility Guide](compatibility-guide-15.md#do-not-mix ### Set a dependency on a kotlinx library -If you use a kotlinx library and need a platform-specific dependency, you can use platform-specific variants -of libraries with suffixes such as `-jvm` or `-js`, for example, `kotlinx-coroutines-core-jvm`. You can also use the library's -base artifact name instead – `kotlinx-coroutines-core`. +If you use a [`kotlinx` library](https://github.com/Kotlin/kotlinx.coroutines) and need a platform-specific dependency, +you can use platform-specific variants of libraries with suffixes such as `-jvm` or `-js`, for example, +`kotlinx-coroutines-core-jvm`. You can also use the library's base artifact name instead – `kotlinx-coroutines-core`. diff --git a/docs/topics/gradle/gradle-plugin-variants.md b/docs/topics/gradle/gradle-plugin-variants.md index 2e5fe9da6d6..57b66c60499 100644 --- a/docs/topics/gradle/gradle-plugin-variants.md +++ b/docs/topics/gradle/gradle-plugin-variants.md @@ -44,8 +44,8 @@ If you use a custom Gradle configuration: ```kotlin -configurations.register("customConfiguraton") { - ... +configurations.register("customConfiguration") { + // ... } ``` @@ -53,8 +53,8 @@ configurations.register("customConfiguraton") { ```groovy -configurations.register("customConfiguraton") { - ... +configurations.register("customConfiguration") { + // ... } ``` @@ -94,17 +94,17 @@ configurations { customConfiguration { attributes { attribute( - Usage.USAGE_ATTRIBUTE, - project.objects.named(Usage.class, Usage.JAVA_RUNTIME) + Usage.USAGE_ATTRIBUTE, + project.objects.named(Usage.class, Usage.JAVA_RUNTIME) ) attribute( - Category.CATEGORY_ATTRIBUTE, - project.objects.named(Category.class, Category.LIBRARY) + Category.CATEGORY_ATTRIBUTE, + project.objects.named(Category.class, Category.LIBRARY) ) // If you want to depend on a specific KGP variant: attribute( - GradlePluginApiVersion.GRADLE_PLUGIN_API_VERSION_ATTRIBUTE, - project.objects.named("7.0") + GradlePluginApiVersion.GRADLE_PLUGIN_API_VERSION_ATTRIBUTE, + project.objects.named("7.0") ) } } @@ -119,17 +119,17 @@ configurations { customConfiguration { attributes { attribute( - Usage.USAGE_ATTRIBUTE, - project.objects.named(Usage, Usage.JAVA_RUNTIME) + Usage.USAGE_ATTRIBUTE, + project.objects.named(Usage, Usage.JAVA_RUNTIME) ) attribute( - Category.CATEGORY_ATTRIBUTE, - project.objects.named(Category, Category.LIBRARY) + Category.CATEGORY_ATTRIBUTE, + project.objects.named(Category, Category.LIBRARY) ) // If you want to depend on a specific KGP variant: attribute( - GradlePluginApiVersion.GRADLE_PLUGIN_API_VERSION_ATTRIBUTE, - project.objects.named('7.0') + GradlePluginApiVersion.GRADLE_PLUGIN_API_VERSION_ATTRIBUTE, + project.objects.named('7.0') ) } } @@ -141,8 +141,8 @@ configurations { Otherwise, you will receive an error similar to this: -``` - > Could not resolve all files for configuration ':customConfiguraton'. +```none + > Could not resolve all files for configuration ':customConfiguration'. > Could not resolve org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0. Required by: project : @@ -156,4 +156,4 @@ Otherwise, you will receive an error similar to this: ## 下一步做什么? -Learn more about [Gradle basics and specifics](https://docs.gradle.org/current/userguide/getting_started.html). \ No newline at end of file +Learn more about [Gradle basics and specifics](https://docs.gradle.org/current/userguide/getting_started.html). diff --git a/docs/topics/gradle/gradle.md b/docs/topics/gradle/gradle.md index 687059396e7..295b2cef37a 100644 --- a/docs/topics/gradle/gradle.md +++ b/docs/topics/gradle/gradle.md @@ -15,4 +15,4 @@ Gradle 是一个用于管理并自动化构建流程的构建工具。它会帮 * **Gradle Kotlin DSL**。 [Gradle Kotlin DSL](https://docs.gradle.org/current/userguide/kotlin_dsl.html) 是一种用于高效、快捷编写构建脚本的领域特定语言。 * **注解处理**。 Kotlin 通过 [Kotlin Symbol processing API](ksp-reference.md) 支持注解处理。 * **生成文档**。 如需生成 Kotlin 项目的文档,请使用 [Dokka](https://github.com/Kotlin/dokka);相关配置说明请参见 [Dokka README](https://github.com/Kotlin/dokka/blob/master/README.md#using-the-maven-plugin)。Dokka 支持混合语言项目,并且可以生成多种格式的输出,包括标准 Javadoc。 -* **OSGi**。 关于 OSGi 支持请参见 [Kotlin OSGi 页](kotlin-osgi.md)。 +* **OSGi**。 关于 OSGi 支持请参见 [Kotlin OSGi 页](kotlin-osgi.md)。 \ No newline at end of file diff --git a/docs/topics/home.xml b/docs/topics/home.xml index 66dc5d6572d..0ad50e9deca 100644 --- a/docs/topics/home.xml +++ b/docs/topics/home.xml @@ -34,7 +34,7 @@ 新特性 - Kotlin 1.8.20 的新特性 + Kotlin 1.9.0 的新特性 Kotlin 公开路线图 @@ -48,9 +48,9 @@ 学习 Kotlin 例学 Kotlin 心印 - JetBrains 学院 + JetBrains 学院 Advent of Code - 动手实践教程 + 动手实践教程 IntelliJ IDEA 中的 JetBrains 学院 diff --git a/docs/topics/idioms.md b/docs/topics/idioms.md index e6c1b2294eb..1fcba276640 100644 --- a/docs/topics/idioms.md +++ b/docs/topics/idioms.md @@ -95,7 +95,7 @@ for ((k, v) in map) { ```kotlin for (i in 1..100) { …… } // 闭区间:包含 100 -for (i in 1 until 100) { …… } // 半开区间:不包含 100 +for (i in 1..< 100) { …… } // 左开右闭区间:不包含 100 for (x in 2..10 step 2) { …… } for (x in 10 downTo 1) { …… } (1..10).forEach { …… } @@ -159,11 +159,13 @@ println(files?.size) // 如果 files 不是 null,那么输出其大小(size ```kotlin val files = File("Test").listFiles() +// For simple fallback values: println(files?.size ?: "empty") // 如果 files 为 null,那么输出“empty” -// To calculate the fallback value in a code block, use `run` +// To calculate a more complicated fallback value in a code block, use `run` val filesSize = files?.size ?: run { - return someSize + val someSize = getSomeSize() + someSize * 2 } println(filesSize) ``` diff --git a/docs/topics/inline-classes.md b/docs/topics/inline-classes.md index af4f33acefa..d25bb0375d6 100644 --- a/docs/topics/inline-classes.md +++ b/docs/topics/inline-classes.md @@ -1,4 +1,4 @@ -[//]: # (title: 内联类) +[//]: # (title: Inline value classes) 有时候,业务逻辑需要围绕某种类型创建包装器。然而,由于额外的堆内存分配问题, 它会引入运行时的性能开销。此外,如果被包装的类型是原生类型,性能的损失是很糟糕的, @@ -21,10 +21,6 @@ To declare an inline class for the JVM backend, use the `value` modifier along w value class Password(private val s: String) ``` -> The `inline` modifier for inline classes is deprecated. -> -{type="warning"} - 内联类必须含有唯一的一个属性在主构造函数中初始化。在运行时, 将使用这个唯一属性来表示内联类的实例(关于运行时的内部表达请参阅[下文](#表示方式)): @@ -40,29 +36,39 @@ val securePassword = Password("Don't try this in production") ## 成员 内联类支持普通类中的一些功能。特别是,内联类可以声明属性与函数, -and have the `init` block: +have an `init` block and [secondary constructors](classes.md#次构造函数): ```kotlin @JvmInline -value class Name(val s: String) { +value class Person(private val fullName: String) { init { - require(s.length > 0) { } + require(fullName.isNotEmpty()) { + "Full name shouldn't be empty" + } + } + + constructor(firstName: String, lastName: String) : this("$firstName $lastName") { + require(lastName.isNotBlank()) { + "Last name shouldn't be empty" + } } val length: Int - get() = s.length + get() = fullName.length fun greet() { - println("Hello, $s") + println("Hello, $fullName") } } fun main() { - val name = Name("Kotlin") - name.greet() // `greet` 方法会作为一个静态方法被调用 - println(name.length) // 属性的 get 方法会作为一个静态方法被调用 + val name1 = Person("Kotlin", "Mascot") + val name2 = Person("Kodee") + name1.greet() // greet` 函数会作为一个静态方法被调用 + println(name2.length) // 属性的 getter 会作为一个静态方法被调用 } ``` +{kotlin-runnable="true" kotlin-min-compiler-version="1.9"} Inline class properties cannot have [backing fields](properties.md#幕后字段). They can only have simple computable properties (no `lateinit`/delegated properties). @@ -140,11 +146,6 @@ value class UserId(val value: T) fun compute(s: UserId) {} // compiler generates fun compute-(s: Any?) ``` -> Generic inline classes is an [Experimental](components-stability.md) feature. -> It may be dropped or changed at any time. Opt-in is required with the `-language-version 1.8` compiler option. -> -{type="warning"} - ### 名字修饰 由于内联类被编译为其基础类型,因此可能会导致各种模糊的错误,例如意想不到的平台签名冲突: @@ -160,14 +161,9 @@ fun compute(x: Int) { } fun compute(x: UInt) { } ``` -为了缓解这种问题,一般会通过在函数名后面拼接一些稳定的哈希码来重命名函数。 +为了缓解这种问题,一般会通过在函数名后面拼接一些稳定的哈希码来*修饰*函数名。 因此,`fun compute(x: UInt)` 将会被表示为 `public final void compute-(int x)`,以此来解决冲突的问题。 -> The mangling scheme has been changed in Kotlin 1.4.30. -> Use the `-Xuse-14-inline-classes-mangling-scheme` compiler flag to force the compiler to use the old 1.4.0 mangling scheme and preserve binary compatibility. -> -{type="note"} - ### Calling from Java code You can call functions that accept inline classes from Java code. To do so, you should manually disable mangling: diff --git a/docs/topics/inline-functions.md b/docs/topics/inline-functions.md index 426e71680a1..98568d9c5c7 100644 --- a/docs/topics/inline-functions.md +++ b/docs/topics/inline-functions.md @@ -186,7 +186,7 @@ fun main(s: Array) { ## 内联属性 -`inline` 修饰符可用于没有幕后字段的属性的访问器。 +`inline` 修饰符可用于没有[幕后字段](properties.md#幕后字段)的属性的访问器。 你可以标注独立的属性访问器: ```kotlin diff --git a/docs/topics/install-eap-plugin.md b/docs/topics/install-eap-plugin.md index 67d965ea524..6f0ec65d32f 100644 --- a/docs/topics/install-eap-plugin.md +++ b/docs/topics/install-eap-plugin.md @@ -5,7 +5,7 @@

Explore Kotlin EAP release details

-You can follow these instructions to install [the preview version of the Kotlin Plugin for IntelliJ IDEA or Android Studio](eap.md#build-details). +You can follow these instructions to install the preview version of the Kotlin Plugin for IntelliJ IDEA or Android Studio. 1. Select **Tools** | **Kotlin** | **Configure Kotlin Plugin Updates**. @@ -21,6 +21,10 @@ You can follow these instructions to install [the preview version of the Kotlin ![Install the EAP build](idea-latest-kotlin-eap.png) {width="500"} + + > If the Kotlin EAP plugin can't find the latest EAP build, check that you are using the latest version of [IntelliJ IDEA](https://www.jetbrains.com/help/idea/update.html) or [Android Studio](https://developer.android.com/studio/intro/update). + > + {type="note"} 4. Click **Install**. diff --git a/docs/topics/js/dev-server-continuous-compilation.md b/docs/topics/js/dev-server-continuous-compilation.md index c24c97bb710..02848a73fca 100644 --- a/docs/topics/js/dev-server-continuous-compilation.md +++ b/docs/topics/js/dev-server-continuous-compilation.md @@ -25,4 +25,4 @@ When executing this run configuration, you can note that the Gradle process cont Once a change has been detected, the program will be recompiled automatically. If you still have the page open in the browser, the development server will trigger an automatic reload of the page, and the changes will become visible. -This is thanks to the integrated `webpack-dev-server` that is managed by the Kotlin/JS Gradle plugin. \ No newline at end of file +This is thanks to the integrated `webpack-dev-server` that is managed by the Kotlin Multiplatform Gradle plugin. \ No newline at end of file diff --git a/docs/topics/js/javascript-dce.md b/docs/topics/js/javascript-dce.md index 2d8522c31c5..8bcc077d3aa 100644 --- a/docs/topics/js/javascript-dce.md +++ b/docs/topics/js/javascript-dce.md @@ -1,6 +1,6 @@ [//]: # (title: Kotlin/JS 无用代码消除) -Kotlin/JS Gradle 插件包含一个*[无用代码消除](https://zh.wikipedia.org/wiki/%E6%AD%BB%E7%A2%BC%E5%88%AA%E9%99%A4)*(_DCE_)工具。 +Kotlin Multiplatform Gradle 插件包含一个*[无用代码消除](https://zh.wikipedia.org/wiki/%E6%AD%BB%E7%A2%BC%E5%88%AA%E9%99%A4)*(_DCE_)工具。 无用代码消除通常也称为 _摇树_。 通过删除未使用的属性、函数和类,它减小了大小或生成的 JavaScript 代码。 @@ -12,7 +12,7 @@ Kotlin/JS Gradle 插件包含一个*[无用代码消除](https://zh.wikipedia.or 所有这些功能将需要约 1.3MB 的 JavaScript 文件。 一个简单的 “Hello, world”应用程序仅需要控制台例程,整个程序只有几 KB。 -Kotlin/JS Gradle 插件在构建**生产包**时会自动处理 DCE,例如:使用 +Kotlin Multiplatform Gradle 插件在构建**生产包**时会自动处理 DCE,例如:使用 `browserProductionWebpack` 任务。**开发包**任务(例如 `browserDevelopmentWebpack`)不包含 DCE。 ## 从 DCE 排除的声明 diff --git a/docs/topics/js/js-debugging.md b/docs/topics/js/js-debugging.md index f160ea36359..f1103e64ee3 100644 --- a/docs/topics/js/js-debugging.md +++ b/docs/topics/js/js-debugging.md @@ -3,7 +3,7 @@ JavaScript source maps provide mappings between the minified code produced by bundlers or minifiers and the actual source code a developer works with. This way, the source maps enable support for debugging the code during its execution. -The Kotlin/JS Gradle plugin automatically generates source maps for the project builds, making them available without any additional configuration. +The Kotlin Multiplatform Gradle plugin automatically generates source maps for the project builds, making them available without any additional configuration. ## Debug in browser diff --git a/docs/topics/js/js-get-started.md b/docs/topics/js/js-get-started.md deleted file mode 100644 index e55bdeec327..00000000000 --- a/docs/topics/js/js-get-started.md +++ /dev/null @@ -1,159 +0,0 @@ -[//]: # (title: 以 Kotlin/JS for React 入门) - -This tutorial demonstrates how to use IntelliJ IDEA for creating a frontend application with Kotlin/JS for React. - -To get started, install the latest version of [IntelliJ IDEA](https://www.jetbrains.com/idea/download/index.html). - -## Create an application - -Once you've installed IntelliJ IDEA, it's time to create your first frontend application based on Kotlin/JS with React. - -1. In IntelliJ IDEA, select **File** | **New** | **Project**. -2. In the panel on the left, select **Kotlin Multiplatform**. -3. Enter a project name, select **React Application** as the project template, and click **Next**. - - ![Create a react application](js-new-project-1.png){width=700} - - By default, your project will use Gradle with Kotlin DSL as the build system. - -4. Accept the default configuration on the next screen and click **Finish**. Your project will open. - - ![Configure a frontend application](js-new-project-2.png){width=700} - -5. Open the `build.gradle.kts` file, the build script created by default based on your configuration. It includes - the [`kotlin("js")` plugin and dependencies](js-project-setup.md) required for your frontend application. Ensure that - you use the latest version of the plugin: - - ```kotlin - plugins { - kotlin("js") version "%kotlinVersion%" - } - ``` - -## Run the application - -Start the application by clicking **Run** next to the run configuration at the top of the screen. - -![Running a frontend app](js-run-app.png){width=500} - -Your default web browser opens the URL [http://localhost:8080/](http://localhost:8080/) with your frontend application. - -![Web browser with JS application](js-output-1.png){width=600} - -Enter your name in the text box and accept the greetings from your application! - -## Update the application - -### Show your name backwards - -1. Open the file `Welcome.kt` in `src/main/kotlin`. - The `src` directory contains Kotlin source files and resources. The file `Welcome.kt` includes sample code that renders - the web page you've just seen. - - ![Source code for frontend application](js-welcome-kt.png) - -2. Change the code of `div` to show your name backwards. - - * Use the standard library function `reversed()` to reverse your name. - * Use a [string template](strings.md#字符串模板) for your reversed - name by adding a dollar sign `$` and enclosing it in curly braces – `${state.name.reversed()}`. - - ```kotlin - div { - css { - padding = 5.px - backgroundColor = rgb(8, 97, 22) - color = rgb(56, 246, 137) - } - +"Hello, $name" - +" Your name backwards is ${name.reversed()}!" - } - ``` - -3. Save your changes to the file. - -4. Go to the browser and enjoy the result. - You will see the changes only if your previous application is still running. If you've stopped your application, [run it again](#run-the-application). - -![Web browser with a reversed name](js-output-2.png){width=600} - -### Add an image - -1. Open the file `Welcome.kt` in `src/main/kotlin`. - -2. Add a `div` container with a child image element `img` after the `input` block. - - > Follow IDE suggestions to import all the required elements of the `react.dom.html` package. - > - {type="note"} - - ```kotlin - div { - img { - src = "https://placekitten.com/408/287" - } - } - ``` - -3. Save your changes to the file. - -4. Go to the browser and enjoy the result. - You will only see the changes if your previous application is still running. If you've stopped your application, [run it again](#run-the-application). - -![Web page with an image](js-output-3.png){width=600} - -### Add a button that changes text - -1. Open the file `Welcome.kt` in `src/main/kotlin`. - -2. Add a `button` element with an `onClick` event handler. - - > Make sure that you import the relevant `react.dom.html.ReactHTML` element. - > - {type="note"} - - ```kotlin - button { - onClick = { - name = "Some name" - } - +"Change name" - } - ``` - -3. Save your changes to the file. - -4. Go to the browser and enjoy the result. - You will only see the changes if your previous application is still running. If you've stopped your application, [run it again](#run-the-application). - -![Web page with a button](js-output-4.png){width=600} - -## 下一步做什么? - -Once you have created your first application, you can complete long-form Kotlin/JS tutorials -or check out the list of Kotlin/JS sample projects for inspiration. Both types of resources contain useful snippets and -patterns and can serve as a nice jump-off point for your own projects. - -### Tutorials - -* [Build a web application with React and Kotlin/JS — tutorial](js-react.md) -guides you through the process of building a simple web application using the React framework, shows how a type-safe Kotlin -DSL for HTML makes it easy to build reactive DOM elements, and illustrates how to use third-party React components and -obtain information from APIs, all while writing the whole application logic in pure Kotlin/JS. - -* [Build a full-stack web app with Kotlin Multiplatform](multiplatform-full-stack-app.md) -teaches the concepts behind building an application that targets Kotlin/JVM and Kotlin/JS by building a client-server -application that makes use of shared code, serialization, and other multiplatform paradigms. It also provides a brief -introduction to working with Ktor both as a server- and client-side framework. - -### Sample projects - -* [Full-stack Spring collaborative to-do list](https://github.com/Kotlin/full-stack-spring-collaborative-todo-list-sample) -shows how to create a to-do list for collaborative work using `kotlin-multiplatform` with JS and JVM targets, Spring -for the backend, Kotlin/JS with React for the frontend, and RSocket. -* [Kotlin/JS and React Redux to-do list](https://github.com/Kotlin/react-redux-js-ir-todo-list-sample) implements -the React Redux to-do list using JS libraries (`react`, `react-dom`, `react-router`, `redux`, and `react-redux`) -from npm and Webpack to bundle, minify, and run the project. -* [Full-stack demo application](https://github.com/Kotlin/full-stack-web-jetbrains-night-sample) guides you through -the process of building an app with a feed containing user-generated posts and comments. All data is stubbed by -the fakeJSON and JSON Placeholder services. diff --git a/docs/topics/js/js-ir-compiler.md b/docs/topics/js/js-ir-compiler.md index 0d227dbd424..e6bcf93a771 100644 --- a/docs/topics/js/js-ir-compiler.md +++ b/docs/topics/js/js-ir-compiler.md @@ -10,7 +10,7 @@ Kotlin/JS IR 编译器后端没有直接从 Kotlin 源代码生成 JavaScript 对于 Kotlin/JS,这可以进行积极的优化,并可以改善以前的编译器中存在的痛点,例如生成的代码大小(通过消除无效代码)以及 JavaScript 与 TypeScript 生态系统的互操作性。 -从 Kotlin 1.4.0 开始,可以通过 Kotlin/JS Gradle 插件使用 IR 编译器后端。要在项目中启用它, +从 Kotlin 1.4.0 开始,可以通过 Kotlin Multiplatform Gradle 插件使用 IR 编译器后端。要在项目中启用它, 请将编译器类型传递给 Gradle 构建脚本中的 `js` 函数: ```groovy @@ -23,9 +23,13 @@ kotlin { ``` * `IR` 使用 Kotlin/JS 的新 IR 编译器后端。 -* `LEGACY` 使用默认编译器后端。 +* `LEGACY` 使用旧版编译器后端。 * `BOTH` 使用新的 IR 编译器以及默认的编译器后端编译项目。这个模式用于[创作与两个后端兼容的库](#为-ir-编译器创作具有向后兼容性的库)。 +> The old compiler backend has been deprecated since Kotlin 1.8.0. Starting with Kotlin 1.9.0, using compiler types `LEGACY` of `BOTH` leads to an error. +> +{type="warning"} + 还可以使用键值 `kotlin.js.compiler=ir` 在 `gradle.properties` 文件中设置编译器类型。 但是,`build.gradle(.kts)` 中的任何设置都会覆盖此行为。 @@ -100,13 +104,13 @@ Kotlin/JS IR 编译器提供了默认后端中不可用的新编译模式——_ ```kotlin kotlin { - js(IR) { - compilations.all { - compileTaskProvider.configure { - compilerOptions.freeCompilerArgs.add("-Xerror-tolerance-policy=SYNTAX") - } - } - } + js(IR) { + compilations.all { + compileTaskProvider.configure { + compilerOptions.freeCompilerArgs.add("-Xerror-tolerance-policy=SYNTAX") + } + } + } } ``` @@ -118,13 +122,13 @@ This type of minification is automatically applied when you build your Kotlin/JS ```kotlin kotlin { - js(IR) { - compilations.all { - compileTaskProvider.configure { - compilerOptions.freeCompilerArgs.add("-Xir-minimized-member-names=false") - } - } - } + js(IR) { + compilations.all { + compileTaskProvider.configure { + compilerOptions.freeCompilerArgs.add("-Xir-minimized-member-names=false") + } + } + } } ``` diff --git a/docs/topics/js/js-ir-migration.md b/docs/topics/js/js-ir-migration.md index 8515e53df34..8a19e73753c 100644 --- a/docs/topics/js/js-ir-migration.md +++ b/docs/topics/js/js-ir-migration.md @@ -1,6 +1,6 @@ [//]: # (title: 将 Kotlin/JS 项目迁移到 IR 编译器) -We replaced the current Kotlin/JS compiler with [the IR-based compiler](js-ir-compiler.md) in order to unify +We replaced the old Kotlin/JS compiler with [the IR-based compiler](js-ir-compiler.md) in order to unify Kotlin's behavior on all platforms and to make it possible to implement new JS-specific optimizations, among other reasons. You can learn more about the internal differences between the two compilers in the blog post [Migrating our Kotlin/JS app to the new IR compiler](https://dev.to/kotlin/migrating-our-kotlin-js-app-to-the-new-ir-compiler-3o6i) diff --git a/docs/topics/js/js-modules.md b/docs/topics/js/js-modules.md index 17c3a3ea2be..df4b1beee27 100644 --- a/docs/topics/js/js-modules.md +++ b/docs/topics/js/js-modules.md @@ -77,7 +77,7 @@ compileKotlinJs.compilerOptions.moduleKind = org.jetbrains.kotlin.gradle.dsl.JsM kotlin { js { useCommonJs() - // . . . + // ... } } ``` diff --git a/docs/topics/js/js-overview.md b/docs/topics/js/js-overview.md index b8f691096c3..5f40b666841 100644 --- a/docs/topics/js/js-overview.md +++ b/docs/topics/js/js-overview.md @@ -3,9 +3,10 @@ Kotlin/JS 提供了转换 Kotlin 代码、Kotlin 标准库的能力,并且兼容 JavaScript 的任何依赖项。Kotlin/JS 的当前实现以 [ES5](https://www.ecma-international.org/ecma-262/5.1/) 为目标。 -使用 Kotlin/JS 的推荐方法是通过 `kotlin.js` 与 `kotlin.multiplatform` Gradle 插件。它们提供了一种集中且便捷的方式来设置与控制以 JavaScript 为目标的 Kotlin 项目。 -这包括基本特性,例如控制应用程序的捆绑,直接从 npm 添加 JavaScript 依赖项等等。要获得可用选项的概述,请查看[搭建 Kotlin/JS 项目](js-project-setup.md)文档。 +使用 Kotlin/JS 的推荐方法是通过 `kotlin.multiplatform` Gradle 插件。它提供了一种集中且便捷的方式来设置与控制以 JavaScript 为目标的 Kotlin 项目。 这包括基本特性, +例如控制应用程序的捆绑,直接从 npm 添加 JavaScript 依赖项等等。要获得可用选项的概述,请查看[搭建 Kotlin/JS 项目](js-project-setup.md)。 ## Kotlin/JS IR 编译器 @@ -23,56 +24,6 @@ Kotlin/JS 提供了转换 Kotlin 代码、Kotlin 标准库的能力,并且兼 如需了解关于 Kotlin/JS IR 编译器中可用特性的更多信息,以及如何在项目中尝试使用它,请访问 [Kotlin/JS IR 编译器文档页](js-ir-compiler.md)及其[迁移指南](js-ir-migration.md)。 -## Kotlin/JS 的使用场景 - -有很多使用 Kotlin/JS 的方式。这里列出了可以使用 Kotlin/JS -的场景的一个不完全的清单。 - -* **使用 Kotlin/JS 编写 Web 前端应用程序** - * Kotlin/JS 允许以类型安全的方式 **利用功能强大的浏览器与 Web API**。创建、修改文档对象模型(DOM)中的元素并与之交互,使用 Kotlin 代码控制 `canvas` 或 WebGL 组件的呈现, - 并享受现代浏览器所支持的更多特性的访问。 - * 使用 JetBrains 提供的 [`kotlin-wrappers`](https://github.com/JetBrains/kotlin-wrappers) - **用 Kotlin/JS 编写完整的,类型安全的 React 应用程序**,它为 React 及其他流行 JavaScript 框架提供方便的抽象与深度集成。 - `kotlin-wrappers` 还为许多类似技术(例如 - `react-redux`、`react-router` 以及 `styled-components`)提供支持。 - 与 JavaScript 生态系统的互操作性意味着可以使用第三方 React 组件与组件库。 - * 使用 **[Kotlin/JS 框架](#kotlin-js-框架)**,充分利用 Kotlin 相关概念及其表现力与简洁性(例如 [kvision](https://kvision.io) 或 [fritz2](https://www.fritz2.dev/))。 - -* **使用 Kotlin/JS 编写服务器端与无服务器应用程序** - * Kotlin/JS 提供的 Node.js 目标能够创建**在服务器上运行**或在**无服务器基础架构上执行**的应用程序。可以享受在 JavaScript - 运行时中执行的所有优势,例如**更快的启动**与**更少的内存占用**。使用 [`kotlinx-nodejs`](https://github.com/Kotlin/kotlinx-nodejs), - 可以直接从 Kotlin 代码中对 [Node.js API](https://nodejs.org/docs/latest/api/) 进行类型安全的访问。 - -* **使用 Kotlin 的[多平台](multiplatform.md)项目与其他 Kotlin 目标共享代码** - * 使用 `multiplatform` 多平台 Gradle 插件时,也可以访问所有 Kotlin/JS 功能。 - * 如果用 Kotlin 编写的后端,那么可以与用 - Kotlin/JS 编写的前端**共享公共代码**,例如数据模型或逻辑验证,从而能够**编写与维护全栈 Web 应用程序**。 - * 还可以**在 Web 界面与移动应用之间共享业务逻辑**(Android 与 iOS),并避免重复实现常见的功能,例如围绕 REST API 端点提供抽象,用户身份验证或者领域模型。 - -* **创建用于 JavaScript 与 TypeScript 的库** - * 也不必用 Kotlin/JS 编写整个应用程序——而是可以**从 Kotlin 代码生成库**, - 这些库可以在 JavaScript 或 TypeScript 编写的任何代码库中作为模块使用,而与所使用的其他框架或技术无关。这种**创建混合应用程序**的方法可以利用个人与团队在 Web 开发方面已经具备的能力,同时**减少重复的工作量**、 - 使 Web 目标与应用程序的其他目标平台保持一致变得更加容易。 - -当然,这并不是如何充分利用 Kotlin/JS 的完整列表,而只是一些精选的使用场景。 -请尝试不同的组合,并找出最适合项目的方案。 - -无论具体用例如何,Kotlin/JS 项目都可以使用兼容**Kotlin 生态系统中的库**, -以及第三方的**JavaScript 与 TypeScript 生态系统中的库**。如果要在 Kotlin 代码中使用后者, -可以提供自己的类型安全包装器、使用社区维护的包装器, 也可以让 [Dukat](https://github.com/kotlin/dukat) -生成 Kotlin 声明。使用 Kotlin/JS 专有的[动态类型](dynamic-type.md)可以放宽 Kotlin -的类型系统的约束,而跳过创建详细的库包装器,尽管这是以牺牲类型安全为代价。 - -Kotlin/JS 还与最常见的模块系统兼容:UMD、CommonJS 与 AMD。能够[生产与使用模块](js-modules.md)意味着能够以结构化的方式与 JavaScript 生态系统进行交互。 - ## Kotlin/JS 框架 Modern web development benefits significantly from frameworks that simplify building web applications. @@ -112,59 +63,7 @@ over the rendering of arbitrary UI elements, vector shapes, gradients, and custo For updates and discussions about the framework, join the [#doodle](https://kotlinlang.slack.com/messages/doodle) and [#javascript](https://kotlinlang.slack.com/archives/C0B8L3U69) channels in the [Kotlin Slack](https://surveys.jetbrains.com/s3/kotlin-slack-sign-up). -### Compose for Web - -_Compose for Web_, a part of Compose Multiplatform, brings [Google's Jetpack Compose UI toolkit](https://developer.android.com/jetpack/compose) -to your browser. It allows you to build reactive web user interfaces using the concepts introduced by Jetpack Compose. -It provides a DOM API to describe your website, as well as an experimental set of multiplatform layout primitives. -Compose for Web also gives you the option to share parts of your UI code and logic across Android, desktop, and the web. - -You can find more information about Compose Multiplatform on its [landing page](https://www.jetbrains.com/lp/compose-mpp/). - -Join the [#compose-web](https://kotlinlang.slack.com/archives/C01F2HV7868) channel on the [Kotlin Slack](https://surveys.jetbrains.com/s3/kotlin-slack-sign-up) -to discuss Compose for Web, or [#compose](https://kotlinlang.slack.com/archives/CJLTWPH7S) for general Compose Multiplatform discussions. - -## Kotlin/JS 今天与明天 - -在这个视频中([YouTube](https://www.youtube.com/watch?v=fZUL8_kgHXg)、[bilibili](https://player.bilibili.com/player.html?aid=926746622&bvid=BV1FT4y1L77i&cid=223227283&page=1)),Kotlin 开发者布道师 Sebastian Aigner 解释了 Kotlin/JS -的主要优点、分享一些技巧与使用场景,并探讨 Kotlin/JS 的计划与即将发布的特性。 - -
-
- -## Kotlin/JS 入门 - -如果不熟悉 Kotlin,那么第一步最好是熟悉该语言的[基本语法](basic-syntax.md)。 - -如需开始将 Kotlin 用于 JavaScript,请参考[搭建 Kotlin/JS 项目](js-project-setup.md)。 You can also -complete a [tutorial](#tutorials-for-kotlin-js) to work through or check out the list of [Kotlin/JS sample projects](#kotlin-js-范例项目) -for inspiration. They contain useful snippets and patterns and can serve as nice jump-off points for your own projects. - -### Tutorials for Kotlin/JS - -* [Build a web application with React and Kotlin/JS — tutorial](js-react.md) -guides you through the process of building a simple web application using the React framework, shows how a type-safe Kotlin -DSL for HTML makes it easy to build reactive DOM elements, and illustrates how to use third-party React components and -obtain information from APIs, all while writing the whole application logic in pure Kotlin/JS. - -* [Build a full-stack web app with Kotlin Multiplatform](multiplatform-full-stack-app.md) -teaches the concepts behind building an application that targets Kotlin/JVM and Kotlin/JS by building a client-server -application that makes use of shared code, serialization, and other multiplatform paradigms. It also provides a brief -introduction to working with Ktor both as a server- and client-side framework. - -### Kotlin/JS 范例项目 - -* [Full-stack Spring collaborative to-do list](https://github.com/Kotlin/full-stack-spring-collaborative-todo-list-sample) -shows how to create a to-do list for collaborative work using `kotlin-multiplatform` with JS and JVM targets, Spring -for the backend, Kotlin/JS with React for the frontend, and RSocket. -* [Kotlin/JS and React Redux to-do list](https://github.com/Kotlin/react-redux-js-ir-todo-list-sample) implements -the React Redux to-do list using JS libraries (`react`, `react-dom`, `react-router`, `redux`, and `react-redux`) -from npm and Webpack to bundle, minify, and run the project. -* [Full-stack demo application](https://github.com/Kotlin/full-stack-web-jetbrains-night-sample) guides you through -the process of building an app with a feed containing user-generated posts and comments. All data is stubbed by -the fakeJSON and JSON Placeholder services. - ## 加入 Kotlin/JS 社区 -还可以在官方 [Kotlin Slack](https://surveys.jetbrains.com/s3/kotlin-slack-sign-up) 中加入 [#javascript](https://kotlinlang.slack.com/archives/C0B8L3U69) 频道, +可以在官方 [Kotlin Slack](https://surveys.jetbrains.com/s3/kotlin-slack-sign-up) 中加入 [#javascript](https://kotlinlang.slack.com/archives/C0B8L3U69) 频道, 同社区与团队交谈。 \ No newline at end of file diff --git a/docs/topics/js/js-project-setup.md b/docs/topics/js/js-project-setup.md index cb0c6a5fc78..2765463f137 100644 --- a/docs/topics/js/js-project-setup.md +++ b/docs/topics/js/js-project-setup.md @@ -1,26 +1,20 @@ [//]: # (title: 搭建 Kotlin/JS 项目) Kotlin/JS 项目使用 Gradle 作为构建系统。为了开发者轻松管理其 Kotlin/JS 项目,我们提供了 -`kotlin.js` Gradle 插件,该插件提供项目配置工具以及用以自动执行 JavaScript +`kotlin.multiplatform` Gradle 插件,该插件提供项目配置工具以及用以自动执行 JavaScript 开发中常用的例程的帮助程序。例如,该插件会在后台下载 [Yarn](https://yarnpkg.com/) 软件包管理器, 用于管理 [npm](https://www.npmjs.com/) 依赖,并且可以使用 [webpack](https://webpack.js.org/) 由 Kotlin 项目构建 JavaScript 包。 可以直接从 Gradle 构建文件中对依赖项管理与配置进行很大程度的调整,并且可以选择覆盖自动生成的配置以实现完全控制。 -要在 IntelliJ IDEA 中创建 Kotlin/JS 项目,请转至 **文件(File) \| 新建(New) \| 项目(Project)**。 -然后选择 **Kotlin Multiplatform** 并选择最适合的 Kotlin/JS 目标。不要忘记选择构建脚本的语言:Groovy 或 Kotlin。 - -![New project wizard](js-new-project-1.png){width=700} - -另外,还可以在 Gradle 构建文件 -(`build.gradle(.kts)`)中手动将 `org.jetbrains.kotlin.js` 插件应用于 Gradle 项目。 +You can apply the `org.jetbrains.kotlin.multiplatform` plugin to a Gradle project manually in the `build.gradle(.kts)` file: ```kotlin plugins { - kotlin("js") version "%kotlinVersion%" + kotlin("multiplatform") version "%kotlinVersion%" } ``` @@ -29,7 +23,7 @@ plugins { ```groovy plugins { - id 'org.jetbrains.kotlin.js' version '%kotlinVersion%' + id 'org.jetbrains.kotlin.multiplatform' version '%kotlinVersion%' } ``` @@ -112,7 +106,7 @@ dependencies { -Kotlin/JS Gradle 插件还支持构建脚本的 `kotlin` 部分中特定 +Kotlin Multiplatform Gradle 插件还支持构建脚本的 `kotlin` 部分中特定 `sourceSets` 的依赖声明。 @@ -120,8 +114,12 @@ Kotlin/JS Gradle 插件还支持构建脚本的 `kotlin` 部分中特定 ```kotlin kotlin { - sourceSets["main"].dependencies { - implementation("org.example.myproject", "1.1.0") + sourceSets { + val jsMain by getting { + dependencies { + implementation("org.example.myproject:1.1.0") + } + } } } ``` @@ -132,7 +130,7 @@ kotlin { ```groovy kotlin { sourceSets { - main { + jsMain { dependencies { implementation 'org.example.myproject:1.1.0' } @@ -152,18 +150,26 @@ kotlin { ### Kotlin 标准库 -所有 Kotlin/JS 项目都必须依赖 Kotlin/JS [标准库](https://kotlinlang.org/api/latest/jvm/stdlib/), -并且是隐含的——无需添加任何构件。 +The dependencies on the [standard library](https://kotlinlang.org/api/latest/jvm/stdlib/index.html) +is added automatically. The version of the standard library is the same as the version of the `kotlin-multiplatform` plugin. -如果你的项目包含用 Kotlin 编写的测试,那么还应该添加 -[kotlin.test](https://kotlinlang.org/api/latest/kotlin.test/) 依赖项: +The [`kotlin.test`](https://kotlinlang.org/api/latest/kotlin.test/) API is available for multiplatform tests. +When you create a multiplatform project, the Project Wizard automatically adds test dependencies to all the source sets. + +If you didn't use the Project Wizard to create your project, you can add the dependencies manually: ```kotlin -dependencies { - testImplementation(kotlin("test-js")) +kotlin { + sourceSets { + val commonTest by getting { + dependencies { + implementation(kotlin("test")) // This brings all the platform dependencies automatically + } + } + } } ``` @@ -171,8 +177,14 @@ dependencies { ```groovy -dependencies { - testImplementation 'org.jetbrains.kotlin:kotlin-test-js' +kotlin { + sourceSets { + commonTest { + dependencies { + implementation kotlin("test") // This brings all the platform dependencies automatically + } + } + } } ``` @@ -184,7 +196,7 @@ dependencies { 在 JavaScript 中,管理依赖项最常用的方式是 [npm](https://www.npmjs.com/)。 它提供了最大的 JavaScript 模块公开存储库。 -Kotlin/JS Gradle 插件使你可以在 Gradle 构建脚本中声明 npm 依赖项,类似于声明其他依赖项的方式。 要声明 npm 依赖项,将其名称与版本传给依赖项声明内的 `npm()` 函数。 @@ -213,7 +225,7 @@ dependencies { The plugin uses the [Yarn](https://classic.yarnpkg.com/zh-Hans/) package manager to download and install NPM dependencies. It works out of the box without additional configuration, but you can tune it to specific needs. -Learn how to [configure Yarn in Kotlin/JS Gradle plugin](#yarn). +Learn how to [configure Yarn in Kotlin Multiplatform Gradle plugin](#yarn). 除了常规的依赖之外,还有三种依赖类型可以从 Gradle DSL 中使用。 要了解更多关于哪种类型的依赖最适合使用的信息,请查看 npm 链接的官方文档: @@ -226,7 +238,7 @@ Learn how to [configure Yarn in Kotlin/JS Gradle plugin](#yarn). ## run 任务 -Kotlin/JS 插件提供了一个 `run` 任务,使你无需额外配置即可运行纯 Kotlin/JS 项目。 +Kotlin/JS 插件提供了一个 `jsRun` 任务,使你无需额外配置即可运行纯 Kotlin/JS 项目。 对于运行 Kotlin/JS 项目在浏览器中,此任务是 `browserDevelopmentRun` 任务的别名(在 Kotlin 多平台项目中也可用)。它使用 [webpack-dev-server](https://webpack.js.org/configuration/dev-server/) @@ -234,33 +246,32 @@ Kotlin 多平台项目中也可用)。它使用 [webpack-dev-server](https://w 如果要自定义 `webpack-dev-server` 的配置,例如更改服务器端口, 请使用 [webpack 配置文件](#webpack-绑定)。 -对于运行针对 Node.js 的 Kotlin/JS项目,`run` 任务是 `nodeRun` 任务的别名(在 -Kotlin 多平台项目中也可用)。 +对于运行针对 Node.js 的 Kotlin/JS项目, use the `jsRun` task that is an alias for the `nodeRun` task. -要运行项目,请执行标准生命周期的 `run` 任务,或对应的别名: +要运行项目,请执行标准生命周期的 `jsRun` 任务,或对应的别名: ```bash -./gradlew run +./gradlew jsRun ``` 要在对源文件进行更改后自动触发应用程序的重新构建,请使用 Gradle [持续构建(continuous build)](https://docs.gradle.org/current/userguide/command_line_interface.html#sec:continuous_build)特性: ```bash -./gradlew run --continuous +./gradlew jsRun --continuous ``` 或者 ```bash -./gradlew run -t +./gradlew jsRun -t ``` 一旦项目构建成功,`webpack-dev-server` 将自动刷新浏览器页面。 ## test 任务 -Kotlin/JS Gradle 插件会自动为项目设置测试基础结构。对于浏览器项目,它将下载并安装具有其他必需依赖的 +Kotlin Multiplatform Gradle 插件会自动为项目设置测试基础结构。对于浏览器项目,它将下载并安装具有其他必需依赖的 [Karma](https://karma-runner.github.io/) 测试运行程序; 对于 Node.js 项目,使用 [Mocha](https://mochajs.org/) 测试框架。 @@ -305,7 +316,7 @@ kotlin.js.browser.karma.browsers=firefox,safari This approach allows you to define a list of browsers for all modules, and then add specific browsers in the build scripts of particular modules. -请注意,Kotlin/JS Gradle 插件不会自动安装这些浏览器,只会使用其执行环境中可用的浏览器。例如,如果要在持续集成服务器上执行 Kotlin/JS 测试, 请确保已安装要测试的浏览器。 @@ -347,7 +358,7 @@ kotlin { ### Karma 配置 -Kotlin/JS Gradle 插件会在构建时自动生成 Karma 配置文件,其中包括来自 `build.gradle(.kts)` 中的 [`kotlin.js.browser.testTask.useKarma` 块](#test-任务)的设置。可以在 `build/js/packages/projectName-test/karma.conf.js` 中找到该文件。 要调整 Karma 使用的配置,请将其他配置文件放在项目根目录中下用的设置可以直接从 `build.gradle(.kts)` 文件获得。 @@ -495,7 +506,7 @@ browser { } testTask { useKarma { - // . . . + // ... webpackConfig.cssSupport { enabled.set(true) } @@ -639,7 +650,7 @@ rootProject.plugins.withType(org.jetbrains.kotlin.gradle.targets.js.yarn.YarnPlu > {type="note"} -The `kotlin-js-store` directory in the project root is automatically generated by the Kotlin/JS Gradle plugin to hold +The `kotlin-js-store` directory in the project root is automatically generated by the Kotlin Multiplatform Gradle plugin to hold the `yarn.lock` file, which is necessary for version locking. The lockfile is entirely managed by the Yarn plugin and gets updated during the execution of the `kotlinNpmInstall` Gradle task. @@ -737,7 +748,7 @@ rootProject.plugins.withType(org.jetbrains.kotlin.gradle.targets.js.yarn.YarnPlu > {type="note"} -To reduce the likelihood of executing malicious code from compromised npm packages, the Kotlin/JS Gradle plugin prevents +To reduce the likelihood of executing malicious code from compromised npm packages, the Kotlin Multiplatform Gradle plugin prevents the execution of [lifecycle scripts](https://docs.npmjs.com/cli/v8/using-npm/scripts#life-cycle-scripts) during the installation of npm dependencies by default. @@ -766,7 +777,11 @@ rootProject.plugins.withType(org.jetbrains.kotlin.gradle.targets.js.yarn.YarnPlu ## 分发目标目录 -默认情况下,Kotlin/JS 项目构建的结果位于项目根目录下的 `/build/distribution` 目录中。 +默认情况下,Kotlin/JS 项目构建的结果位于项目根目录下的 `/build/dist//` 目录中。 + +> Prior to Kotlin 1.9.0, the default distribution target directory was `/build/distributions`. +> +{type="note" } 要为项目分发文件设置另一个位置,请在构建脚本中的 `browser` 里添加 `distribution`,然后为它的 `directory` 属性赋值。 @@ -820,14 +835,14 @@ js { } ``` -请注意,这不会影响 `build/distributions` 中的 Webpack 输出。 +请注意,这不会影响 `build/dist` 中的 Webpack 输出。 ## package.json 定制 `package.json` 文件保存 JavaScript 包的元数据。流行的软件仓库(例如 npm)要求所有已发布的软件包都具有此类文件。 软件仓库使用该文件来跟踪与管理软件包发布。 -Kotlin/JS Gradle 插件会在构建期间自动为 Kotlin/JS 项目生成 `package.json`。 +Kotlin Multiplatform Gradle 插件会在构建期间自动为 Kotlin/JS 项目生成 `package.json`。 默认情况下,该文件包含基本数据:名称、版本、许可证与依赖项,以及一些其他软件包属性。 除了基本的软件包属性外,`package.json` 还可定义 JavaScript 项目的行为方式, diff --git a/docs/topics/js/js-react.md b/docs/topics/js/js-react.md index 2fbd4a3f71a..aa0f60260f8 100644 --- a/docs/topics/js/js-react.md +++ b/docs/topics/js/js-react.md @@ -14,8 +14,7 @@ with links to conference talks. Users will be able to watch all the talks on one The tutorial assumes you have prior knowledge of Kotlin and basic knowledge of HTML and CSS. Understanding the basic concepts behind React may help you understand some sample code, but it is not strictly required. -> You can get the final application as well as the intermediate steps [here](https://github.com/kotlin-hands-on/web-app-react-kotlin-js-gradle). -> Each step is available from its own branch and is linked at the bottom of its corresponding section. +> You can get the final application [here](https://github.com/kotlin-hands-on/web-app-react-kotlin-js-gradle/tree/finished). > {type="note"} @@ -23,14 +22,14 @@ concepts behind React may help you understand some sample code, but it is not st 1. Download and install the latest version of [IntelliJ IDEA](https://www.jetbrains.com/idea/download/index.html). 2. Clone the [project template](https://github.com/kotlin-hands-on/web-app-react-kotlin-js-gradle) and open it in IntelliJ - IDEA. The template includes a basic Kotlin/JS Gradle project with all required configurations and dependencies + IDEA. The template includes a basic Kotlin Multiplatform Gradle project with all required configurations and dependencies * Dependencies and tasks in the `build.gradle.kts` file: ```kotlin dependencies { // React, React DOM + Wrappers - implementation(enforcedPlatform("org.jetbrains.kotlin-wrappers:kotlin-wrappers-bom:1.0.0-pre.354")) + implementation(enforcedPlatform("org.jetbrains.kotlin-wrappers:kotlin-wrappers-bom:1.0.0-pre.430")) implementation("org.jetbrains.kotlin-wrappers:kotlin-react") implementation("org.jetbrains.kotlin-wrappers:kotlin-react-dom") @@ -38,18 +37,18 @@ concepts behind React may help you understand some sample code, but it is not st implementation("org.jetbrains.kotlin-wrappers:kotlin-emotion") // Video Player - implementation(npm("react-player", "2.10.1")) + implementation(npm("react-player", "2.12.0")) // Share Buttons - implementation(npm("react-share", "4.4.0")) + implementation(npm("react-share", "4.4.1")) // Coroutines & serialization - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.3") - implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.3") + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") + implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.0") } ``` - * An HTML template page in `src/main/resources/index.html` for inserting JavaScript code that you'll be using in + * An HTML template page in `src/jsMain/resources/index.html` for inserting JavaScript code that you'll be using in this tutorial: ```html @@ -72,7 +71,7 @@ concepts behind React may help you understand some sample code, but it is not st the content of the body (including the `root` div) is loaded first to ensure that the browser loads all page elements before the scripts. -* A code snippet in `src/main/kotlin/Main.kt`: +* A code snippet in `src/jsMain/kotlin/Main.kt`: ```kotlin import kotlinx.browser.document @@ -84,7 +83,7 @@ concepts behind React may help you understand some sample code, but it is not st ### Run the development server -By default, the Kotlin/JS Gradle plugin comes with support for an embedded `webpack-dev-server`, allowing you to run +By default, the Kotlin Multiplatform Gradle plugin comes with support for an embedded `webpack-dev-server`, allowing you to run the application from the IDE without manually setting up any servers. To test that the program successfully runs in the browser, start the development server by invoking the `run` or @@ -164,7 +163,7 @@ fun main() { * The `render()` function instructs [kotlin-react-dom](https://github.com/JetBrains/kotlin-wrappers/tree/master/kotlin-react-dom) to render the first HTML element inside a [fragment](https://reactjs.org/docs/fragments.html) to the `root` element. - This element is a container defined in `src/main/resources/index.html`, which was included in the template. + This element is a container defined in `src/jsMain/resources/index.html`, which was included in the template. * The content is an `

` header and uses a typesafe DSL to render HTML. * `h1` is a function that takes a lambda parameter. When you add the `+` sign in front of a string literal, the `unaryPlus()` function is actually invoked using [operator overloading](operator-overloading.md). @@ -347,10 +346,6 @@ div { Feel free to experiment with some other styles. For example, you could change the `fontFamily` or add some `color` to your UI. -> You can find this state of the project in the `02-first-static-page` branch [here](https://github.com/kotlin-hands-on/web-app-react-kotlin-js-gradle/tree/02-first-static-page). -> -{type="note"} - ## Design app components The basic building blocks in React are called _[components](https://reactjs.org/docs/components-and-props.html)_. @@ -376,7 +371,7 @@ understand. To start creating the application's structure, first explicitly specify `App`, the main component for rendering to the `root`element: -1. Create a new `App.kt` file in the `src/main/kotlin` folder. +1. Create a new `App.kt` file in the `src/jsMain/kotlin` folder. 2. Inside this file, add the following snippet and move the typesafe HTML from `Main.kt` into it: ```kotlin @@ -424,7 +419,7 @@ reusable component, and only adjust the content displayed in the lists. The `VideoList` component follows the same pattern as the `App` component. It uses the `FC` builder function, and contains the code from the `unwatchedVideos` list. -1. Create a new `VideoList.kt` file in the `src/main/kotlin` folder and add the following code: +1. Create a new `VideoList.kt` file in the `src/jsMain/kotlin` folder and add the following code: ```kotlin import kotlinx.browser.window @@ -445,6 +440,7 @@ and contains the code from the `unwatchedVideos` list. ```kotlin // . . . + div { h3 { +"Videos to watch" @@ -456,6 +452,7 @@ and contains the code from the `unwatchedVideos` list. } VideoList() } + // . . . ``` @@ -527,6 +524,7 @@ First, add an alert message that pops up when users click on a list entry. In `V ```kotlin // . . . + p { key = video.id.toString() onClick = { @@ -534,6 +532,7 @@ p { } +"${video.speaker}: ${video.title}" } + // . . . ``` @@ -554,14 +553,15 @@ window like this: Instead of just alerting the user, you can add some functionality for highlighting the selected video with a ▶ triangle. To do that, introduce some _state_ specific to this component. -State is one of core concepts in React. In modern React (which uses the so-called _Hooks API_), state is expressed -using the [`useState` hook](https://reactjs.org/docs/hooks-state.html). +State is one of the core concepts in React. In modern React (which uses the so-called _Hooks API_), +state is expressed using the [`useState` hook](https://reactjs.org/docs/hooks-state.html). 1. Add the following code to the top of the `VideoList` declaration: ```kotlin val VideoList = FC { props -> var selectedVideo: Video? by useState(null) + // . . . ``` {validate="false"} @@ -576,7 +576,7 @@ using the [`useState` hook](https://reactjs.org/docs/hooks-state.html). To learn more about the State Hook, check out the [React documentation](https://reactjs.org/docs/hooks-state.html). -2. Change your implementation of the `VideoList` component to look as follows: +2. Change the `onClick` handler and the text in the `VideoList` component to look as follows: ```kotlin val VideoList = FC { props -> @@ -603,10 +603,6 @@ You can find more details about state management in the [React FAQ](https://reac Check the browser and click an item in the list to make sure that everything is working correctly. -> You can find this state of the project in the `03-first-component` branch [here](https://github.com/kotlin-hands-on/web-app-react-kotlin-js-gradle/tree/03-first-component). -> -{type="note"} - ## Compose components Currently, the two video lists work on their own, meaning that each list keeps track of a selected video. @@ -634,6 +630,7 @@ as state to the `App` component: ```kotlin val App = FC { var currentVideo: Video? by useState(null) + // . . . } ``` @@ -685,8 +682,10 @@ Remember that in Kotlin, variables can have the [type of a function](lambdas.md# props.onSelectVideo(video) } ``` + + You can now delete the `selectedVideo` variable from the `VideoList` component. -3. You can now go back to the `App` component and pass `selectedVideo` and a handler for `onSelectVideo` +3. Go back to the `App` component and pass `selectedVideo` and a handler for `onSelectVideo` for each of the two video lists: ```kotlin @@ -703,10 +702,6 @@ Remember that in Kotlin, variables can have the [type of a function](lambdas.md# Switch back to your browser and make sure that when selecting a video the selection jumps between the two lists without duplication. -> You can find this state of the project on the `04-composing-components` branch [here](https://github.com/kotlin-hands-on/web-app-react-kotlin-js-gradle/tree/04-composing-components). -> -{type="note"} - ## Add more components ### Extract the video player component @@ -813,7 +808,7 @@ Now it's time to adjust the `VideoPlayer` usage site in the `App` component. Whe should be moved from the unwatched list to the watched list or vice versa. Since these lists can now actually change, move them into the application state: -1. In `App.kt`, add the following `useState()` calls to the top of the `App` component: +1. In `App.kt`, add the following properties with `useState()` calls to the top of the `App` component: ```kotlin val App = FC { @@ -826,6 +821,7 @@ change, move them into the application state: var watchedVideos: List