Skip to content

Commit 5c430ae

Browse files
committed
Address lots of warnings and general code cleanup
1 parent 9a4e5d3 commit 5c430ae

217 files changed

Lines changed: 899 additions & 988 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

buildSrc/src/main/kotlin/mcdev-core.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ kotlin {
6767
compilerOptions {
6868
jvmTarget = JvmTarget.JVM_21
6969
languageVersion = KotlinVersion.KOTLIN_2_2
70+
apiVersion = KotlinVersion.KOTLIN_2_2
7071
jvmDefault = JvmDefaultMode.NO_COMPATIBILITY
7172
freeCompilerArgs = listOf("-Xjdk-release=21")
7273
optIn.add("kotlin.contracts.ExperimentalContracts")

gradle/libs.versions.toml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
11
[versions]
2-
kotlin = "2.3.20"
2+
# https://github.com/JetBrains/intellij-community/blob/<version>/.idea/libraries/kotlin_stdlib.xml
3+
kotlin = "2.2.0-RC2"
4+
# https://github.com/JetBrains/intellij-community/blob/<version>/.idea/libraries/kotlinx_coroutines_core.xml
35
coroutines = "1.10.2"
46
junit = "6.0.3"
57
asm = "9.9.1"
68
fuel = "2.3.1"
79
licenser = "0.7.5"
810
changelog = "2.5.0"
11+
# https://github.com/JetBrains/intellij-platform-gradle-plugin
912
intellij-plugin = "2.13.1"
13+
# https://central.sonatype.com/artifact/org.jetbrains.intellij/plugin-repository-rest-client
1014
intellij-plugin-repository-rest-client = "2.0.50"
15+
# https://www.jetbrains.com/intellij-repository/snapshots or https://www.jetbrains.com/intellij-repository/releases/
16+
# Search for com.jetbrains.intellij.idea
1117
intellij-ide = "2025.2"
18+
# https://github.com/JetBrains/gradle-idea-ext-plugin
1219
idea-ext = "1.4.1"
1320

1421
[plugins]
@@ -42,6 +49,8 @@ jflex-skeleton = "org.jetbrains.idea:jflex:1.7.0-c1fdf11"
4249
grammarKit = "org.jetbrains.idea:grammar-kit:1.5.1"
4350

4451
# Gradle Tooling
52+
# https://www.jetbrains.com/intellij-repository/snapshots or https://www.jetbrains.com/intellij-repository/releases/
53+
# Search for com.jetbrains.intellij.gradle
4554
gradleToolingExtension = { module = "com.jetbrains.intellij.gradle:gradle-tooling-extension", version = "252.23892.409" }
4655
annotations = "org.jetbrains:annotations:26.1.0"
4756
groovy = "org.codehaus.groovy:groovy:3.0.25"

src/main/kotlin/TranslationSettings.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* https://mcdev.io/
55
*
6-
* Copyright (C) 2025 minecraft-dev
6+
* Copyright (C) 2026 minecraft-dev
77
*
88
* This program is free software: you can redistribute it and/or modify
99
* it under the terms of the GNU Lesser General Public License as published
@@ -21,18 +21,20 @@
2121
package com.demonwav.mcdev
2222

2323
import com.intellij.openapi.components.PersistentStateComponent
24+
import com.intellij.openapi.components.Service
2425
import com.intellij.openapi.components.State
2526
import com.intellij.openapi.components.Storage
2627
import com.intellij.openapi.components.service
2728
import com.intellij.openapi.project.Project
2829

30+
@Service(Service.Level.PROJECT)
2931
@State(name = "TranslationSettings", storages = [Storage("minecraft_dev.xml")])
3032
class TranslationSettings : PersistentStateComponent<TranslationSettings.State> {
3133

3234
data class State(
3335
var isForceJsonTranslationFile: Boolean = false,
3436
var isUseCustomConvertToTranslationTemplate: Boolean = false,
35-
var convertToTranslationTemplate: String = "net.minecraft.client.resources.I18n.format(\"\$key\")",
37+
var convertToTranslationTemplate: String = $$"net.minecraft.client.resources.I18n.format(\"$key\")",
3638
)
3739

3840
private var state = State()

src/main/kotlin/asset/GeneralAssets.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* https://mcdev.io/
55
*
6-
* Copyright (C) 2025 minecraft-dev
6+
* Copyright (C) 2026 minecraft-dev
77
*
88
* This program is free software: you can redistribute it and/or modify
99
* it under the terms of the GNU Lesser General Public License as published
@@ -20,7 +20,6 @@
2020

2121
package com.demonwav.mcdev.asset
2222

23-
@Suppress("unused")
2423
object GeneralAssets : Assets() {
2524
val LISTENER = loadIcon("/assets/icons/general/EventListener_dark.png")
2625
val PLUGIN = loadIcon("/assets/icons/general/plugin.png")

src/main/kotlin/creator/JdkComboBoxWithPreference.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* https://mcdev.io/
55
*
6-
* Copyright (C) 2025 minecraft-dev
6+
* Copyright (C) 2026 minecraft-dev
77
*
88
* This program is free software: you can redistribute it and/or modify
99
* it under the terms of the GNU Lesser General Public License as published
@@ -89,8 +89,8 @@ class JdkComboBoxWithPreference internal constructor(
8989
preferenceData.jdk = version
9090
reloadModel()
9191

92-
for (jdkVersion in version.ordinal until JavaSdkVersion.values().size) {
93-
val jdk = JavaSdkVersion.values()[jdkVersion]
92+
for (jdkVersion in version.ordinal until JavaSdkVersion.entries.size) {
93+
val jdk = JavaSdkVersion.entries[jdkVersion]
9494

9595
val preferredSdkPath = preferenceData.sdkPathByJdk[jdk]
9696
if (preferredSdkPath != null) {
@@ -145,7 +145,7 @@ fun Row.jdkComboBoxWithPreference(
145145
for (preferenceDataStr in preferenceDataStrs) {
146146
val parts = preferenceDataStr.split('=', limit = 2)
147147
val featureVersion = parts.firstOrNull()?.toIntOrNull() ?: continue
148-
val knownJdkVersions = JavaSdkVersion.values()
148+
val knownJdkVersions = JavaSdkVersion.entries
149149
if (featureVersion !in knownJdkVersions.indices) {
150150
continue
151151
}

src/main/kotlin/creator/ProjectSetupFinalizerWizardStep.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* https://mcdev.io/
55
*
6-
* Copyright (C) 2025 minecraft-dev
6+
* Copyright (C) 2026 minecraft-dev
77
*
88
* This program is free software: you can redistribute it and/or modify
99
* it under the terms of the GNU Lesser General Public License as published
@@ -21,7 +21,6 @@
2121
package com.demonwav.mcdev.creator
2222

2323
import com.demonwav.mcdev.asset.MCDevBundle
24-
import com.demonwav.mcdev.creator.ProjectSetupFinalizer.Factory
2524
import com.demonwav.mcdev.creator.step.NewProjectWizardChainStep.Companion.nextStep
2625
import com.demonwav.mcdev.util.mapFirstNotNull
2726
import com.intellij.ide.wizard.AbstractNewProjectWizardStep

src/main/kotlin/creator/buildsystem/GradleFile.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* https://mcdev.io/
55
*
6-
* Copyright (C) 2025 minecraft-dev
6+
* Copyright (C) 2026 minecraft-dev
77
*
88
* This program is free software: you can redistribute it and/or modify
99
* it under the terms of the GNU Lesser General Public License as published
@@ -224,7 +224,7 @@ private fun makeStringLiteral(str: String): String {
224224
}
225225

226226
private fun escapeGString(str: String): String {
227-
return StringUtil.escapeStringCharacters(str.length, str, "\"\$", StringBuilder()).toString()
227+
return StringUtil.escapeStringCharacters(str.length, str, "\"$", StringBuilder()).toString()
228228
}
229229

230230
private fun makePluginStatement(plugin: GradlePlugin, kotlin: Boolean): String {

src/main/kotlin/creator/custom/BuiltinValidations.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* https://mcdev.io/
55
*
6-
* Copyright (C) 2025 minecraft-dev
6+
* Copyright (C) 2026 minecraft-dev
77
*
88
* This program is free software: you can redistribute it and/or modify
99
* it under the terms of the GNU Lesser General Public License as published
@@ -65,7 +65,7 @@ object BuiltinValidations {
6565
}
6666

6767
fun byRegex(regex: Regex): DialogValidation.WithParameter<() -> String> =
68-
validationErrorIf<String>(MCDevBundle("creator.validation.regex", regex)) { !it.matches(regex) }
68+
validationErrorIf(MCDevBundle("creator.validation.regex", regex)) { !it.matches(regex) }
6969

7070
fun <T> isAnyOf(
7171
selectionGetter: () -> T,

src/main/kotlin/creator/custom/CreatorCredentials.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* https://mcdev.io/
55
*
6-
* Copyright (C) 2025 minecraft-dev
6+
* Copyright (C) 2026 minecraft-dev
77
*
88
* This program is free software: you can redistribute it and/or modify
99
* it under the terms of the GNU Lesser General Public License as published
@@ -148,8 +148,8 @@ object CreatorCredentials {
148148
// First check credentials in IntelliJ IDEA
149149
if (repoData.username.isNotBlank()) {
150150
val credentials = getCredentials(repoData.url, repoData.username)
151-
var username = credentials?.userName
152-
var password = credentials?.getPasswordAsString()
151+
val username = credentials?.userName
152+
val password = credentials?.getPasswordAsString()
153153
if (username != null && password != null) {
154154
return username to password
155155
}

src/main/kotlin/creator/custom/CustomPlatformStep.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* https://mcdev.io/
55
*
6-
* Copyright (C) 2025 minecraft-dev
6+
* Copyright (C) 2026 minecraft-dev
77
*
88
* This program is free software: you can redistribute it and/or modify
99
* it under the terms of the GNU Lesser General Public License as published
@@ -59,6 +59,7 @@ import kotlinx.coroutines.launch
5959
/**
6060
* The step to select a custom template repo.
6161
*/
62+
@Suppress("RemoveExplicitTypeArguments")
6263
class CustomPlatformStep(
6364
parent: NewProjectWizardStep,
6465
) : AbstractNewProjectWizardStep(parent) {

0 commit comments

Comments
 (0)