Skip to content

Commit

Permalink
Update kotlinx-metadata-jvm to 0.6.0 and Kotlin to 1.8.10 (Kotlin#119)
Browse files Browse the repository at this point in the history
Remove -Xskip-runtime-version-check flag as it is deprecated and has no effect

Add -Xsuppress-version-warnings flag to suppress "LV 1.4 is deprecated" warning and enable allWarningsAsErrors back

Remove unused declarations that contained deprecated code (.lowercase())
  • Loading branch information
sandwwraith authored Feb 15, 2023
1 parent 79c3667 commit b1cb068
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 17 deletions.
16 changes: 8 additions & 8 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ configurations.implementation {

dependencies {
implementation(gradleApi())
implementation("org.jetbrains.kotlinx:kotlinx-metadata-jvm:0.5.0")
implementation("org.jetbrains.kotlinx:kotlinx-metadata-jvm:0.6.0")
implementation("org.ow2.asm:asm:9.2")
implementation("org.ow2.asm:asm-tree:9.2")
implementation("com.googlecode.java-diff-utils:diffutils:1.3.0")
compileOnly("org.jetbrains.kotlin.multiplatform:org.jetbrains.kotlin.multiplatform.gradle.plugin:1.6.0")
compileOnly("org.jetbrains.kotlin.multiplatform:org.jetbrains.kotlin.multiplatform.gradle.plugin:1.8.10")
// compileOnly("com.android.tools.build:gradle:${androidGradlePluginVersion}")

// The test needs the full kotlin multiplatform plugin loaded as it has no visibility of previously loaded plugins,
Expand All @@ -96,15 +96,15 @@ dependencies {

tasks.compileKotlin {
kotlinOptions.apply {
allWarningsAsErrors = true

languageVersion = "1.4"
apiVersion = "1.4"
jvmTarget = "1.8"
// TODO revert that when updating Kotlin. This flag also affects kts files and prevents
// the project from build due to "w: Language version 1.4 is deprecated and its support will be removed"
// allWarningsAsErrors = true
// Suppress the warning about kotlin-reflect 1.3 and kotlin-stdlib 1.4 in the classpath.
// It's incorrect in this case because we're limiting API version to 1.3 anyway.
freeCompilerArgs += "-Xskip-runtime-version-check"

// Suppressing "w: Language version 1.4 is deprecated and its support will be removed" message
// because LV=1.4 in practice is mandatory as it is a default language version in Gradle 7.0+ for users' kts scripts.
freeCompilerArgs += "-Xsuppress-version-warnings"
}
}

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version=0.12.1-SNAPSHOT
group=org.jetbrains.kotlinx

kotlinVersion=1.6.0
kotlinVersion=1.8.10
pluginPublishVersion=0.10.1

kotlin.stdlib.default.dependency=false
6 changes: 3 additions & 3 deletions src/main/kotlin/api/KotlinMetadataVisibilities.kt
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/*
* Copyright 2016-2020 JetBrains s.r.o.
* Copyright 2016-2023 JetBrains s.r.o.
* Use of this source code is governed by the Apache 2.0 License that can be found in the LICENSE.txt file.
*/

package kotlinx.validation.api

import kotlinx.metadata.*
import kotlinx.metadata.jvm.*
import kotlinx.metadata.jvm.KotlinClassHeader.Companion.COMPATIBLE_METADATA_VERSION
import kotlinx.metadata.jvm.KotlinClassMetadata.Companion.COMPATIBLE_METADATA_VERSION
import org.objectweb.asm.tree.*

class ClassVisibility(
Expand Down Expand Up @@ -58,7 +58,7 @@ val ClassNode.kotlinMetadata: KotlinClassMetadata?
val metadata = findAnnotation("kotlin/Metadata", false) ?: return null
@Suppress("UNCHECKED_CAST")
val header = with(metadata) {
KotlinClassHeader(
Metadata(
kind = get("k") as Int?,
metadataVersion = (get("mv") as List<Int>?)?.toIntArray(),
data1 = (get("d1") as List<String>?)?.toTypedArray(),
Expand Down
6 changes: 1 addition & 5 deletions src/test/kotlin/tests/utils.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2020 JetBrains s.r.o.
* Copyright 2016-2023 JetBrains s.r.o.
* Use of this source code is governed by the Apache 2.0 License that can be found in the LICENSE.txt file.
*/

Expand Down Expand Up @@ -39,7 +39,3 @@ private fun CharSequence.trimTrailingWhitespacesAndAddNewlineAtEOF(): String =
this.lineSequence().map { it.trimEnd() }.joinToString(separator = "\n").let {
if (it.endsWith("\n")) it else it + "\n"
}


private val UPPER_CASE_CHARS = Regex("[A-Z]+")
fun String.replaceCamelCaseWithDashedLowerCase() = replace(UPPER_CASE_CHARS) { "-" + it.value.toLowerCase() }

0 comments on commit b1cb068

Please sign in to comment.