User: kyle wood Date: 28 Mar 26 07:34 Revision: 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6 Summary: Address lots of warnings and general code cleanup TeamCity URL: http://ci.mcdev.io:80/viewModification.html?tab=vcsModificationFiles&modId=10448&personal=false Index: buildSrc/src/main/kotlin/mcdev-core.gradle.kts =================================================================== --- buildSrc/src/main/kotlin/mcdev-core.gradle.kts (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ buildSrc/src/main/kotlin/mcdev-core.gradle.kts (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -67,6 +67,7 @@ compilerOptions { jvmTarget = JvmTarget.JVM_21 languageVersion = KotlinVersion.KOTLIN_2_2 + apiVersion = KotlinVersion.KOTLIN_2_2 jvmDefault = JvmDefaultMode.NO_COMPATIBILITY freeCompilerArgs = listOf("-Xjdk-release=21") optIn.add("kotlin.contracts.ExperimentalContracts") Index: gradle/libs.versions.toml =================================================================== --- gradle/libs.versions.toml (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ gradle/libs.versions.toml (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -1,14 +1,21 @@ [versions] -kotlin = "2.3.20" +# https://github.com/JetBrains/intellij-community/blob//.idea/libraries/kotlin_stdlib.xml +kotlin = "2.2.0-RC2" +# https://github.com/JetBrains/intellij-community/blob//.idea/libraries/kotlinx_coroutines_core.xml coroutines = "1.10.2" junit = "6.0.3" asm = "9.9.1" fuel = "2.3.1" licenser = "0.7.5" changelog = "2.5.0" +# https://github.com/JetBrains/intellij-platform-gradle-plugin intellij-plugin = "2.13.1" +# https://central.sonatype.com/artifact/org.jetbrains.intellij/plugin-repository-rest-client intellij-plugin-repository-rest-client = "2.0.50" +# https://www.jetbrains.com/intellij-repository/snapshots or https://www.jetbrains.com/intellij-repository/releases/ +# Search for com.jetbrains.intellij.idea intellij-ide = "2025.2" +# https://github.com/JetBrains/gradle-idea-ext-plugin idea-ext = "1.4.1" [plugins] @@ -42,6 +49,8 @@ grammarKit = "org.jetbrains.idea:grammar-kit:1.5.1" # Gradle Tooling +# https://www.jetbrains.com/intellij-repository/snapshots or https://www.jetbrains.com/intellij-repository/releases/ +# Search for com.jetbrains.intellij.gradle gradleToolingExtension = { module = "com.jetbrains.intellij.gradle:gradle-tooling-extension", version = "252.23892.409" } annotations = "org.jetbrains:annotations:26.1.0" groovy = "org.codehaus.groovy:groovy:3.0.25" Index: src/main/kotlin/TranslationSettings.kt =================================================================== --- src/main/kotlin/TranslationSettings.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/TranslationSettings.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -21,18 +21,20 @@ package com.demonwav.mcdev import com.intellij.openapi.components.PersistentStateComponent +import com.intellij.openapi.components.Service import com.intellij.openapi.components.State import com.intellij.openapi.components.Storage import com.intellij.openapi.components.service import com.intellij.openapi.project.Project +@Service(Service.Level.PROJECT) @State(name = "TranslationSettings", storages = [Storage("minecraft_dev.xml")]) class TranslationSettings : PersistentStateComponent { data class State( var isForceJsonTranslationFile: Boolean = false, var isUseCustomConvertToTranslationTemplate: Boolean = false, - var convertToTranslationTemplate: String = "net.minecraft.client.resources.I18n.format(\"\$key\")", + var convertToTranslationTemplate: String = $$"net.minecraft.client.resources.I18n.format(\"$key\")", ) private var state = State() Index: src/main/kotlin/asset/GeneralAssets.kt =================================================================== --- src/main/kotlin/asset/GeneralAssets.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/asset/GeneralAssets.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -20,7 +20,6 @@ package com.demonwav.mcdev.asset -@Suppress("unused") object GeneralAssets : Assets() { val LISTENER = loadIcon("/assets/icons/general/EventListener_dark.png") val PLUGIN = loadIcon("/assets/icons/general/plugin.png") Index: src/main/kotlin/creator/JdkComboBoxWithPreference.kt =================================================================== --- src/main/kotlin/creator/JdkComboBoxWithPreference.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/creator/JdkComboBoxWithPreference.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -89,8 +89,8 @@ preferenceData.jdk = version reloadModel() - for (jdkVersion in version.ordinal until JavaSdkVersion.values().size) { - val jdk = JavaSdkVersion.values()[jdkVersion] + for (jdkVersion in version.ordinal until JavaSdkVersion.entries.size) { + val jdk = JavaSdkVersion.entries[jdkVersion] val preferredSdkPath = preferenceData.sdkPathByJdk[jdk] if (preferredSdkPath != null) { @@ -145,7 +145,7 @@ for (preferenceDataStr in preferenceDataStrs) { val parts = preferenceDataStr.split('=', limit = 2) val featureVersion = parts.firstOrNull()?.toIntOrNull() ?: continue - val knownJdkVersions = JavaSdkVersion.values() + val knownJdkVersions = JavaSdkVersion.entries if (featureVersion !in knownJdkVersions.indices) { continue } Index: src/main/kotlin/creator/ProjectSetupFinalizerWizardStep.kt =================================================================== --- src/main/kotlin/creator/ProjectSetupFinalizerWizardStep.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/creator/ProjectSetupFinalizerWizardStep.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -21,7 +21,6 @@ package com.demonwav.mcdev.creator import com.demonwav.mcdev.asset.MCDevBundle -import com.demonwav.mcdev.creator.ProjectSetupFinalizer.Factory import com.demonwav.mcdev.creator.step.NewProjectWizardChainStep.Companion.nextStep import com.demonwav.mcdev.util.mapFirstNotNull import com.intellij.ide.wizard.AbstractNewProjectWizardStep Index: src/main/kotlin/creator/buildsystem/GradleFile.kt =================================================================== --- src/main/kotlin/creator/buildsystem/GradleFile.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/creator/buildsystem/GradleFile.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -224,7 +224,7 @@ } private fun escapeGString(str: String): String { - return StringUtil.escapeStringCharacters(str.length, str, "\"\$", StringBuilder()).toString() + return StringUtil.escapeStringCharacters(str.length, str, "\"$", StringBuilder()).toString() } private fun makePluginStatement(plugin: GradlePlugin, kotlin: Boolean): String { Index: src/main/kotlin/creator/custom/BuiltinValidations.kt =================================================================== --- src/main/kotlin/creator/custom/BuiltinValidations.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/creator/custom/BuiltinValidations.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -65,7 +65,7 @@ } fun byRegex(regex: Regex): DialogValidation.WithParameter<() -> String> = - validationErrorIf(MCDevBundle("creator.validation.regex", regex)) { !it.matches(regex) } + validationErrorIf(MCDevBundle("creator.validation.regex", regex)) { !it.matches(regex) } fun isAnyOf( selectionGetter: () -> T, Index: src/main/kotlin/creator/custom/CreatorCredentials.kt =================================================================== --- src/main/kotlin/creator/custom/CreatorCredentials.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/creator/custom/CreatorCredentials.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -148,8 +148,8 @@ // First check credentials in IntelliJ IDEA if (repoData.username.isNotBlank()) { val credentials = getCredentials(repoData.url, repoData.username) - var username = credentials?.userName - var password = credentials?.getPasswordAsString() + val username = credentials?.userName + val password = credentials?.getPasswordAsString() if (username != null && password != null) { return username to password } Index: src/main/kotlin/creator/custom/CustomPlatformStep.kt =================================================================== --- src/main/kotlin/creator/custom/CustomPlatformStep.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/creator/custom/CustomPlatformStep.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -59,6 +59,7 @@ /** * The step to select a custom template repo. */ +@Suppress("RemoveExplicitTypeArguments") class CustomPlatformStep( parent: NewProjectWizardStep, ) : AbstractNewProjectWizardStep(parent) { Index: src/main/kotlin/creator/custom/MavenRepoTable.kt =================================================================== --- src/main/kotlin/creator/custom/MavenRepoTable.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/creator/custom/MavenRepoTable.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -118,7 +118,7 @@ addRow(MinecraftSettings.MavenRepo(defaultName, "", "", "")) } } - val table = TableView(model) + val table = TableView(model) table.setShowGrid(true) table.tableHeader.reorderingAllowed = false Index: src/main/kotlin/creator/custom/TemplateRepoTable.kt =================================================================== --- src/main/kotlin/creator/custom/TemplateRepoTable.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/creator/custom/TemplateRepoTable.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -58,9 +58,9 @@ private object ProviderColumn : ColumnInfo( MCDevBundle("minecraft.settings.creator.repos.column.provider") ) { - override fun valueOf(item: MinecraftSettings.TemplateRepo?): ListWithSelection? { + override fun valueOf(item: MinecraftSettings.TemplateRepo?): ListWithSelection { val providers = TemplateProvider.getAllKeys() - val list = ListWithSelection(providers) + val list = ListWithSelection(providers) list.select(item?.provider?.takeIf(providers::contains)) return list @@ -91,7 +91,7 @@ } } - val table = TableView(model) + val table = TableView(model) table.setShowGrid(true) table.tableHeader.reorderingAllowed = false Index: src/main/kotlin/creator/custom/derivation/ExtractPaperApiVersionPropertyDerivation.kt =================================================================== --- src/main/kotlin/creator/custom/derivation/ExtractPaperApiVersionPropertyDerivation.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/creator/custom/derivation/ExtractPaperApiVersionPropertyDerivation.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -34,7 +34,7 @@ return from } - return super.derive(parentValues); + return super.derive(parentValues) } companion object : PropertyDerivationFactory { Index: src/main/kotlin/creator/custom/derivation/RecommendJavaVersionForMcVersionPropertyDerivation.kt =================================================================== --- src/main/kotlin/creator/custom/derivation/RecommendJavaVersionForMcVersionPropertyDerivation.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/creator/custom/derivation/RecommendJavaVersionForMcVersionPropertyDerivation.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -29,7 +29,7 @@ class RecommendJavaVersionForMcVersionPropertyDerivation(val default: Int) : PreparedDerivation { - override fun derive(parentValues: List): Any? { + override fun derive(parentValues: List): Any { val mcVersion: SemanticVersion = when (val version = parentValues[0]) { is SemanticVersion -> version is HasMinecraftVersion -> version.minecraftVersion Index: src/main/kotlin/creator/custom/derivation/SuggestClassNamePropertyDerivation.kt =================================================================== --- src/main/kotlin/creator/custom/derivation/SuggestClassNamePropertyDerivation.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/creator/custom/derivation/SuggestClassNamePropertyDerivation.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -30,7 +30,7 @@ class SuggestClassNamePropertyDerivation : PreparedDerivation { - override fun derive(parentValues: List): Any? { + override fun derive(parentValues: List): Any { val coords = parentValues[0] as BuildSystemCoordinates val name = parentValues[1] as String val sanitizedName = name.split(NOT_JAVA_IDENTIFIER).joinToString("", transform = String::capitalize) Index: src/main/kotlin/creator/custom/finalizers/AddMavenRunConfigFinalizer.kt =================================================================== --- src/main/kotlin/creator/custom/finalizers/AddMavenRunConfigFinalizer.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/creator/custom/finalizers/AddMavenRunConfigFinalizer.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -25,7 +25,6 @@ import com.intellij.openapi.project.Project import org.jetbrains.idea.maven.execution.MavenRunConfigurationType import org.jetbrains.idea.maven.execution.MavenRunnerParameters -import org.jetbrains.idea.maven.execution.MavenRunnerSettings class AddMavenRunConfigFinalizer : AddRunConfigFinalizer { Index: src/main/kotlin/creator/custom/finalizers/CreatorFinalizer.kt =================================================================== --- src/main/kotlin/creator/custom/finalizers/CreatorFinalizer.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/creator/custom/finalizers/CreatorFinalizer.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -124,5 +124,5 @@ override fun getKey(): String = type - override fun getImplementationClassName(): String? = implementation + override fun getImplementationClassName(): String = implementation } Index: src/main/kotlin/creator/custom/finalizers/ImportGradleProjectFinalizer.kt =================================================================== --- src/main/kotlin/creator/custom/finalizers/ImportGradleProjectFinalizer.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/creator/custom/finalizers/ImportGradleProjectFinalizer.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -25,6 +25,7 @@ import com.intellij.openapi.diagnostic.thisLogger import com.intellij.openapi.project.Project import com.intellij.openapi.wm.ToolWindowManager +import kotlin.time.Duration.Companion.milliseconds import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.async import kotlinx.coroutines.coroutineScope @@ -67,7 +68,7 @@ // like normal here, we have to wait until after the build starts. val manager = ToolWindowManager.getInstance(project) for (i in 0 until 5) { - delay(250) + delay(250.milliseconds) manager.getToolWindow("Build")?.let { withContext(Dispatchers.EDT) { it.show() Index: src/main/kotlin/creator/custom/model/ClassFqn.kt =================================================================== --- src/main/kotlin/creator/custom/model/ClassFqn.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/creator/custom/model/ClassFqn.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -43,9 +43,9 @@ */ val packagePath by lazy { packageName.replace('.', '/') } - fun withClassName(className: String) = copy("$packageName.$className") + fun withClassName(className: String) = copy(fqn = "$packageName.$className") - fun withSubPackage(name: String) = copy("$packageName.$name.$className") + fun withSubPackage(name: String) = copy(fqn = "$packageName.$name.$className") override fun toString(): String = fqn } Index: src/main/kotlin/creator/custom/model/StringList.kt =================================================================== --- src/main/kotlin/creator/custom/model/StringList.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/creator/custom/model/StringList.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -20,6 +20,7 @@ package com.demonwav.mcdev.creator.custom.model +@Suppress("JavaDefaultMethodsNotOverriddenByDelegation") @TemplateApi data class StringList(val values: List) : List by values { Index: src/main/kotlin/creator/custom/providers/BuiltinTemplateProvider.kt =================================================================== --- src/main/kotlin/creator/custom/providers/BuiltinTemplateProvider.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/creator/custom/providers/BuiltinTemplateProvider.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -36,7 +36,7 @@ class BuiltinTemplateProvider : RemoteTemplateProvider() { - private val builtinRepoUrl = "https://github.com/minecraft-dev/templates/archive/refs/heads/v\$version.zip" + private val builtinRepoUrl = $$"https://github.com/minecraft-dev/templates/archive/refs/heads/v$version.zip" private val builtinTemplatesPath = PluginUtil.plugin.pluginPath.resolve("lib/resources/builtin-templates") private val builtinTemplatesInnerPath = "templates-${TemplateDescriptor.FORMAT_VERSION}" private var repoUpdated: Boolean = false @@ -74,7 +74,7 @@ override fun setupConfigUi( data: String, dataSetter: (String) -> Unit - ): JComponent? { + ): JComponent { val propertyGraph = PropertyGraph("BuiltinTemplateProvider config") val autoUpdateProperty = propertyGraph.property(data.toBooleanStrictOrNull() != false) Index: src/main/kotlin/creator/custom/providers/EmptyLoadedTemplate.kt =================================================================== --- src/main/kotlin/creator/custom/providers/EmptyLoadedTemplate.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/creator/custom/providers/EmptyLoadedTemplate.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -35,6 +35,6 @@ override val isValid: Boolean = false - override fun loadTemplateContents(path: String): String? = + override fun loadTemplateContents(path: String): String = throw UnsupportedOperationException("The empty template can't have contents") } Index: src/main/kotlin/creator/custom/providers/LocalTemplateProvider.kt =================================================================== --- src/main/kotlin/creator/custom/providers/LocalTemplateProvider.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/creator/custom/providers/LocalTemplateProvider.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -61,7 +61,7 @@ override fun setupConfigUi( data: String, dataSetter: (String) -> Unit - ): JComponent? { + ): JComponent { val propertyGraph = PropertyGraph("LocalTemplateProvider config") val pathProperty = propertyGraph.property(data) return panel { Index: src/main/kotlin/creator/custom/providers/RemoteTemplateProvider.kt =================================================================== --- src/main/kotlin/creator/custom/providers/RemoteTemplateProvider.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/creator/custom/providers/RemoteTemplateProvider.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -177,7 +177,7 @@ } private fun replaceVariables(originalRepoUrl: String): String = - originalRepoUrl.replace("\$version", TemplateDescriptor.FORMAT_VERSION.toString()) + originalRepoUrl.replace($$"$version", TemplateDescriptor.FORMAT_VERSION.toString()) override fun setupConfigUi( data: String, @@ -267,7 +267,7 @@ index: Int, isSelected: Boolean, cellHasFocus: Boolean - ): Component? { + ): Component { text = value?.displayname?.let(MCDevBundle::invoke) ?: value?.name?.capitalize().toString() return this } Index: src/main/kotlin/creator/custom/providers/TemplateProvider.kt =================================================================== --- src/main/kotlin/creator/custom/providers/TemplateProvider.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/creator/custom/providers/TemplateProvider.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -46,8 +46,6 @@ import com.intellij.util.xmlb.annotations.Attribute import java.util.ResourceBundle import javax.swing.JComponent -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.runBlocking /** * Extensions responsible for creating a [TemplateDescriptor] based on whatever data it is provided in its configuration @@ -73,7 +71,7 @@ fun get(key: String): TemplateProvider? = COLLECTOR.findSingle(key) - fun getAllKeys() = EP_NAME.extensionList.mapNotNull { it.key } + fun getAllKeys() = EP_NAME.extensionList.map { it.key } suspend fun findTemplates( modalityState: ModalityState, @@ -194,7 +192,7 @@ descriptor.translateOrNull("platform.${labelKey.lowercase()}.label") ?: descriptor.translate(labelKey) if (descriptor.inherit != null) { - val parent = templateRoot.findFileByRelativePath(descriptor.inherit!!) + val parent = templateRoot.findFileByRelativePath(descriptor.inherit) if (parent != null) { parent.refresh(false, false) val parentDescriptor = Gson().fromJson(parent.readText()) @@ -231,5 +229,5 @@ override fun getKey(): String = name - override fun getImplementationClassName(): String? = implementation + override fun getImplementationClassName(): String = implementation } Index: src/main/kotlin/creator/custom/providers/VfsLoadedTemplate.kt =================================================================== --- src/main/kotlin/creator/custom/providers/VfsLoadedTemplate.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/creator/custom/providers/VfsLoadedTemplate.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -33,7 +33,7 @@ override val isValid: Boolean, ) : LoadedTemplate { - override fun loadTemplateContents(path: String): String? { + override fun loadTemplateContents(path: String): String { templateRoot.refresh(false, true) val virtualFile = templateRoot.findFileByRelativePath(path) ?: throw FileNotFoundException("Could not find file $path in template root ${templateRoot.path}") Index: src/main/kotlin/creator/custom/types/ArchitecturyVersionsCreatorProperty.kt =================================================================== --- src/main/kotlin/creator/custom/types/ArchitecturyVersionsCreatorProperty.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/creator/custom/types/ArchitecturyVersionsCreatorProperty.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -66,9 +66,9 @@ FabricVersions.YarnVersion("", -1), true, emptyVersion, - true, - true, - emptyVersion, + useOfficialMappings = true, + useArchitecturyApi = true, + architecturyApi = emptyVersion, ) private val defaultValue = createDefaultValue(descriptor.default) @@ -291,7 +291,7 @@ loomVersionModel.removeAllElements() loomVersionModel.addAll(loomVersions) val defaultValue = loomVersions.find { - it.parts.any { it is SemanticVersion.Companion.VersionPart.PreReleasePart } + it.parts.any { p -> p is SemanticVersion.Companion.VersionPart.PreReleasePart } } ?: loomVersions.firstOrNull() ?: emptyVersion loomVersionProperty.set(defaultValue) Index: src/main/kotlin/creator/custom/types/CreatorProperty.kt =================================================================== --- src/main/kotlin/creator/custom/types/CreatorProperty.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/creator/custom/types/CreatorProperty.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -211,12 +211,9 @@ into.putAll(TemplateEvaluator.baseProperties) - return if (names == null) { - properties.mapValuesTo(into) { (_, prop) -> prop.get() } - } else { - names.associateWithTo(mutableMapOf()) { properties[it]?.get() } + return names?.associateWithTo(mutableMapOf()) { properties[it]?.get() } + ?: properties.mapValuesTo(into) { (_, prop) -> prop.get() } - } + } - } protected fun collectDerivationParents(reporter: TemplateValidationReporter? = null): List?>? = descriptor.derives?.parents?.map { parentName -> @@ -379,7 +376,7 @@ val out = graph.property(null) if (forceValue == null) { - return out; + return out } if (forceValue !is Map<*, *>) { Index: src/main/kotlin/creator/custom/types/MavenArtifactVersionCreatorProperty.kt =================================================================== --- src/main/kotlin/creator/custom/types/MavenArtifactVersionCreatorProperty.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/creator/custom/types/MavenArtifactVersionCreatorProperty.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -160,7 +160,7 @@ val scope = context.childScope("MavenArtifactVersionCreatorProperty") scope.launch(Dispatchers.Default) { val result = withContext(Dispatchers.IO) { - var requestCustomizer = CreatorCredentials.findMavenRepoCredentials(url)?.let { (user, pass) -> + val requestCustomizer = CreatorCredentials.findMavenRepoCredentials(url)?.let { (user, pass) -> Function { request -> request.authentication().basic(user, pass) } } Index: src/main/kotlin/creator/custom/types/ParchmentCreatorProperty.kt =================================================================== --- src/main/kotlin/creator/custom/types/ParchmentCreatorProperty.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/creator/custom/types/ParchmentCreatorProperty.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -69,7 +69,10 @@ return deserialize(raw) } - return ParchmentVersions(true, emptyVersion, emptyVersion, false, false) + return ParchmentVersions(true, emptyVersion, emptyVersion, + includeOlderMcVersions = false, + includeSnapshots = false + ) } override fun serialize(value: ParchmentVersions): String { @@ -90,6 +93,7 @@ override fun buildUi(panel: Panel) { panel.row(descriptor.translatedLabel) { + @Suppress("DialogTitleCapitalization") checkBox("Use Parchment") .bindSelected(useParchmentProperty) @@ -124,16 +128,14 @@ val platformMcVersionPropertyName = descriptor.parameters?.get("minecraftVersionProperty") as? String val platformMcVersionProperty = properties[platformMcVersionPropertyName] - if (platformMcVersionProperty != null) { - platformMcVersionProperty.graphProperty.afterChange { + platformMcVersionProperty?.graphProperty?.afterChange { - val minecraftVersion = getPlatformMinecraftVersion() - if (mcVersionsModel.getIndexOf(minecraftVersion) == -1) { - refreshVersionsLists(forceLatestVersions = true) - } else if (minecraftVersion != null) { - graphProperty.set(graphProperty.get().copy(minecraftVersion = minecraftVersion)) - } - } + val minecraftVersion = getPlatformMinecraftVersion() + if (mcVersionsModel.getIndexOf(minecraftVersion) == -1) { + refreshVersionsLists(forceLatestVersions = true) + } else if (minecraftVersion != null) { + graphProperty.set(graphProperty.get().copy(minecraftVersion = minecraftVersion)) + } + } - } var previousMcVersion: SemanticVersion? = null mcVersionProperty.afterChange { mcVersion -> Index: src/main/kotlin/creator/step/LicenseStep.kt =================================================================== --- src/main/kotlin/creator/step/LicenseStep.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/creator/step/LicenseStep.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -39,7 +39,7 @@ override fun setupUI(builder: Panel) { with(builder) { row(MCDevBundle("creator.ui.license.label")) { - comboBox(License.values().toList()) + comboBox(License.entries) .bindItem(licenseProperty.transform({ License.byId(it) ?: License.ALL_RIGHTS_RESERVED }) { it.id }) } } Index: src/main/kotlin/creator/step/MainClassStep.kt =================================================================== --- src/main/kotlin/creator/step/MainClassStep.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/creator/step/MainClassStep.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -50,15 +50,6 @@ "." + findStep().name.toJavaClassName() } - private fun suggestGroupId(): String { - val parts = className.split('.').dropLast(2) - return if (parts.isEmpty()) { - findStep>().groupId - } else { - parts.joinToString(".") - } - } - val classNameProperty = propertyGraph.lazyProperty(::suggestMainClassName) var className by classNameProperty Index: src/main/kotlin/facet/LibraryPresentationProviders.kt =================================================================== --- src/main/kotlin/facet/LibraryPresentationProviders.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/facet/LibraryPresentationProviders.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -20,47 +20,13 @@ package com.demonwav.mcdev.facet -import com.demonwav.mcdev.util.get import com.demonwav.mcdev.util.localFile -import com.demonwav.mcdev.util.manifest import com.intellij.framework.library.LibraryVersionProperties import com.intellij.openapi.roots.libraries.LibraryKind import com.intellij.openapi.roots.libraries.LibraryPresentationProvider import com.intellij.openapi.util.io.JarUtil import com.intellij.openapi.vfs.VirtualFile -import java.util.jar.Attributes.Name.IMPLEMENTATION_TITLE -import java.util.jar.Attributes.Name.IMPLEMENTATION_VERSION -abstract class ManifestLibraryPresentationProvider( - kind: LibraryKind, - private val title: String, - private val startsWith: Boolean = false, -) : - LibraryPresentationProvider(kind) { - - final override fun detect(classesRoots: List): LibraryVersionProperties? { - for (classesRoot in classesRoots) { - val manifest = classesRoot.manifest ?: continue - - val title = manifest[IMPLEMENTATION_TITLE] ?: continue - if (startsWith) { - if (!title.startsWith(this.title)) { - continue - } - } else { - if (title != this.title) { - continue - } - } - - val version = manifest[IMPLEMENTATION_VERSION] ?: continue - return LibraryVersionProperties(version) - } - - return null - } -} - abstract class MavenLibraryPresentationProvider( kind: LibraryKind, private val groupId: String, Index: src/main/kotlin/facet/MinecraftFacetDetector.kt =================================================================== --- src/main/kotlin/facet/MinecraftFacetDetector.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/facet/MinecraftFacetDetector.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -64,13 +64,9 @@ import org.jetbrains.plugins.gradle.util.GradleUtil class MinecraftFacetDetector : ProjectActivity { - companion object { - private val libraryVersionsKey = Key>("mcdev.libraryVersions") - - fun getLibraryVersions(module: Module): Map { - return module.getUserData(libraryVersionsKey) ?: emptyMap() + private object Const { + val libraryVersionsKey = Key>("mcdev.libraryVersions") - } + } - } override suspend fun execute(project: Project) { val detectorService = project.service() @@ -182,8 +178,8 @@ } private fun autoDetectTypes(module: Module): Set { - val libraryVersions = module.getUserData(libraryVersionsKey) - ?: mutableMapOf().also { module.putUserData(libraryVersionsKey, it) } + val libraryVersions = module.getUserData(Const.libraryVersionsKey) + ?: mutableMapOf().also { module.putUserData(Const.libraryVersionsKey, it) } libraryVersions.clear() val context = LibrariesValidatorContextImpl(module) Index: src/main/kotlin/insight/ColorAnnotator.kt =================================================================== --- src/main/kotlin/insight/ColorAnnotator.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/insight/ColorAnnotator.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -40,10 +40,10 @@ val color = element.toUElementOfType()?.findColor { _, chosenEntry -> chosenEntry.value } ?: return - setColorAnnotator(color, element, holder) + Util.setColorAnnotator(color, element, holder) } - companion object { + object Util { fun setColorAnnotator(color: Color, element: PsiElement, holder: AnnotationHolder) { val textAttributes = TextAttributes(null, null, color, MinecraftSettings.instance.underlineType.effectType, Font.PLAIN) @@ -52,5 +52,6 @@ .enforcedTextAttributes(textAttributes) .create() } + } } Index: src/main/kotlin/insight/ColorPicker.kt =================================================================== --- src/main/kotlin/insight/ColorPicker.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/insight/ColorPicker.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -39,12 +39,8 @@ private val panel = JPanel(GridBagLayout()) private var chosenColor: String? = null - private val dialog: ColorPickerDialog + private val dialog = ColorPickerDialog(project, parent, panel) - init { - dialog = ColorPickerDialog(project, parent, panel) - } - fun showDialog(): String? { init() Index: src/main/kotlin/insight/InsightUtil.kt =================================================================== --- src/main/kotlin/insight/InsightUtil.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/insight/InsightUtil.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -70,7 +70,6 @@ // Get the type of the parameter so we can start resolving it - @Suppress("UElementAsPsi") // UVariable overrides getType so it should be fine to use on UElements... val type = firstParameter.type as? PsiClassType ?: return null // Validate that it is a class reference type // And again, make sure that we can at least resolve the type, otherwise it's not a valid Index: src/main/kotlin/insight/ListenerLineMarkerProvider.kt =================================================================== --- src/main/kotlin/insight/ListenerLineMarkerProvider.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/insight/ListenerLineMarkerProvider.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -106,7 +106,7 @@ return false } - val otherElement = info.getElement() + val otherElement = info.element val myElement = element return otherElement != null && myElement != null } Index: src/main/kotlin/insight/generation/EventGenHelper.kt =================================================================== --- src/main/kotlin/insight/generation/EventGenHelper.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/insight/generation/EventGenHelper.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -54,7 +54,7 @@ val EP_NAME = ExtensionPointName.create>( "com.demonwav.minecraft-dev.eventGenHelper" ) - val COLLECTOR = LanguageExtension(EP_NAME, JvmEventGenHelper()) + val COLLECTOR = LanguageExtension(EP_NAME, JvmEventGenHelper()) } } @@ -121,7 +121,9 @@ } override fun reformatAndShortenRefs(file: PsiFile, startOffset: Int, endOffset: Int) { - file as? KtFile ?: return + if (file !is KtFile) { + return + } val project = file.project val marker = JvmEventGenHelper.doReformat(project, file, startOffset, endOffset) ?: return Index: src/main/kotlin/insight/generation/GenerateEventListenerHandler.kt =================================================================== --- src/main/kotlin/insight/generation/GenerateEventListenerHandler.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/insight/generation/GenerateEventListenerHandler.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -59,9 +59,9 @@ chooser.showDialog() val chosenClass = chooser.selected ?: return - val relevantModule = facet.modules.asSequence() - .filter { m -> isSuperEventListenerAllowed(chosenClass, m) } - .firstOrNull() ?: return + val relevantModule = facet.modules + .firstOrNull { m -> isSuperEventListenerAllowed(chosenClass, m) } + ?: return val chosenClassName = chosenClass.nameIdentifier?.text ?: return Index: src/main/kotlin/insight/generation/MethodRendererBasedEventListenerGenerationSupport.kt =================================================================== --- src/main/kotlin/insight/generation/MethodRendererBasedEventListenerGenerationSupport.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/insight/generation/MethodRendererBasedEventListenerGenerationSupport.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -66,10 +66,7 @@ } private fun adjustOffset(context: PsiElement, editor: Editor): Int? { - val declaration = context.getUastParentOfType() - if (declaration == null) { - return null - } + val declaration = context.getUastParentOfType() ?: return null if (declaration is UClass) { return editor.caretModel.offset Index: src/main/kotlin/insight/generation/MinecraftClassCreateAction.kt =================================================================== --- src/main/kotlin/insight/generation/MinecraftClassCreateAction.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/insight/generation/MinecraftClassCreateAction.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -52,17 +52,17 @@ class MinecraftClassCreateAction : CreateTemplateInPackageAction( - CAPTION, + Const.CAPTION, MCDevBundle("generate.class.description"), GeneralAssets.MC_TEMPLATE, JavaModuleSourceRootTypes.SOURCES, ), DumbAware { - override fun getActionName(directory: PsiDirectory?, newName: String, templateName: String?): String = CAPTION + override fun getActionName(directory: PsiDirectory?, newName: String, templateName: String?): String = Const.CAPTION override fun buildDialog(project: Project, directory: PsiDirectory, builder: CreateFileFromTemplateDialog.Builder) { - builder.setTitle(CAPTION) + builder.setTitle(Const.CAPTION) builder.setValidator(ClassInputValidator(project, directory)) val module = directory.findModule() ?: return @@ -84,13 +84,13 @@ builder.addKind("Block", icon, MinecraftTemplates.FORGE_1_17_BLOCK_TEMPLATE) builder.addKind("Enchantment", icon, MinecraftTemplates.FORGE_1_17_ENCHANTMENT_TEMPLATE) builder.addKind("Item", icon, MinecraftTemplates.FORGE_1_17_ITEM_TEMPLATE) - builder.addKind("Mob Effect", icon, MinecraftTemplates.FORGE_1_17_MOB_EFFECT_TEMPLATE) + builder.addKind("Mob effect", icon, MinecraftTemplates.FORGE_1_17_MOB_EFFECT_TEMPLATE) builder.addKind("Packet", icon, MinecraftTemplates.FORGE_1_17_PACKET_TEMPLATE) } else { builder.addKind("Block", icon, MinecraftTemplates.FORGE_1_17_BLOCK_TEMPLATE) builder.addKind("Enchantment", icon, MinecraftTemplates.FORGE_1_17_ENCHANTMENT_TEMPLATE) builder.addKind("Item", icon, MinecraftTemplates.FORGE_1_17_ITEM_TEMPLATE) - builder.addKind("Mob Effect", icon, MinecraftTemplates.FORGE_1_17_MOB_EFFECT_TEMPLATE) + builder.addKind("Mob effect", icon, MinecraftTemplates.FORGE_1_17_MOB_EFFECT_TEMPLATE) builder.addKind("Packet", icon, MinecraftTemplates.FORGE_1_18_PACKET_TEMPLATE) } } @@ -100,7 +100,7 @@ builder.addKind("Block", icon, MinecraftTemplates.NEOFORGE_BLOCK_TEMPLATE) builder.addKind("Enchantment", icon, MinecraftTemplates.NEOFORGE_ENCHANTMENT_TEMPLATE) builder.addKind("Item", icon, MinecraftTemplates.NEOFORGE_ITEM_TEMPLATE) - builder.addKind("Mob Effect", icon, MinecraftTemplates.NEOFORGE_MOB_EFFECT_TEMPLATE) + builder.addKind("Mob effect", icon, MinecraftTemplates.NEOFORGE_MOB_EFFECT_TEMPLATE) builder.addKind("Packet", icon, MinecraftTemplates.NEOFORGE_PACKET_TEMPLATE) } @@ -110,7 +110,7 @@ builder.addKind("Block", icon, MinecraftTemplates.FABRIC_BLOCK_TEMPLATE) builder.addKind("Enchantment", icon, MinecraftTemplates.FABRIC_ENCHANTMENT_TEMPLATE) builder.addKind("Item", icon, MinecraftTemplates.FABRIC_ITEM_TEMPLATE) - builder.addKind("Status Effect", icon, MinecraftTemplates.FABRIC_STATUS_EFFECT_TEMPLATE) + builder.addKind("Status effect", icon, MinecraftTemplates.FABRIC_STATUS_EFFECT_TEMPLATE) } } @@ -165,8 +165,8 @@ checkInput(inputString) } - private companion object { - private val CAPTION + private object Const { + val CAPTION get() = MCDevBundle("generate.class.caption") } } Index: src/main/kotlin/insight/generation/ui/EventListenerWizard.kt =================================================================== --- src/main/kotlin/insight/generation/ui/EventListenerWizard.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/insight/generation/ui/EventListenerWizard.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -52,6 +52,7 @@ } row { + @Suppress("DialogTitleCapitalization") label("public void").apply { component.font = EditorUtil.getEditorFont() if (!JBColor.isBright()) { Index: src/main/kotlin/inspection/WrongEntityDataParameterClassInspection.kt =================================================================== --- src/main/kotlin/inspection/WrongEntityDataParameterClassInspection.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/inspection/WrongEntityDataParameterClassInspection.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -51,11 +51,11 @@ val className = method.containingClass?.fullQualifiedName ?: return val methodName = method.name - if (className !in ENTITY_DATA_MANAGER_CLASSES || methodName !in DEFINE_ID_METHODS) return + if (className !in Const.ENTITY_DATA_MANAGER_CLASSES || methodName !in Const.DEFINE_ID_METHODS) return val containingClass = expression.findContainingClass() ?: return - if (!isEntitySubclass(containingClass)) return + if (!Const.isEntitySubclass(containingClass)) return val firstParameter = expression.argumentList.expressions.firstOrNull() ?: return val firstParameterGenericsClass = @@ -91,23 +91,23 @@ override fun getFamilyName() = name } - companion object { - private val ENTITY_CLASSES = setOf( + private object Const { + val ENTITY_CLASSES = setOf( "net.minecraft.entity.Entity", "net.minecraft.world.entity.Entity", ) - private val ENTITY_DATA_MANAGER_CLASSES = setOf( + val ENTITY_DATA_MANAGER_CLASSES = setOf( "net.minecraft.network.datasync.EntityDataManager", "net.minecraft.network.syncher.SynchedEntityData", "net.minecraft.entity.data.DataTracker", ) - private val DEFINE_ID_METHODS = setOf( + val DEFINE_ID_METHODS = setOf( "defineId", "createKey", "registerData", ) - private fun isEntitySubclass(clazz: PsiClass): Boolean = + fun isEntitySubclass(clazz: PsiClass): Boolean = InheritanceUtil.getSuperClasses(clazz).any { it.qualifiedName in ENTITY_CLASSES } } } Index: src/main/kotlin/nbt/editor/NbtFileEditorProvider.kt =================================================================== --- src/main/kotlin/nbt/editor/NbtFileEditorProvider.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/nbt/editor/NbtFileEditorProvider.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -123,9 +123,9 @@ override fun getComponent() = editor.component override fun getPreferredFocusedComponent() = null - override fun getUserData(key: Key): T? = editor.getUserData(key) + override fun getUserData(key: Key): T? = editor.getUserData(key) - override fun putUserData(key: Key, value: T?) = editor.putUserData(key, value) + override fun putUserData(key: Key, value: T?) = editor.putUserData(key, value) override fun isValid() = true override fun removePropertyChangeListener(listener: PropertyChangeListener) = Unit Index: src/main/kotlin/nbt/lang/NbttLanguage.kt =================================================================== --- src/main/kotlin/nbt/lang/NbttLanguage.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/nbt/lang/NbttLanguage.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -21,5 +21,9 @@ package com.demonwav.mcdev.nbt.lang import com.intellij.lang.Language +import java.io.Serial -object NbttLanguage : Language("NBTT") +object NbttLanguage : Language("NBTT") { + @Serial + private fun readResolve(): Any = NbttLanguage +} Index: src/main/kotlin/nbt/lang/NbttParserDefinition.kt =================================================================== --- src/main/kotlin/nbt/lang/NbttParserDefinition.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/nbt/lang/NbttParserDefinition.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -40,13 +40,13 @@ override fun spaceExistenceTypeBetweenTokens(left: ASTNode, right: ASTNode) = LanguageUtil.canStickTokensTogetherByLexer(left, right, NbttLexerAdapter()) - override fun getStringLiteralElements() = STRING_LITERALS - override fun getWhitespaceTokens() = WHITE_SPACES - override fun getFileNodeType() = FILE + override fun getStringLiteralElements() = TokenSets.STRING_LITERALS + override fun getWhitespaceTokens() = TokenSets.WHITE_SPACES + override fun getFileNodeType() = TokenSets.FILE override fun createElement(node: ASTNode) = NbttTypes.Factory.createElement(node)!! override fun getCommentTokens() = TokenSet.EMPTY!! - companion object { + object TokenSets { val WHITE_SPACES = TokenSet.create(TokenType.WHITE_SPACE) val STRING_LITERALS = TokenSet.create(NbttTypes.STRING_LITERAL) Index: src/main/kotlin/nbt/lang/colors/NbttColorSettingsPage.kt =================================================================== --- src/main/kotlin/nbt/lang/colors/NbttColorSettingsPage.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/nbt/lang/colors/NbttColorSettingsPage.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -42,8 +42,8 @@ override fun getIcon() = PlatformAssets.MINECRAFT_ICON override fun getHighlighter() = NbttSyntaxHighlighter() - override fun getAdditionalHighlightingTagToDescriptorMap() = map - override fun getAttributeDescriptors() = DESCRIPTORS + override fun getAdditionalHighlightingTagToDescriptorMap() = Const.map + override fun getAttributeDescriptors() = Const.DESCRIPTORS override fun getColorDescriptors(): Array = ColorDescriptor.EMPTY_ARRAY override fun getDisplayName() = MCDevBundle("nbt.lang.display_name") override fun getDemoText() = @@ -86,8 +86,8 @@ } """.trimIndent() - companion object { - private val DESCRIPTORS = arrayOf( + private object Const { + val DESCRIPTORS = arrayOf( AttributesDescriptor(MCDevBundle.pointer("nbt.lang.highlighting.keyword.display_name"), KEYWORD), AttributesDescriptor(MCDevBundle.pointer("nbt.lang.highlighting.string.display_name"), STRING), AttributesDescriptor( @@ -108,10 +108,10 @@ AttributesDescriptor(MCDevBundle.pointer("nbt.lang.highlighting.material.display_name"), MATERIAL), ) - private val map = mapOf( - "name" to NbttSyntaxHighlighter.STRING_NAME, - "uname" to NbttSyntaxHighlighter.UNQUOTED_STRING_NAME, - "material" to NbttSyntaxHighlighter.MATERIAL, + val map = mapOf( + "name" to STRING_NAME, + "uname" to UNQUOTED_STRING_NAME, + "material" to MATERIAL, ) } } Index: src/main/kotlin/nbt/lang/format/NbttBlock.kt =================================================================== --- src/main/kotlin/nbt/lang/format/NbttBlock.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/nbt/lang/format/NbttBlock.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -49,7 +49,7 @@ private val psiElement = node.psi private val childWrap: Wrap? - private val spacingBuilder = NbttFormattingModelBuilder.createSpacingBuilder(settings) + private val spacingBuilder = NbttFormattingModelBuilder.Util.createSpacingBuilder(settings) init { childWrap = when (psiElement) { @@ -100,7 +100,7 @@ } override fun getChildAttributes(newChildIndex: Int): ChildAttributes { - if (NbttParserDefinition.NBTT_CONTAINERS.contains(node.elementType)) { + if (NbttParserDefinition.TokenSets.NBTT_CONTAINERS.contains(node.elementType)) { return ChildAttributes(Indent.getNormalIndent(), null) } if (psiElement is PsiFile) { @@ -118,10 +118,10 @@ var indent = Indent.getNoneIndent() var wrap: Wrap? = null - if (NbttParserDefinition.NBTT_CONTAINERS.contains(node.elementType)) { + if (NbttParserDefinition.TokenSets.NBTT_CONTAINERS.contains(node.elementType)) { if (NbttTypes.COMMA == childNode.elementType) { wrap = Wrap.createWrap(WrapType.NONE, true) - } else if (!NbttParserDefinition.NBTT_BRACES.contains(childNode.elementType)) { + } else if (!NbttParserDefinition.TokenSets.NBTT_BRACES.contains(childNode.elementType)) { wrap = childWrap!! indent = Indent.getNormalIndent() } Index: src/main/kotlin/nbt/lang/format/NbttFormattingModelBuilder.kt =================================================================== --- src/main/kotlin/nbt/lang/format/NbttFormattingModelBuilder.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/nbt/lang/format/NbttFormattingModelBuilder.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -40,7 +40,7 @@ ) } - companion object { + object Util { fun createSpacingBuilder(settings: CodeStyleSettings): SpacingBuilder { val nbttSettings = settings.getCustomSettings(NbttCodeStyleSettings::class.java) val commonSettings = settings.getCommonSettings(NbttLanguage) Index: src/main/kotlin/nbt/tags/NbtTag.kt =================================================================== --- src/main/kotlin/nbt/tags/NbtTag.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/nbt/tags/NbtTag.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -60,7 +60,7 @@ get() = typeId.typeIdByte val forbiddenCharacters = Regex("""[:(){}\[\],]""") -val badFormat = Regex("""^[\d+\-\\\s\n:{}\[\](),].*|.*["\\:{}\[\]()\s\n,]${'$'}""") +val badFormat = Regex("""^[\d+\-\\\s\n:{}\[\](),].*|.*["\\:{}\[\]()\s\n,]$""") fun writeString(sb: StringBuilder, s: String): StringBuilder { if (s.isBlank()) { Index: src/main/kotlin/nbt/tags/NbtTypeId.kt =================================================================== --- src/main/kotlin/nbt/tags/NbtTypeId.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/nbt/tags/NbtTypeId.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -39,6 +39,6 @@ ; companion object { - fun getById(id: Byte) = values().firstOrNull { it.typeIdByte == id } + fun getById(id: Byte) = entries.firstOrNull { it.typeIdByte == id } } } Index: src/main/kotlin/nbt/tags/TagList.kt =================================================================== --- src/main/kotlin/nbt/tags/TagList.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/nbt/tags/TagList.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -51,7 +51,7 @@ return false } - return (0 until this.tags.size).all { i -> other.tags[i] == this.tags[i] } + return this.tags.indices.all { i -> other.tags[i] == this.tags[i] } } override fun hashCode() = Objects.hash(type, tags) Index: src/main/kotlin/platform/BaseTemplate.kt =================================================================== --- src/main/kotlin/platform/BaseTemplate.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/BaseTemplate.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) @@ -1,40 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2025 minecraft-dev - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation, version 3.0 only. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.platform - -import com.intellij.ide.fileTemplates.FileTemplateManager -import com.intellij.openapi.project.Project - -abstract class BaseTemplate { - - protected fun Project.applyTemplate( - templateName: String, - properties: Map? = null, - ): String { - val manager = FileTemplateManager.getInstance(this) - val template = manager.getJ2eeTemplate(templateName) - - val allProperties = manager.defaultProperties.toMutableMap() - properties?.let { prop -> allProperties.putAll(prop) } - - return template.getText(allProperties) - } -} Index: src/main/kotlin/platform/bukkit/BukkitLikeConfiguration.kt =================================================================== --- src/main/kotlin/platform/bukkit/BukkitLikeConfiguration.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/bukkit/BukkitLikeConfiguration.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) @@ -1,34 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2025 minecraft-dev - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation, version 3.0 only. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.platform.bukkit - -interface BukkitLikeConfiguration { - val mainClass: String - - fun hasDependencies(): Boolean - fun setDependencies(string: String) - - fun hasSoftDependencies(): Boolean - fun setSoftDependencies(string: String) - - val dependencies: MutableList - val softDependencies: MutableList -} Index: src/main/kotlin/platform/bukkit/BukkitModule.kt =================================================================== --- src/main/kotlin/platform/bukkit/BukkitModule.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/bukkit/BukkitModule.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -68,7 +68,7 @@ override val moduleType: T = type - override val eventListenerGenSupport: EventListenerGenerationSupport? = BukkitEventListenerGenerationSupport() + override val eventListenerGenSupport: EventListenerGenerationSupport = BukkitEventListenerGenerationSupport() private val pluginParentClasses = listOf( BukkitConstants.PLUGIN, @@ -175,25 +175,4 @@ pluginYml = null } - - companion object { - fun generateBukkitStyleEventListenerMethod( - chosenClass: PsiClass, - chosenName: String, - project: Project, - annotationName: String, - setIgnoreCancelled: Boolean, - ): PsiMethod? { - val newMethod = createVoidMethodWithParameterType(project, chosenName, chosenClass) ?: return null - val modifierList = newMethod.modifierList - val annotation = modifierList.addAnnotation(annotationName) - - if (setIgnoreCancelled) { - val value = JavaPsiFacade.getElementFactory(project).createExpressionFromText("true", annotation) - annotation.setDeclaredAttributeValue("ignoreCancelled", value) - } +} - - return newMethod - } - } -} Index: src/main/kotlin/platform/bukkit/creator/asset-steps.kt =================================================================== --- src/main/kotlin/platform/bukkit/creator/asset-steps.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/bukkit/creator/asset-steps.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -46,7 +46,7 @@ override fun setupAssets(project: Project) { val pluginName = data.getUserData(AbstractModNameStep.KEY) ?: return val mainClass = data.getUserData(MainClassStep.KEY) ?: return - val versionRef = data.getUserData(VERSION_REF_KEY) ?: "\${version}" + val versionRef = data.getUserData(VERSION_REF_KEY) ?: $$"${version}" val prefix = data.getUserData(BukkitLogPrefixStep.KEY) ?: "" val loadOrder = data.getUserData(BukkitLoadOrderStep.KEY) ?: return val loadBefore = data.getUserData(BukkitLoadBeforeStep.KEY) ?: emptyList() Index: src/main/kotlin/platform/bukkit/creator/maven-steps.kt =================================================================== --- src/main/kotlin/platform/bukkit/creator/maven-steps.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/bukkit/creator/maven-steps.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -54,7 +54,7 @@ override val description = "Creating Maven files" override fun setupAssets(project: Project) { - data.putUserData(BukkitProjectFilesStep.VERSION_REF_KEY, "\${project.version}") + data.putUserData(BukkitProjectFilesStep.VERSION_REF_KEY, $$"${project.version}") assets.addDefaultMavenProperties() assets.addTemplates(project, "pom.xml" to MinecraftTemplates.BUKKIT_POM_TEMPLATE) if (gitEnabled) { Index: src/main/kotlin/platform/bukkit/creator/ui-steps.kt =================================================================== --- src/main/kotlin/platform/bukkit/creator/ui-steps.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/bukkit/creator/ui-steps.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -143,7 +143,7 @@ override fun setupUI(builder: Panel) { with(builder) { row("Load at:") { - segmentedButton(LoadOrder.values().toList()) { text = it.toString() } + segmentedButton(LoadOrder.entries) { text = it.toString() } .bind(loadOrderProperty) } } Index: src/main/kotlin/platform/bungeecord/BungeeCordModule.kt =================================================================== --- src/main/kotlin/platform/bungeecord/BungeeCordModule.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/bungeecord/BungeeCordModule.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -65,7 +65,7 @@ override val moduleType: T = type - override val eventListenerGenSupport: EventListenerGenerationSupport? = BungeeCordEventListenerGenerationSupport() + override val eventListenerGenSupport: EventListenerGenerationSupport = BungeeCordEventListenerGenerationSupport() override fun isEventClassValid(eventClass: PsiClass, method: PsiMethod?) = BungeeCordConstants.EVENT_CLASS == eventClass.qualifiedName Index: src/main/kotlin/platform/bungeecord/creator/asset-steps.kt =================================================================== --- src/main/kotlin/platform/bungeecord/creator/asset-steps.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/bungeecord/creator/asset-steps.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -43,7 +43,7 @@ override fun setupAssets(project: Project) { val mainClass = data.getUserData(MainClassStep.KEY) ?: return val (packageName, className) = splitPackage(mainClass) - val versionRef = data.getUserData(VERSION_REF_KEY) ?: "\${version}" + val versionRef = data.getUserData(VERSION_REF_KEY) ?: $$"${version}" val pluginName = data.getUserData(AbstractModNameStep.KEY) ?: return val authors = data.getUserData(AuthorsStep.KEY) ?: emptyList() val description = data.getUserData(DescriptionStep.KEY) ?: "" Index: src/main/kotlin/platform/bungeecord/creator/maven-steps.kt =================================================================== --- src/main/kotlin/platform/bungeecord/creator/maven-steps.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/bungeecord/creator/maven-steps.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -54,7 +54,7 @@ override val description = "Creating Maven files" override fun setupAssets(project: Project) { - data.putUserData(BungeeProjectFilesStep.VERSION_REF_KEY, "\${project.version}") + data.putUserData(BungeeProjectFilesStep.VERSION_REF_KEY, $$"${project.version}") assets.addDefaultMavenProperties() assets.addTemplates(project, "pom.xml" to MinecraftTemplates.BUNGEECORD_POM_TEMPLATE) if (gitEnabled) { Index: src/main/kotlin/platform/fabric/creator/ui-steps.kt =================================================================== --- src/main/kotlin/platform/fabric/creator/ui-steps.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/fabric/creator/ui-steps.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -137,7 +137,7 @@ } YARN_VERSION -> { val comboBox = super.createComboBox(row, index, items).bindEnabled(useOfficialMappingsProperty.not()) - row.checkBox("Use Official Mappings").bindSelected(useOfficialMappingsProperty) + row.checkBox("Use official mappings").bindSelected(useOfficialMappingsProperty) row.label("").bindText( getVersionProperty(MINECRAFT_VERSION).transform { mcVersion -> mcVersion as FabricMcVersion Index: src/main/kotlin/platform/fabric/inspection/FabricEntrypointsInspection.kt =================================================================== --- src/main/kotlin/platform/fabric/inspection/FabricEntrypointsInspection.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/fabric/inspection/FabricEntrypointsInspection.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -83,9 +83,8 @@ continue } - val element = resolved.singleOrNull()?.element - when { - element is PsiClass && !literal.text.contains("::") -> { + when (val element = resolved.singleOrNull()?.element) { + is PsiClass if !literal.text.contains("::") -> { val (propertyKey, expectedType) = findEntrypointKeyAndType(literal) if (propertyKey != null && expectedType != null && !isEntrypointOfCorrectType(element, propertyKey) @@ -108,7 +107,7 @@ } } - element is PsiMethod -> { + is PsiMethod -> { if (element.hasParameters()) { holder.registerProblem( literal, @@ -142,7 +141,7 @@ } } - element is PsiField -> { + is PsiField -> { if (!element.hasModifierProperty(PsiModifier.PUBLIC)) { holder.registerProblem( literal, Index: src/main/kotlin/platform/fabric/util/FabricConstants.kt =================================================================== --- src/main/kotlin/platform/fabric/util/FabricConstants.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/fabric/util/FabricConstants.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -20,6 +20,7 @@ package com.demonwav.mcdev.platform.fabric.util +@Suppress("unused") object FabricConstants { const val FABRIC_MOD_JSON = "fabric.mod.json" Index: src/main/kotlin/platform/forge/ForgeModule.kt =================================================================== --- src/main/kotlin/platform/forge/ForgeModule.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/forge/ForgeModule.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -86,7 +86,7 @@ val annotatedFields = AnnotatedElementsSearch.searchPsiFields(sidedProxy, scope).findAll() for (field in annotatedFields) { - SidedProxyAnnotator.check(field) + SidedProxyAnnotator.Util.check(field) } } ).inSmartMode(project).submit(AppExecutorUtil.getAppExecutorService()) @@ -160,7 +160,7 @@ val psiClass = runCatchingKtIdeaExceptions { identifier.uastParent as? UClass } ?: return false - return !psiClass.hasModifier(JvmModifier.ABSTRACT) && + return !psiClass.javaPsi.hasModifier(JvmModifier.ABSTRACT) && psiClass.findAnnotation(ForgeConstants.MOD_ANNOTATION) != null } Index: src/main/kotlin/platform/forge/gradle/ForgeRunConfigDataService.kt =================================================================== --- src/main/kotlin/platform/forge/gradle/ForgeRunConfigDataService.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/forge/gradle/ForgeRunConfigDataService.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -152,7 +152,7 @@ val mainModule = findMainModule(moduleMap, module) ProgressManager.getInstance().run( - object : Task.Backgroundable(project, "genIntellijRuns", false) { + object : Task.Backgroundable(project, @Suppress("DialogTitleCapitalization") "genIntellijRuns", false) { override fun run(indicator: ProgressIndicator) { indicator.isIndeterminate = true @@ -195,7 +195,6 @@ private val disposable = Disposer.newDisposable() init { - Disposer.register(module, disposable) module.project.messageBus.connect(disposable).subscribe(RunManagerListener.TOPIC, this) // If we don't have a data run, don't wait for it if (!hasData) { Index: src/main/kotlin/platform/forge/inspections/sideonly/SideOnlyUtil.kt =================================================================== --- src/main/kotlin/platform/forge/inspections/sideonly/SideOnlyUtil.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/forge/inspections/sideonly/SideOnlyUtil.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -170,7 +170,7 @@ ?: (null to Side.NONE) } - fun getSubArray(infos: Array): Array { + fun getSubArray(infos: Array): Array { return infos.copyOfRange(1, infos.size - 1) } } Index: src/main/kotlin/platform/forge/inspections/sideonly/SidedProxyAnnotator.kt =================================================================== --- src/main/kotlin/platform/forge/inspections/sideonly/SidedProxyAnnotator.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/forge/inspections/sideonly/SidedProxyAnnotator.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -51,10 +51,10 @@ return } - check(element) + Util.check(element) } - companion object { + object Util { fun check(field: PsiField) { val modifierList = field.modifierList ?: return Index: src/main/kotlin/platform/forge/util/ForgeConstants.kt =================================================================== --- src/main/kotlin/platform/forge/util/ForgeConstants.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/forge/util/ForgeConstants.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -39,10 +39,10 @@ const val MODS_TOML = "mods.toml" const val PACK_MCMETA = "pack.mcmeta" - const val JAR_VERSION_VAR = "\${file.jarVersion}" + const val JAR_VERSION_VAR = $$"${file.jarVersion}" // From https://github.com/MinecraftForge/MinecraftForge/blob/0ff8a596fc1ef33d4070be89dd5cb4851f93f731/src/fmllauncher/java/net/minecraftforge/fml/loading/StringSubstitutor.java - val KNOWN_SUBSTITUTIONS = setOf(JAR_VERSION_VAR, "\${global.mcVersion}", "\${global.forgeVersion}") + val KNOWN_SUBSTITUTIONS = setOf(JAR_VERSION_VAR, $$"${global.mcVersion}", $$"${global.forgeVersion}") val DISPLAY_TESTS = setOf("MATCH_VERSION", "IGNORE_SERVER_VERSION", "IGNORE_ALL_VERSION", "NONE") val DEPENDENCY_SIDES = setOf("BOTH", "CLIENT", "SERVER") Index: src/main/kotlin/platform/mcp/actions/CopyAwAction.kt =================================================================== --- src/main/kotlin/platform/mcp/actions/CopyAwAction.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mcp/actions/CopyAwAction.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -56,11 +56,10 @@ else -> null } ?: return showBalloon(e, "Invalid element") - doCopy(target, element, editor, e) + Util.doCopy(target, element, editor, e) } - companion object { - + object Util { fun doCopy(target: PsiElement, element: PsiElement, editor: Editor?, e: AnActionEvent?) { when (target) { is PsiClass -> { Index: src/main/kotlin/platform/mcp/actions/GotoAtEntryAction.kt =================================================================== --- src/main/kotlin/platform/mcp/actions/GotoAtEntryAction.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mcp/actions/GotoAtEntryAction.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -60,7 +60,7 @@ var parent = data.element.parent if (parent is PsiMember) { - val shadowTarget = ShadowHandler.getInstance()?.findFirstShadowTargetForNavigation(parent)?.element + val shadowTarget = ShadowHandler.Util.getInstance()?.findFirstShadowTargetForNavigation(parent)?.element if (shadowTarget != null) { parent = shadowTarget } Index: src/main/kotlin/platform/mcp/actions/SrgActionBase.kt =================================================================== --- src/main/kotlin/platform/mcp/actions/SrgActionBase.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mcp/actions/SrgActionBase.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -62,7 +62,7 @@ var parent = element.parent ?: return showBalloon(e, "Not a valid element") if (parent is PsiMember) { - val shadowTarget = ShadowHandler.getInstance()?.findFirstShadowTargetForReference(parent)?.element + val shadowTarget = ShadowHandler.Util.getInstance()?.findFirstShadowTargetForReference(parent)?.element if (shadowTarget != null) { parent = shadowTarget } Index: src/main/kotlin/platform/mcp/at/AtColorSettingsPage.kt =================================================================== --- src/main/kotlin/platform/mcp/at/AtColorSettingsPage.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mcp/at/AtColorSettingsPage.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -31,12 +31,12 @@ override fun getIcon() = PlatformAssets.MCP_ICON override fun getHighlighter() = AtSyntaxHighlighter() override fun getDemoText() = - """ + $$""" # Minecraft public net.minecraft.block.BlockFlowerPot func_149928_a(Lnet/minecraft/block/Block;I)Z # canNotContain private-f net.minecraft.inventory.ContainerChest field_7515F4_f # numRows - protected net.minecraft.block.state.BlockStateContainer${'$'}StateImplementation + protected net.minecraft.block.state.BlockStateContainer$StateImplementation public-f net.minecraft.item.Item func_77656_e(I)Lnet/minecraft/item/Item; # setMaxDamage public+f net.minecraft.server.management.UserList * default+f net.minecraft.item.Item *() @@ -44,17 +44,17 @@ """.trimIndent() override fun getAdditionalHighlightingTagToDescriptorMap(): Map? = null - override fun getAttributeDescriptors() = DESCRIPTORS + override fun getAttributeDescriptors() = Constants.DESCRIPTORS override fun getColorDescriptors(): Array = ColorDescriptor.EMPTY_ARRAY override fun getDisplayName() = "Access Transformers" - companion object { - private val DESCRIPTORS = arrayOf( + private object Constants { + val DESCRIPTORS = arrayOf( AttributesDescriptor("Keyword", AtSyntaxHighlighter.KEYWORD), - AttributesDescriptor("Class Name", AtSyntaxHighlighter.CLASS_NAME), - AttributesDescriptor("Class Value", AtSyntaxHighlighter.CLASS_VALUE), - AttributesDescriptor("Primitive Value", AtSyntaxHighlighter.PRIMITIVE), - AttributesDescriptor("Element Name", AtSyntaxHighlighter.ELEMENT_NAME), + AttributesDescriptor("Class name", AtSyntaxHighlighter.CLASS_NAME), + AttributesDescriptor("Class value", AtSyntaxHighlighter.CLASS_VALUE), + AttributesDescriptor("Primitive value", AtSyntaxHighlighter.PRIMITIVE), + AttributesDescriptor("Element name", AtSyntaxHighlighter.ELEMENT_NAME), AttributesDescriptor("Asterisk", AtSyntaxHighlighter.ASTERISK), AttributesDescriptor("Comment", AtSyntaxHighlighter.COMMENT), ) Index: src/main/kotlin/platform/mcp/at/AtElementFactory.kt =================================================================== --- src/main/kotlin/platform/mcp/at/AtElementFactory.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mcp/at/AtElementFactory.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -130,8 +130,8 @@ ; companion object { - fun match(s: String) = values().firstOrNull { it.text == s } - fun softMatch(s: String) = values().filter { it.text.contains(s) } + fun match(s: String) = entries.firstOrNull { it.text == s } + fun softMatch(s: String) = entries.filter { it.text.contains(s) } } } } Index: src/main/kotlin/platform/mcp/at/AtFileType.kt =================================================================== --- src/main/kotlin/platform/mcp/at/AtFileType.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mcp/at/AtFileType.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -26,7 +26,7 @@ object AtFileType : LanguageFileType(AtLanguage) { override fun getName() = "Access Transformers" - override fun getDescription() = "Access Transformers" + override fun getDescription() = "Access transformers" override fun getDefaultExtension() = "" override fun getIcon() = PlatformAssets.MCP_ICON } Index: src/main/kotlin/platform/mcp/at/AtLanguage.kt =================================================================== --- src/main/kotlin/platform/mcp/at/AtLanguage.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mcp/at/AtLanguage.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -21,5 +21,9 @@ package com.demonwav.mcdev.platform.mcp.at import com.intellij.lang.Language +import java.io.Serial -object AtLanguage : Language("Access Transformers") +object AtLanguage : Language("Access Transformers") { + @Serial + private fun readResolve(): Any = AtLanguage +} Index: src/main/kotlin/platform/mcp/at/AtParserDefinition.kt =================================================================== --- src/main/kotlin/platform/mcp/at/AtParserDefinition.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mcp/at/AtParserDefinition.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -35,23 +35,23 @@ class AtParserDefinition : ParserDefinition { override fun createLexer(project: Project) = AtLexerAdapter() - override fun getCommentTokens() = COMMENTS + override fun getCommentTokens() = TokenSets.COMMENTS override fun getStringLiteralElements(): TokenSet = TokenSet.EMPTY override fun createParser(project: Project) = AtParser() - override fun getFileNodeType() = FILE + override fun getFileNodeType() = TokenSets.FILE override fun createFile(viewProvider: FileViewProvider) = AtFile(viewProvider) override fun createElement(node: ASTNode): PsiElement = AtTypes.Factory.createElement(node) override fun spaceExistenceTypeBetweenTokens(left: ASTNode, right: ASTNode) = - map.entries.firstOrNull { e -> left.elementType == e.key.first || right.elementType == e.key.second }?.value + TokenSets.MAP.entries.firstOrNull { e -> left.elementType == e.key.first || right.elementType == e.key.second }?.value ?: ParserDefinition.SpaceRequirements.MUST_NOT - companion object { - private val COMMENTS = TokenSet.create(AtTypes.COMMENT) + object TokenSets { + val COMMENTS = TokenSet.create(AtTypes.COMMENT) - private val FILE = IFileElementType(Language.findInstance(AtLanguage::class.java)) + val FILE = IFileElementType(Language.findInstance(AtLanguage::class.java)) - private val map: Map, ParserDefinition.SpaceRequirements> = mapOf( + val MAP: Map, ParserDefinition.SpaceRequirements> = mapOf( (AtTypes.KEYWORD to AtTypes.CLASS_NAME) to ParserDefinition.SpaceRequirements.MUST, (AtTypes.CLASS_NAME to AtTypes.FIELD_NAME) to ParserDefinition.SpaceRequirements.MUST, (AtTypes.CLASS_NAME to AtTypes.FUNCTION) to ParserDefinition.SpaceRequirements.MUST, Index: src/main/kotlin/platform/mcp/at/completion/AtCompletionContributor.kt =================================================================== --- src/main/kotlin/platform/mcp/at/completion/AtCompletionContributor.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mcp/at/completion/AtCompletionContributor.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -47,7 +47,6 @@ import com.intellij.patterns.PlatformPatterns.psiElement import com.intellij.patterns.PsiElementPattern import com.intellij.psi.JavaPsiFacade -import com.intellij.psi.PsiClass import com.intellij.psi.PsiDocumentManager import com.intellij.psi.PsiElement import com.intellij.psi.search.GlobalSearchScope @@ -78,9 +77,9 @@ val text = parentText.substring(0, parentText.length - CompletionUtil.DUMMY_IDENTIFIER.length) when { - AFTER_KEYWORD.accepts(parent) -> handleAtClassName(text, parent, result) - AFTER_CLASS_NAME.accepts(parent) -> handleAtName(text, parent, result) - AFTER_NEWLINE.accepts(parent) -> handleNewLine(text, result) + Const.AFTER_KEYWORD.accepts(parent) -> handleAtClassName(text, parent, result) + Const.AFTER_CLASS_NAME.accepts(parent) -> handleAtName(text, parent, result) + Const.AFTER_NEWLINE.accepts(parent) -> handleNewLine(text, result) } } @@ -346,8 +345,8 @@ return thisName.getSimilarity(text, packageBonus) } - companion object { - fun after(type: IElementType): PsiElementPattern.Capture = + object Const { + private fun after(type: IElementType): PsiElementPattern.Capture = psiElement().afterSibling(psiElement().withElementType(elementType().oneOf(type))) val AFTER_KEYWORD = after(AtTypes.KEYWORD) Index: src/main/kotlin/platform/mcp/ct/CtAnnotator.kt =================================================================== --- src/main/kotlin/platform/mcp/ct/CtAnnotator.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mcp/ct/CtAnnotator.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -41,7 +41,7 @@ if (element is CtAccess) { val access = element.text val target = PsiTreeUtil.skipSiblingsForward(element, PsiWhiteSpace::class.java)?.text - if (!compatibleByAccessMap.get(access).contains(target)) { + if (!TokenSets.compatibleByAccessMap.get(access).contains(target)) { holder.newAnnotation(HighlightSeverity.ERROR, "Access '$access' cannot be used on '$target'").create() } @@ -53,14 +53,13 @@ } else if (element is CtFieldLiteral || element is CtMethodLiteral || element is CtClassLiteral) { val target = element.text val access = PsiTreeUtil.skipSiblingsBackward(element, PsiWhiteSpace::class.java)?.text - if (!compatibleByTargetMap.get(target).contains(access)) { + if (!TokenSets.compatibleByTargetMap.get(target).contains(access)) { holder.newAnnotation(HighlightSeverity.ERROR, "'$target' cannot be used with '$access'").create() } } } - companion object { - + object TokenSets { val compatibleByAccessMap = HashMultimap.create() val compatibleByTargetMap = HashMultimap.create() Index: src/main/kotlin/platform/mcp/ct/CtColorSettingsPage.kt =================================================================== --- src/main/kotlin/platform/mcp/ct/CtColorSettingsPage.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mcp/ct/CtColorSettingsPage.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -31,41 +31,41 @@ override fun getIcon() = PlatformAssets.MCP_ICON override fun getHighlighter() = CtSyntaxHighlighter() override fun getDemoText() = - """ + $$""" classTweaker v1 named # https://www.fabricmc.net/wiki/tutorial:accesswideners extendable class net/minecraft/world/item/crafting/Ingredient transitive-extendable class net/minecraft/world/item/crafting/Ingredient - accessible class net/minecraft/world/entity/monster/Phantom${'$'}AttackPhase - transitive-accessible class net/minecraft/world/entity/monster/Phantom${'$'}AttackPhase + accessible class net/minecraft/world/entity/monster/Phantom$AttackPhase + transitive-accessible class net/minecraft/world/entity/monster/Phantom$AttackPhase extendable method net/minecraft/server/players/IpBanList getIpFromAddress (Ljava/net/SocketAddress;)Ljava/lang/String; extendable method net/minecraft/world/item/crafting/Ingredient (Ljava/util/stream/Stream;)V - accessible field net/minecraft/world/item/crafting/Ingredient values [Lnet/minecraft/world/item/crafting/Ingredient${'$'}Value; + accessible field net/minecraft/world/item/crafting/Ingredient values [Lnet/minecraft/world/item/crafting/Ingredient$Value; inject-interface net/minecraft/world/level/block/Block com/example/MyBlockInterface transitive-inject-interface net/minecraft/world/level/block/Block com/example/MyTransitiveBlockInterface """.trimIndent() override fun getAdditionalHighlightingTagToDescriptorMap(): Map? = null - override fun getAttributeDescriptors() = DESCRIPTORS + override fun getAttributeDescriptors() = Const.DESCRIPTORS override fun getColorDescriptors(): Array = ColorDescriptor.EMPTY_ARRAY override fun getDisplayName() = "Class Tweakers" - companion object { - private val DESCRIPTORS = arrayOf( - AttributesDescriptor("Header Name", CtSyntaxHighlighter.HEADER_NAME), - AttributesDescriptor("Header Namespace", CtSyntaxHighlighter.HEADER_NAMESPACE), + private object Const { + val DESCRIPTORS = arrayOf( + AttributesDescriptor("Header name", CtSyntaxHighlighter.HEADER_NAME), + AttributesDescriptor("Header namespace", CtSyntaxHighlighter.HEADER_NAMESPACE), AttributesDescriptor("Access", CtSyntaxHighlighter.ACCESS), - AttributesDescriptor("Inject Interface", CtSyntaxHighlighter.INJECT_INTERFACE), - AttributesDescriptor("Class Element", CtSyntaxHighlighter.CLASS_ELEMENT), - AttributesDescriptor("Method Element", CtSyntaxHighlighter.METHOD_ELEMENT), - AttributesDescriptor("Field Element", CtSyntaxHighlighter.FIELD_ELEMENT), - AttributesDescriptor("Class Name", CtSyntaxHighlighter.CLASS_NAME), - AttributesDescriptor("Member Name", CtSyntaxHighlighter.MEMBER_NAME), - AttributesDescriptor("Class Value", CtSyntaxHighlighter.CLASS_VALUE), + AttributesDescriptor("Inject interface", CtSyntaxHighlighter.INJECT_INTERFACE), + AttributesDescriptor("Class element", CtSyntaxHighlighter.CLASS_ELEMENT), + AttributesDescriptor("Method element", CtSyntaxHighlighter.METHOD_ELEMENT), + AttributesDescriptor("Field element", CtSyntaxHighlighter.FIELD_ELEMENT), + AttributesDescriptor("Class name", CtSyntaxHighlighter.CLASS_NAME), + AttributesDescriptor("Member name", CtSyntaxHighlighter.MEMBER_NAME), + AttributesDescriptor("Class value", CtSyntaxHighlighter.CLASS_VALUE), AttributesDescriptor("Primitive", CtSyntaxHighlighter.PRIMITIVE), - AttributesDescriptor("Type Variable", CtSyntaxHighlighter.TYPE_VARIABLE), + AttributesDescriptor("Type variable", CtSyntaxHighlighter.TYPE_VARIABLE), AttributesDescriptor("Comment", CtSyntaxHighlighter.COMMENT), ) } Index: src/main/kotlin/platform/mcp/ct/CtCompletionContributor.kt =================================================================== --- src/main/kotlin/platform/mcp/ct/CtCompletionContributor.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mcp/ct/CtCompletionContributor.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -126,7 +126,7 @@ ) { val text = parameters.position .prevLeaf { it.elementType == CtTypes.ACCESS_ELEMENT || it.elementType == CtTypes.CRLF }?.text ?: return - val elements = CtAnnotator.compatibleByAccessMap.get(text) + val elements = CtAnnotator.TokenSets.compatibleByAccessMap.get(text) .map { LookupElementBuilder.create(it).withInsertHandler { ctx, _ -> insertWhitespace(ctx) } } result.addAllElements(elements) } Index: src/main/kotlin/platform/mcp/ct/CtFileType.kt =================================================================== --- src/main/kotlin/platform/mcp/ct/CtFileType.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mcp/ct/CtFileType.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -27,7 +27,7 @@ override fun getName() = "Class Tweaker" - override fun getDescription() = "Class Tweaker" + override fun getDescription() = "Class tweaker" override fun getDefaultExtension() = "classtweaker" Index: src/main/kotlin/platform/mcp/ct/CtLanguage.kt =================================================================== --- src/main/kotlin/platform/mcp/ct/CtLanguage.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mcp/ct/CtLanguage.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -21,5 +21,9 @@ package com.demonwav.mcdev.platform.mcp.ct import com.intellij.lang.Language +import java.io.Serial -object CtLanguage : Language("Class Tweaker") +object CtLanguage : Language("Class Tweaker") { + @Serial + private fun readResolve(): Any = CtLanguage +} Index: src/main/kotlin/platform/mcp/ct/CtParserDefinition.kt =================================================================== --- src/main/kotlin/platform/mcp/ct/CtParserDefinition.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mcp/ct/CtParserDefinition.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -40,9 +40,9 @@ override fun createLexer(project: Project): Lexer = CtLexerAdapter() override fun createParser(project: Project): PsiParser = CtParser() - override fun getFileNodeType(): IFileElementType = FILE - override fun getWhitespaceTokens(): TokenSet = WHITE_SPACES - override fun getCommentTokens(): TokenSet = COMMENTS + override fun getFileNodeType(): IFileElementType = TokenSets.FILE + override fun getWhitespaceTokens(): TokenSet = TokenSets.WHITE_SPACES + override fun getCommentTokens(): TokenSet = TokenSets.COMMENTS override fun getStringLiteralElements(): TokenSet = TokenSet.EMPTY override fun createElement(node: ASTNode): PsiElement = CtTypes.Factory.createElement(node) override fun createFile(viewProvider: FileViewProvider): PsiFile = CtFile(viewProvider) @@ -51,10 +51,10 @@ return LanguageUtil.canStickTokensTogetherByLexer(left, right, CtLexerAdapter()) } - companion object { - private val WHITE_SPACES = TokenSet.create(TokenType.WHITE_SPACE) - private val COMMENTS = TokenSet.create(CtTypes.COMMENT) + object TokenSets { + val WHITE_SPACES = TokenSet.create(TokenType.WHITE_SPACE) + val COMMENTS = TokenSet.create(CtTypes.COMMENT) - private val FILE = IFileElementType(Language.findInstance(CtLanguage::class.java)) + val FILE = IFileElementType(Language.findInstance(CtLanguage::class.java)) } } Index: src/main/kotlin/platform/mcp/ct/fixes/CopyAwAccessibleEntryFix.kt =================================================================== --- src/main/kotlin/platform/mcp/ct/fixes/CopyAwAccessibleEntryFix.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mcp/ct/fixes/CopyAwAccessibleEntryFix.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -64,6 +64,6 @@ override fun isAvailable(project: Project, editor: Editor?, file: PsiFile?): Boolean = true override fun invoke(project: Project, editor: Editor?, file: PsiFile?) { - CopyAwAction.doCopy(target, element, editor, null) + CopyAwAction.Util.doCopy(target, element, editor, null) } } Index: src/main/kotlin/platform/mcp/ct/psi/mixins/CtEntryMixin.kt =================================================================== --- src/main/kotlin/platform/mcp/ct/psi/mixins/CtEntryMixin.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mcp/ct/psi/mixins/CtEntryMixin.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -22,5 +22,4 @@ import com.demonwav.mcdev.platform.mcp.ct.psi.CtElement -interface CtEntryMixin : CtElement { -} +interface CtEntryMixin : CtElement Index: src/main/kotlin/platform/mcp/ct/psi/mixins/CtItfEntryMixin.kt =================================================================== --- src/main/kotlin/platform/mcp/ct/psi/mixins/CtItfEntryMixin.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mcp/ct/psi/mixins/CtItfEntryMixin.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -20,5 +20,4 @@ package com.demonwav.mcdev.platform.mcp.ct.psi.mixins -interface CtItfEntryMixin : CtEntryMixin { -} +interface CtItfEntryMixin : CtEntryMixin Index: src/main/kotlin/platform/mcp/ct/psi/mixins/impl/CtEntryImplMixin.kt =================================================================== --- src/main/kotlin/platform/mcp/ct/psi/mixins/impl/CtEntryImplMixin.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mcp/ct/psi/mixins/impl/CtEntryImplMixin.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -24,5 +24,4 @@ import com.intellij.extapi.psi.ASTWrapperPsiElement import com.intellij.lang.ASTNode -abstract class CtEntryImplMixin(node: ASTNode) : ASTWrapperPsiElement(node), CtEntryMixin { -} +abstract class CtEntryImplMixin(node: ASTNode) : ASTWrapperPsiElement(node), CtEntryMixin Index: src/main/kotlin/platform/mcp/ct/psi/mixins/impl/CtItfEntryImplMixin.kt =================================================================== --- src/main/kotlin/platform/mcp/ct/psi/mixins/impl/CtItfEntryImplMixin.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mcp/ct/psi/mixins/impl/CtItfEntryImplMixin.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -23,5 +23,4 @@ import com.demonwav.mcdev.platform.mcp.ct.psi.mixins.CtItfEntryMixin import com.intellij.lang.ASTNode -abstract class CtItfEntryImplMixin(node: ASTNode): CtEntryImplMixin(node), CtItfEntryMixin { -} +abstract class CtItfEntryImplMixin(node: ASTNode): CtEntryImplMixin(node), CtItfEntryMixin Index: src/main/kotlin/platform/mcp/fabricloom/FabricLoomDataService.kt =================================================================== --- src/main/kotlin/platform/mcp/fabricloom/FabricLoomDataService.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mcp/fabricloom/FabricLoomDataService.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -144,10 +144,10 @@ (json.findProperty("contact")?.value as? JsonObject)?.let { contactObject -> val properties = mutableListOf>() - if (!website.isNullOrBlank()) { + if (website.isNotBlank()) { properties += "website" to website } - if (!repo.isNullOrBlank()) { + if (repo.isNotBlank()) { properties += "repo" to repo } for (i in properties.indices) { Index: src/main/kotlin/platform/mcp/fabricloom/FabricLoomDecompileSourceProvider.kt =================================================================== --- src/main/kotlin/platform/mcp/fabricloom/FabricLoomDecompileSourceProvider.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mcp/fabricloom/FabricLoomDecompileSourceProvider.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -72,7 +72,7 @@ AttachSourcesProvider.AttachSourcesAction { override fun getName(): String = "Decompile with ${decompiler.name}" - + @Suppress("DialogTitleCapitalization") // Minecraft is a proper noun override fun getBusyText(): String = "Decompiling Minecraft..." override fun perform(orderEntriesContainingFile: List): ActionCallback { Index: src/main/kotlin/platform/mcp/fabricloom/TinyUnscrambler.kt =================================================================== --- src/main/kotlin/platform/mcp/fabricloom/TinyUnscrambler.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mcp/fabricloom/TinyUnscrambler.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -34,6 +34,7 @@ import java.awt.Dimension import java.nio.file.Path import java.nio.file.Paths +import javax.swing.ComboBoxModel import javax.swing.JPanel import net.fabricmc.mappingio.MappedElementKind import net.fabricmc.mappingio.MappingReader @@ -49,8 +50,9 @@ class SettingsComponent(mappings: Map) : JPanel(GridLayoutManager(1, 2)) { - val mappingsBoxModel = MapComboBoxModel(mappings) - val mappingsBox = ComboBox(mappingsBoxModel) + val mappingsBoxModel: MapComboBoxModel = MapComboBoxModel(mappings) + @Suppress("UNCHECKED_CAST") + val mappingsBox: ComboBox = ComboBox(mappingsBoxModel as ComboBoxModel) init { mappingsBox.renderer = SimpleListCellRenderer.create { label, value, _ -> Index: src/main/kotlin/platform/mcp/gradle/McpProjectResolverExtension.kt =================================================================== --- src/main/kotlin/platform/mcp/gradle/McpProjectResolverExtension.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mcp/gradle/McpProjectResolverExtension.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -84,7 +84,7 @@ } override fun populateModuleExtraModels(gradleModule: IdeaModule, ideModule: DataNode) { - for (handler in handlers) { + for (handler in Const.handlers) { handler.build(gradleModule, ideModule, resolverCtx) } @@ -92,7 +92,7 @@ super.populateModuleExtraModels(gradleModule, ideModule) } - companion object { - private val handlers = listOf(McpModelFG2Handler, McpModelFG3Handler, McpModelNG7Handler, McpModelNMDHandler) + private object Const { + val handlers = listOf(McpModelFG2Handler, McpModelFG3Handler, McpModelNG7Handler, McpModelNMDHandler) } } Index: src/main/kotlin/platform/mcp/mappings/Mappings.kt =================================================================== --- src/main/kotlin/platform/mcp/mappings/Mappings.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mcp/mappings/Mappings.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -62,11 +62,9 @@ fun tryGetMappedField(reference: MemberReference) = fieldMap.inverse()[reference] fun getMappedField(reference: MemberReference) = tryGetMappedField(reference) ?: reference - fun tryGetMappedField(field: PsiField) = tryGetMappedField(field.qualifiedMemberReference) fun tryGetMappedMethod(reference: MemberReference) = methodMap.inverse()[reference] fun getMappedMethod(reference: MemberReference) = tryGetMappedMethod(reference) ?: reference - fun tryGetMappedMethod(method: PsiMethod) = tryGetMappedMethod(method.qualifiedMemberReference) fun mapIntermediaryToMapped(name: String) = intermediaryNames[name] } @@ -112,7 +110,7 @@ } fun Module.getMappedMethod(mojangMethod: MemberReference): String { - return namedToMojang?.tryGetMappedMethod(mojangMethod)?.name ?: return mojangMethod.name + return namedToMojang?.tryGetMappedMethod(mojangMethod)?.name ?: mojangMethod.name } fun Module.getMappedMethod(mojangClass: String, mojangMethod: String, mojangDescriptor: String): String { @@ -127,7 +125,7 @@ } fun Module.getMojangMethod(mappedMethod: MemberReference): String { - return namedToMojang?.getIntermediaryMethod(mappedMethod)?.name ?: return mappedMethod.name + return namedToMojang?.getIntermediaryMethod(mappedMethod)?.name ?: mappedMethod.name } fun Module.getMojangMethod(mappedClass: String, mappedMethod: String, mappedDescriptor: String): String { Index: src/main/kotlin/platform/mcp/vanillagradle/VanillaGradleDecompileSourceProvider.kt =================================================================== --- src/main/kotlin/platform/mcp/vanillagradle/VanillaGradleDecompileSourceProvider.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mcp/vanillagradle/VanillaGradleDecompileSourceProvider.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -57,7 +57,7 @@ override fun getName(): String = "Decompile Minecraft" - override fun getBusyText(): String = "Decompiling Minecraft..." + override fun getBusyText(): String = @Suppress("DialogTitleCapitalization") "Decompiling Minecraft..." override fun perform(orderEntriesContainingFile: List): ActionCallback { val project = orderEntriesContainingFile.firstOrNull()?.ownerModule?.project Index: src/main/kotlin/platform/mixin/action/FindMixinsAction.kt =================================================================== --- src/main/kotlin/platform/mixin/action/FindMixinsAction.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/action/FindMixinsAction.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -46,9 +46,7 @@ import com.intellij.psi.util.PsiModificationTracker class FindMixinsAction : AnAction() { - companion object { - private const val TOOL_WINDOW_ID = "Find Mixins" - + object Util { fun findMixins( clazz: PsiClass, project: Project, @@ -131,7 +129,7 @@ val classOfElement = element.findReferencedClass() ?: return invokeLater { - openFindMixinsUI(project, classOfElement, { showInBestPositionFor(e.dataContext) }) + Util.openFindMixinsUI(project, classOfElement, { showInBestPositionFor(e.dataContext) }) } } } Index: src/main/kotlin/platform/mixin/action/GenerateAccessorHandler.kt =================================================================== --- src/main/kotlin/platform/mixin/action/GenerateAccessorHandler.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/action/GenerateAccessorHandler.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -336,8 +336,7 @@ .flatMap { JavaPsiFacade.getInstance(project).findClasses(it, GlobalSearchScope.projectScope(project)).asSequence() } - .filter { it.isAccessorMixin } - .count() + .count { it.isAccessorMixin } } private fun chooseAccessorMixin(project: Project, mixins: List): PsiClass? { Index: src/main/kotlin/platform/mixin/action/GenerateSoftImplementsAction.kt =================================================================== --- src/main/kotlin/platform/mixin/action/GenerateSoftImplementsAction.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/action/GenerateSoftImplementsAction.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -75,7 +75,7 @@ } val chooser = MemberChooser(methods.keys.toTypedArray(), false, true, project) - chooser.title = "Select Methods to Soft-implement" + chooser.title = "Select Methods to Soft-Implement" chooser.show() val elements = (chooser.selectedElements ?: return).ifEmpty { return } Index: src/main/kotlin/platform/mixin/completion/MixinLookupItem.kt =================================================================== --- src/main/kotlin/platform/mixin/completion/MixinLookupItem.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/completion/MixinLookupItem.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -81,6 +81,7 @@ super.handleInsert(context) } + @Suppress("JavaDefaultMethodsNotOverriddenByDelegation") private class ShadowField(variable: PsiVariable) : PsiVariable by variable companion object { Index: src/main/kotlin/platform/mixin/config/MixinConfig.kt =================================================================== --- src/main/kotlin/platform/mixin/config/MixinConfig.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/config/MixinConfig.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -188,7 +188,7 @@ override fun add(index: Int, element: String?) { val oldSize = size - if (index < 0 || index > oldSize) { + if (index !in 0..oldSize) { throw IndexOutOfBoundsException(index.toString()) } val arr = getOrCreateJsonArray() @@ -221,14 +221,14 @@ } override fun get(index: Int): String? { - if (index < 0 || index >= size) { + if (index !in indices) { throw IndexOutOfBoundsException(index.toString()) } return (array?.get(index) as? JsonStringLiteral)?.value } override fun removeAt(index: Int): String? { - if (index < 0 || index >= size) { + if (index !in indices) { throw IndexOutOfBoundsException(index.toString()) } val toDelete = array?.get(index) ?: return null @@ -242,7 +242,7 @@ } override fun set(index: Int, element: String?): String? { - if (index < 0 || index >= size) { + if (index !in indices) { throw IndexOutOfBoundsException(index.toString()) } val toReplace = array?.get(index) ?: return null Index: src/main/kotlin/platform/mixin/config/MixinConfigFileType.kt =================================================================== --- src/main/kotlin/platform/mixin/config/MixinConfigFileType.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/config/MixinConfigFileType.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -40,7 +40,7 @@ override fun getIcon() = PlatformAssets.MIXIN_ICON object Json : LanguageFileType(JsonLanguage.INSTANCE), MixinConfigFileType { - private val filenameRegex = "(^|\\.)mixins?(\\.[^.]+)*\\.json\$".toRegex() + private val filenameRegex = "(^|\\.)mixins?(\\.[^.]+)*\\.json$".toRegex() override fun getFilenameRegex(): Regex = filenameRegex override fun getName() = "Mixin Json Configuration" @@ -48,7 +48,7 @@ } object Json5 : LanguageFileType(Json5Language.INSTANCE), MixinConfigFileType { - private var filenameRegex = "(^|\\.)mixins?(\\.[^.]+)*\\.json5\$".toRegex() + private var filenameRegex = "(^|\\.)mixins?(\\.[^.]+)*\\.json5$".toRegex() override fun getFilenameRegex(): Regex = filenameRegex override fun getName() = "Mixin Json5 Configuration" Index: src/main/kotlin/platform/mixin/config/inspection/ConfigValueInspection.kt =================================================================== --- src/main/kotlin/platform/mixin/config/inspection/ConfigValueInspection.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/config/inspection/ConfigValueInspection.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -80,6 +80,7 @@ } } + @Suppress("SameReturnValue") private fun checkArray(childType: PsiType, value: JsonValue): Boolean { if (value !is JsonArray) { holder.registerProblem(value, "Array expected") Index: src/main/kotlin/platform/mixin/expression/MEExpressionBraceMatcher.kt =================================================================== --- src/main/kotlin/platform/mixin/expression/MEExpressionBraceMatcher.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/expression/MEExpressionBraceMatcher.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -27,15 +27,15 @@ import com.intellij.psi.tree.IElementType class MEExpressionBraceMatcher : PairedBraceMatcher { - companion object { - private val PAIRS = arrayOf( + private object Const { + val PAIRS = arrayOf( BracePair(MEExpressionTypes.TOKEN_LEFT_PAREN, MEExpressionTypes.TOKEN_RIGHT_PAREN, false), BracePair(MEExpressionTypes.TOKEN_LEFT_BRACKET, MEExpressionTypes.TOKEN_RIGHT_BRACKET, false), BracePair(MEExpressionTypes.TOKEN_LEFT_BRACE, MEExpressionTypes.TOKEN_RIGHT_BRACE, false), ) } - override fun getPairs() = PAIRS + override fun getPairs() = Const.PAIRS override fun isPairedBracesAllowedBeforeType(lbraceType: IElementType, contextType: IElementType?) = true override fun getCodeConstructStart(file: PsiFile?, openingBraceOffset: Int) = openingBraceOffset } Index: src/main/kotlin/platform/mixin/expression/MEExpressionColorSettingsPage.kt =================================================================== --- src/main/kotlin/platform/mixin/expression/MEExpressionColorSettingsPage.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/expression/MEExpressionColorSettingsPage.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -27,8 +27,8 @@ import com.intellij.openapi.options.colors.ColorSettingsPage class MEExpressionColorSettingsPage : ColorSettingsPage { - companion object { - private val DESCRIPTORS = arrayOf( + private object Const { + val DESCRIPTORS = arrayOf( AttributesDescriptor( MCDevBundle.pointer("mixinextras.expression.lang.highlighting.string.display_name"), MEExpressionSyntaxHighlighter.STRING @@ -121,7 +121,7 @@ ), ) - private val TAGS = mapOf( + val TAGS = mapOf( "call" to MEExpressionSyntaxHighlighter.IDENTIFIER_CALL, "class_name" to MEExpressionSyntaxHighlighter.IDENTIFIER_CLASS_NAME, "member_name" to MEExpressionSyntaxHighlighter.IDENTIFIER_MEMBER_NAME, @@ -146,8 +146,8 @@ )[0] """.trimIndent() - override fun getAdditionalHighlightingTagToDescriptorMap() = TAGS - override fun getAttributeDescriptors() = DESCRIPTORS + override fun getAdditionalHighlightingTagToDescriptorMap() = Const.TAGS + override fun getAttributeDescriptors() = Const.DESCRIPTORS override fun getColorDescriptors(): Array = ColorDescriptor.EMPTY_ARRAY override fun getDisplayName() = MCDevBundle("mixinextras.expression.lang.display_name") } Index: src/main/kotlin/platform/mixin/expression/MEExpressionCompletionUtil.kt =================================================================== --- src/main/kotlin/platform/mixin/expression/MEExpressionCompletionUtil.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/expression/MEExpressionCompletionUtil.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -635,7 +635,7 @@ for (unresolvedName in unresolvedNames) { val startOffset = unresolvedName.textRange.startOffset if (cursorOffset.toInt() > startOffset) { - cursorOffset.setValue(cursorOffset.toInt() - unresolvedName.textLength + 1) + cursorOffset.value = cursorOffset.toInt() - unresolvedName.textLength + 1 } unresolvedName.replace(project.meExpressionElementFactory.createName("?")) @@ -659,7 +659,7 @@ val textRange = capture.textRange if (cursorOffset.toInt() > textRange.startOffset) { - cursorOffset.setValue(cursorOffset.toInt() - if (cursorOffset.toInt() >= textRange.endOffset) 3 else 2) + cursorOffset.value = cursorOffset.toInt() - if (cursorOffset.toInt() >= textRange.endOffset) 3 else 2 } capture.replace(innerExpr) @@ -1045,7 +1045,7 @@ localTypes[0] = null } val localType = localTypes.getOrNull(index) ?: return emptyList() - val ordinal = localTypes.asSequence().take(index).filter { it == localType }.count() + val ordinal = localTypes.asSequence().take(index).count { it == localType } val localName = localType.typeNameToInsert().replace("[]", "Array") + (ordinal + 1) val isImplicit = localTypes.count { it == localType } == 1 return listOf( Index: src/main/kotlin/platform/mixin/expression/MEExpressionInjector.kt =================================================================== --- src/main/kotlin/platform/mixin/expression/MEExpressionInjector.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/expression/MEExpressionInjector.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -44,22 +44,21 @@ import com.intellij.psi.util.PsiUtil import com.intellij.psi.util.parentOfType import com.intellij.util.SmartList +import java.lang.reflect.Method class MEExpressionInjector : MultiHostInjector { - companion object { - private val ELEMENTS = listOf(PsiLiteralExpression::class.java) - private val ME_EXPRESSION_INJECTION = Key.create("mcdev.meExpressionInjection") + private object Const { + val ELEMENTS = listOf(PsiLiteralExpression::class.java) + val ME_EXPRESSION_INJECTION = Key.create("mcdev.meExpressionInjection") - private val CLASS_INJECTION_RESULT = + val CLASS_INJECTION_RESULT: Class<*> = Class.forName("com.intellij.psi.impl.source.tree.injected.InjectionResult") - private val CLASS_INJECTION_REGISTRAR_IMPL = + val CLASS_INJECTION_REGISTRAR_IMPL: Class<*> = Class.forName("com.intellij.psi.impl.source.tree.injected.InjectionRegistrarImpl") - @JvmStatic - private val METHOD_ADD_TO_RESULTS = + val METHOD_ADD_TO_RESULTS: Method = CLASS_INJECTION_REGISTRAR_IMPL.getDeclaredMethod("addToResults", CLASS_INJECTION_RESULT) .also { it.isAccessible = true } - @JvmStatic - private val METHOD_GET_INJECTED_RESULT = + val METHOD_GET_INJECTED_RESULT: Method = CLASS_INJECTION_REGISTRAR_IMPL.getDeclaredMethod("getInjectedResult") .also { it.isAccessible = true } } @@ -88,9 +87,9 @@ val modifierList = anchor.findContainingModifierList() ?: return val modCount = PsiModificationTracker.getInstance(project).modificationCount - val primaryElement = modifierList.getUserData(ME_EXPRESSION_INJECTION) + val primaryElement = modifierList.getUserData(Const.ME_EXPRESSION_INJECTION) if (primaryElement != null && primaryElement.modCount == modCount) { - METHOD_ADD_TO_RESULTS.invoke(registrar, primaryElement.injectionResult) + Const.METHOD_ADD_TO_RESULTS.invoke(registrar, primaryElement.injectionResult) return } @@ -144,8 +143,8 @@ registrar.doneInjecting() modifierList.putUserData( - ME_EXPRESSION_INJECTION, - MEExpressionInjection(modCount, METHOD_GET_INJECTED_RESULT.invoke(registrar)) + Const.ME_EXPRESSION_INJECTION, + MEExpressionInjection(modCount, Const.METHOD_GET_INJECTED_RESULT.invoke(registrar)) ) } @@ -196,5 +195,5 @@ } } - override fun elementsToInjectIn() = ELEMENTS + override fun elementsToInjectIn() = Const.ELEMENTS } Index: src/main/kotlin/platform/mixin/expression/MEExpressionLanguage.kt =================================================================== --- src/main/kotlin/platform/mixin/expression/MEExpressionLanguage.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/expression/MEExpressionLanguage.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -21,5 +21,9 @@ package com.demonwav.mcdev.platform.mixin.expression import com.intellij.lang.Language +import java.io.Serial -object MEExpressionLanguage : Language("MEExpression") +object MEExpressionLanguage : Language("MEExpression") { + @Serial + private fun readResolve(): Any = MEExpressionLanguage +} Index: src/main/kotlin/platform/mixin/expression/gui/FlowDiagram.kt =================================================================== --- src/main/kotlin/platform/mixin/expression/gui/FlowDiagram.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/expression/gui/FlowDiagram.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -253,7 +253,6 @@ } for (group in flowGraph) { - @Suppress("UnstableApiUsage") checkCanceled() val cells = mutableListOf() addFlow(group.root, null, cells::add) @@ -274,7 +273,6 @@ var maxY = 0.0 var lastLine: Int? = null for ((group, list) in groupedCells) { - @Suppress("UnstableApiUsage") checkCanceled() val (targetLeft, targetTop) = if (group.lineNumber == lastLine) { Index: src/main/kotlin/platform/mixin/expression/gui/FlowGraph.kt =================================================================== --- src/main/kotlin/platform/mixin/expression/gui/FlowGraph.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/expression/gui/FlowGraph.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -156,7 +156,6 @@ if (!flow.isRoot) { continue } - @Suppress("UnstableApiUsage") checkCanceled() val node = FlowNode(flow, project, clazz, method, allNodes) Index: src/main/kotlin/platform/mixin/expression/psi/mixins/impl/MECastExpressionImplMixin.kt =================================================================== --- src/main/kotlin/platform/mixin/expression/psi/mixins/impl/MECastExpressionImplMixin.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/expression/psi/mixins/impl/MECastExpressionImplMixin.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -53,7 +53,7 @@ ?: return false val javaType = pattern.checkType?.type ?: return false val castedExpr = this.castedExpr ?: return false - return MEPsiUtil.isWildcardExpression(castedExpr) && castType?.matchesJava(javaType, context) == true + MEPsiUtil.isWildcardExpression(castedExpr) && castType?.matchesJava(javaType, context) == true } else -> false } Index: src/main/kotlin/platform/mixin/expression/psi/mixins/impl/MEDeclarationImplMixin.kt =================================================================== --- src/main/kotlin/platform/mixin/expression/psi/mixins/impl/MEDeclarationImplMixin.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/expression/psi/mixins/impl/MEDeclarationImplMixin.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -52,7 +52,7 @@ override fun getPresentation() = object : ItemPresentation { override fun getPresentableText() = name - override fun getIcon(unused: Boolean) = this@MEDeclarationImplMixin.getIcon(Iconable.ICON_FLAG_VISIBILITY) + override fun getIcon(unused: Boolean) = this@MEDeclarationImplMixin.getIcon(ICON_FLAG_VISIBILITY) } override fun getIcon(flags: Int): Icon = if ((parent as? MEDeclarationItem)?.isType == true) { Index: src/main/kotlin/platform/mixin/folding/AccessorMixinFoldingBuilder.kt =================================================================== --- src/main/kotlin/platform/mixin/folding/AccessorMixinFoldingBuilder.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/folding/AccessorMixinFoldingBuilder.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -88,10 +88,10 @@ val method = expr.referencedMethod ?: return null if (method.hasAnnotation(INVOKER)) { - return InvokerHandler.getInstance()?.findInvokerTargetForReference(method)?.element?.name + return InvokerHandler.Util.getInstance()?.findInvokerTargetForReference(method)?.element?.name } if (method.hasAnnotation(ACCESSOR)) { - val name = AccessorHandler.getInstance()?.findAccessorTargetForReference(method)?.element?.name + val name = AccessorHandler.Util.getInstance()?.findAccessorTargetForReference(method)?.element?.name ?: return null return if (method.returnType == PsiTypes.voidType()) { "$name = " Index: src/main/kotlin/platform/mixin/handlers/AccessorHandler.kt =================================================================== --- src/main/kotlin/platform/mixin/handlers/AccessorHandler.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/handlers/AccessorHandler.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -42,8 +42,8 @@ import org.objectweb.asm.tree.ClassNode class AccessorHandler : MixinMemberAnnotationHandler { - companion object { - private val PATTERN = Regex("(get|is|set)([A-Z].*?)(_\\\$md.*)?") + object Util { + val PATTERN = Regex($$"(get|is|set)([A-Z].*?)(_\\$md.*)?") fun getInstance(): AccessorHandler? { return MixinAnnotationHandler.forMixinAnnotation(ACCESSOR) as? AccessorHandler @@ -82,7 +82,7 @@ } val memberName = member.name ?: return null - val result = PATTERN.matchEntire(memberName) ?: return null + val result = Util.PATTERN.matchEntire(memberName) ?: return null val prefix = result.groupValues[1] var name = result.groupValues[2] if (name.uppercase(Locale.ENGLISH) != name || name.length == 1) { Index: src/main/kotlin/platform/mixin/handlers/InjectorAnnotationHandler.kt =================================================================== --- src/main/kotlin/platform/mixin/handlers/InjectorAnnotationHandler.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/handlers/InjectorAnnotationHandler.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -61,7 +61,7 @@ val method = methodAttr?.computeStringArray() ?: emptyList() val desc = annotation.findAttributeValue("desc")?.findAnnotations() ?: emptyList() val selectors = method.mapNotNull { parseMixinSelector(it, methodAttr!!) } + - desc.mapNotNull { DescSelectorParser.descSelectorFromAnnotation(it) } + desc.mapNotNull { DescSelectorParser.Util.descSelectorFromAnnotation(it) } val targetClassMethods = selectors.associateWith { selector -> val actualTarget = selector.getCustomOwner(targetClass) Index: src/main/kotlin/platform/mixin/handlers/InvokerHandler.kt =================================================================== --- src/main/kotlin/platform/mixin/handlers/InvokerHandler.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/handlers/InvokerHandler.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -43,8 +43,8 @@ import org.objectweb.asm.tree.ClassNode class InvokerHandler : MixinMemberAnnotationHandler { - companion object { - private val PATTERN = Regex("(call|invoke|new|create)([A-Z].*?)(_\\\$md.*)?") + object Util { + val PATTERN = Regex($$"(call|invoke|new|create)([A-Z].*?)(_\\$md.*)?") fun getInstance(): InvokerHandler? { return MixinAnnotationHandler.forMixinAnnotation(INVOKER) as? InvokerHandler @@ -85,7 +85,7 @@ } val memberName = member.name ?: return null - val result = PATTERN.matchEntire(memberName) ?: return null + val result = Util.PATTERN.matchEntire(memberName) ?: return null val prefix = result.groupValues[1] if (prefix == "new" || prefix == "create") { return "" Index: src/main/kotlin/platform/mixin/handlers/ModifyConstantHandler.kt =================================================================== --- src/main/kotlin/platform/mixin/handlers/ModifyConstantHandler.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/handlers/ModifyConstantHandler.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -84,7 +84,7 @@ annotation: PsiAnnotation, targetClass: ClassNode, targetMethod: MethodNode, - ): List? { + ): List { val constantInfos = getConstantInfos(annotation) if (constantInfos == null) { val method = annotation.parentOfType() Index: src/main/kotlin/platform/mixin/handlers/ModifyVariableHandler.kt =================================================================== --- src/main/kotlin/platform/mixin/handlers/ModifyVariableHandler.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/handlers/ModifyVariableHandler.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -27,7 +27,6 @@ import com.demonwav.mcdev.platform.mixin.inspection.injector.ParameterGroup import com.demonwav.mcdev.platform.mixin.util.LocalInfo import com.demonwav.mcdev.platform.mixin.util.toPsiType -import com.demonwav.mcdev.util.Parameter import com.demonwav.mcdev.util.constantStringValue import com.demonwav.mcdev.util.findContainingMethod import com.demonwav.mcdev.util.findModule Index: src/main/kotlin/platform/mixin/handlers/RedirectInjectorHandler.kt =================================================================== --- src/main/kotlin/platform/mixin/handlers/RedirectInjectorHandler.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/handlers/RedirectInjectorHandler.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -380,7 +380,7 @@ private object Constructor : RedirectType { override fun isInsnAllowed(node: AbstractInsnNode): Boolean { - return NewInsnInjectionPoint.findInitCall(node as TypeInsnNode) != null + return NewInsnInjectionPoint.Util.findInitCall(node as TypeInsnNode) != null } override fun expectedMethodSignature( @@ -406,7 +406,7 @@ targetClass, targetMethod, insns.mapNotNull { - NewInsnInjectionPoint.findInitCall(it as TypeInsnNode) + NewInsnInjectionPoint.Util.findInitCall(it as TypeInsnNode) }, ).map { (paramGroups, _) -> // drop the instance parameter, return the constructed type Index: src/main/kotlin/platform/mixin/handlers/ShadowHandler.kt =================================================================== --- src/main/kotlin/platform/mixin/handlers/ShadowHandler.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/handlers/ShadowHandler.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -105,7 +105,7 @@ override val icon = MixinAssets.MIXIN_SHADOW_ICON - companion object { + object Util { fun getInstance(): ShadowHandler? { return MixinAnnotationHandler.forMixinAnnotation(SHADOW) as? ShadowHandler } Index: src/main/kotlin/platform/mixin/handlers/injectionPoint/AtResolver.kt =================================================================== --- src/main/kotlin/platform/mixin/handlers/injectionPoint/AtResolver.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/handlers/injectionPoint/AtResolver.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -54,7 +54,6 @@ import com.intellij.psi.PsiEnumConstant import com.intellij.psi.PsiExpression import com.intellij.psi.PsiModifier -import com.intellij.psi.PsiModifierList import com.intellij.psi.PsiParameterListOwner import com.intellij.psi.PsiQualifiedReference import com.intellij.psi.PsiReference @@ -115,16 +114,14 @@ fun getArgs(at: PsiAnnotation): Map { val args = at.findAttributeValue("args")?.computeStringArray().orEmpty() - val explicitArgs = args.asSequence() - .map { + val explicitArgs = args.associate { - val parts = it.split('=', limit = 2) - if (parts.size == 1) { - parts[0] to "" - } else { - parts[0] to parts[1] - } - } + val parts = it.split('=', limit = 2) + if (parts.size == 1) { + parts[0] to "" + } else { + parts[0] to parts[1] + } + } - .toMap() return getInherentArgs(at) + explicitArgs } Index: src/main/kotlin/platform/mixin/handlers/injectionPoint/ConstantInjectionPoint.kt =================================================================== --- src/main/kotlin/platform/mixin/handlers/injectionPoint/ConstantInjectionPoint.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/handlers/injectionPoint/ConstantInjectionPoint.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -65,8 +65,8 @@ import org.objectweb.asm.tree.TypeInsnNode class ConstantInjectionPoint : InjectionPoint() { - companion object { - private val ARGS_KEYS = arrayOf( + private object Const { + val ARGS_KEYS = arrayOf( "nullValue=true", "intValue", "floatValue", @@ -77,14 +77,14 @@ "expandZeroConditions" ) - private val COMMA_LIST_DELIMITER = ",".toRegex() + val COMMA_LIST_DELIMITER = ",".toRegex() } override fun onCompleted(editor: Editor, reference: PsiLiteral) { completeExtraStringAtAttribute(editor, reference, "args") } - override fun getArgsKeys(at: PsiAnnotation) = ARGS_KEYS + override fun getArgsKeys(at: PsiAnnotation) = Const.ARGS_KEYS override fun getArgsValues(at: PsiAnnotation, key: String): Array { fun collectTargets(constantToCompletion: (Any) -> Any?): Array { @@ -127,7 +127,7 @@ } override fun getArgValueListDelimiter(at: PsiAnnotation, key: String) = - COMMA_LIST_DELIMITER.takeIf { key == "expandZeroConditions" } + Const.COMMA_LIST_DELIMITER.takeIf { key == "expandZeroConditions" } fun getConstantInfo(at: PsiAnnotation): ConstantInfo? { val args = AtResolver.getArgs(at) Index: src/main/kotlin/platform/mixin/handlers/injectionPoint/ConstantStringMethodInjectionPoint.kt =================================================================== --- src/main/kotlin/platform/mixin/handlers/injectionPoint/ConstantStringMethodInjectionPoint.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/handlers/injectionPoint/ConstantStringMethodInjectionPoint.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -50,8 +50,8 @@ import org.objectweb.asm.tree.MethodNode class ConstantStringMethodInjectionPoint : AbstractMethodInjectionPoint() { - companion object { - private val ARGS_KEYS = arrayOf("ldc") + private object Const { + val ARGS_KEYS = arrayOf("ldc") } override fun onCompleted(editor: Editor, reference: PsiLiteral) { @@ -91,7 +91,7 @@ return shift != 0 && shift != 1 } - override fun getArgsKeys(at: PsiAnnotation) = ARGS_KEYS + override fun getArgsKeys(at: PsiAnnotation) = Const.ARGS_KEYS override fun getArgsValues(at: PsiAnnotation, key: String): Array { if (key != "ldc") { Index: src/main/kotlin/platform/mixin/handlers/injectionPoint/CtorHeadInjectionPoint.kt =================================================================== --- src/main/kotlin/platform/mixin/handlers/injectionPoint/CtorHeadInjectionPoint.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/handlers/injectionPoint/CtorHeadInjectionPoint.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -57,8 +57,8 @@ import org.objectweb.asm.tree.MethodNode class CtorHeadInjectionPoint : InjectionPoint() { - companion object { - private val ARGS_KEYS = arrayOf("enforce") + private object Const { + val ARGS_KEYS = arrayOf("enforce") } override fun onCompleted(editor: Editor, reference: PsiLiteral) { @@ -79,7 +79,7 @@ CodeStyleManager.getInstance(project).reformat(at) } - override fun getArgsKeys(at: PsiAnnotation) = ARGS_KEYS + override fun getArgsKeys(at: PsiAnnotation) = Const.ARGS_KEYS override fun getArgsValues(at: PsiAnnotation, key: String): Array = if (key == "enforce") { EnforceMode.entries.mapToArray { it.name } } else { Index: src/main/kotlin/platform/mixin/handlers/injectionPoint/FieldInjectionPoint.kt =================================================================== --- src/main/kotlin/platform/mixin/handlers/injectionPoint/FieldInjectionPoint.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/handlers/injectionPoint/FieldInjectionPoint.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -47,10 +47,10 @@ import org.objectweb.asm.tree.MethodNode class FieldInjectionPoint : QualifiedInjectionPoint() { - companion object { - private val VALID_OPCODES = setOf(Opcodes.GETFIELD, Opcodes.GETSTATIC, Opcodes.PUTFIELD, Opcodes.PUTSTATIC) - private val ARGS_KEYS = arrayOf("array") - private val ARRAY_VALUES = arrayOf("length", "get", "set") + private object Const { + val VALID_OPCODES = setOf(Opcodes.GETFIELD, Opcodes.GETSTATIC, Opcodes.PUTFIELD, Opcodes.PUTSTATIC) + val ARGS_KEYS = arrayOf("array") + val ARRAY_VALUES = arrayOf("length", "get", "set") } override fun onCompleted(editor: Editor, reference: PsiLiteral) { @@ -62,10 +62,10 @@ return shift != 0 && shift != 1 } - override fun getArgsKeys(at: PsiAnnotation) = ARGS_KEYS + override fun getArgsKeys(at: PsiAnnotation) = Const.ARGS_KEYS override fun getArgsValues(at: PsiAnnotation, key: String): Array = - ARRAY_VALUES.takeIf { key == "array" } ?: ArrayUtilRt.EMPTY_OBJECT_ARRAY + Const.ARRAY_VALUES.takeIf { key == "array" } ?: ArrayUtilRt.EMPTY_OBJECT_ARRAY private fun getArrayAccessType(args: Map): ArrayAccessType? { return when (args["array"]) { @@ -76,7 +76,7 @@ } } - override val validOpcodes = VALID_OPCODES + override val validOpcodes = Const.VALID_OPCODES override fun createNavigationVisitor( at: PsiAnnotation, @@ -84,7 +84,7 @@ targetClass: PsiClass, ): NavigationVisitor? { val opcode = (at.findDeclaredAttributeValue("opcode")?.constantValue as? Int) - ?.takeIf { it in VALID_OPCODES } ?: -1 + ?.takeIf { it in Const.VALID_OPCODES } ?: -1 val args = AtResolver.getArgs(at) val arrayAccess = getArrayAccessType(args) return target?.let { MyNavigationVisitor(targetClass, it, opcode, arrayAccess) } @@ -100,7 +100,7 @@ return MyCollectVisitor(mode, at.project, MemberReference(""), -1, null, 8) } val opcode = (at.findDeclaredAttributeValue("opcode")?.constantValue as? Int) - ?.takeIf { it in VALID_OPCODES } ?: -1 + ?.takeIf { it in Const.VALID_OPCODES } ?: -1 val args = AtResolver.getArgs(at) val arrayAccess = getArrayAccessType(args) val fuzz = args["fuzz"]?.toIntOrNull()?.coerceIn(1, 32) ?: 8 Index: src/main/kotlin/platform/mixin/handlers/injectionPoint/InvokeAssignInjectionPoint.kt =================================================================== --- src/main/kotlin/platform/mixin/handlers/injectionPoint/InvokeAssignInjectionPoint.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/handlers/injectionPoint/InvokeAssignInjectionPoint.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -40,11 +40,11 @@ import org.objectweb.asm.util.Printer class InvokeAssignInjectionPoint : AbstractMethodInjectionPoint() { - companion object { - private val ARGS_KEYS = arrayOf("fuzz", "skip") - private val SKIP_LIST_DELIMITER = "[ ,;]".toRegex() - private val OPCODES_BY_NAME = Printer.OPCODES.withIndex().associate { it.value to it.index } - private val DEFAULT_SKIP = setOf( + private object Const { + val ARGS_KEYS = arrayOf("fuzz", "skip") + val SKIP_LIST_DELIMITER = "[ ,;]".toRegex() + val OPCODES_BY_NAME = Printer.OPCODES.withIndex().associate { it.value to it.index } + val DEFAULT_SKIP = setOf( // Opcodes which may appear if the targetted method is part of an // expression eg. int foo = 2 + this.bar(); Opcodes.DUP, Opcodes.IADD, Opcodes.LADD, Opcodes.FADD, Opcodes.DADD, @@ -69,7 +69,7 @@ completeExtraStringAtAttribute(editor, reference, "target") } - override fun getArgsKeys(at: PsiAnnotation) = ARGS_KEYS + override fun getArgsKeys(at: PsiAnnotation) = Const.ARGS_KEYS override fun getArgsValues(at: PsiAnnotation, key: String): Array { if (key == "skip") { @@ -79,7 +79,7 @@ } override fun getArgValueListDelimiter(at: PsiAnnotation, key: String) = - SKIP_LIST_DELIMITER.takeIf { key == "skip" } + Const.SKIP_LIST_DELIMITER.takeIf { key == "skip" } override fun isShiftDiscouraged(shift: Int, at: PsiAnnotation): Boolean { // Allow shifting before INVOKE_ASSIGN @@ -102,7 +102,7 @@ ): CollectVisitor? { val args = AtResolver.getArgs(at) val fuzz = args["fuzz"]?.toIntOrNull()?.coerceAtLeast(1) ?: 1 - val skip = args["skip"]?.let { parseSkip(it) } ?: DEFAULT_SKIP + val skip = args["skip"]?.let { parseSkip(it) } ?: Const.DEFAULT_SKIP if (mode == CollectVisitor.Mode.COMPLETION) { return MyCollectVisitor(mode, at.project, MemberReference(""), fuzz, skip) @@ -111,11 +111,11 @@ } private fun parseSkip(string: String): Set { - return string.split(SKIP_LIST_DELIMITER) + return string.split(Const.SKIP_LIST_DELIMITER) .asSequence() .mapNotNull { part -> val trimmedPart = part.trim() - OPCODES_BY_NAME[trimmedPart.removePrefix("Opcodes.")] + Const.OPCODES_BY_NAME[trimmedPart.removePrefix("Opcodes.")] ?: trimmedPart.toIntOrNull()?.takeIf { it >= 0 && it < Printer.OPCODES.size } } .toSet() Index: src/main/kotlin/platform/mixin/handlers/injectionPoint/JumpInjectionPoint.kt =================================================================== --- src/main/kotlin/platform/mixin/handlers/injectionPoint/JumpInjectionPoint.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/handlers/injectionPoint/JumpInjectionPoint.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -34,8 +34,8 @@ import org.objectweb.asm.tree.MethodNode class JumpInjectionPoint : InjectionPoint() { - companion object { - private val VALID_OPCODES = setOf( + private object Const { + val VALID_OPCODES = setOf( Opcodes.IFEQ, Opcodes.IFNE, Opcodes.IFLT, @@ -75,7 +75,7 @@ mode: CollectVisitor.Mode ): CollectVisitor { val opcode = (at.findDeclaredAttributeValue("opcode")?.constantValue as? Int) - ?.takeIf { it in VALID_OPCODES } ?: -1 + ?.takeIf { it in Const.VALID_OPCODES } ?: -1 return MyCollectVisitor(at.project, targetClass, mode, opcode) } Index: src/main/kotlin/platform/mixin/handlers/injectionPoint/NewInsnInjectionPoint.kt =================================================================== --- src/main/kotlin/platform/mixin/handlers/injectionPoint/NewInsnInjectionPoint.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/handlers/injectionPoint/NewInsnInjectionPoint.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -60,7 +60,7 @@ completeExtraStringAtAttribute(editor, reference, "target") } - override fun getArgsKeys(at: PsiAnnotation) = ARGS_KEYS + override fun getArgsKeys(at: PsiAnnotation) = Util.ARGS_KEYS override fun getArgsValues(at: PsiAnnotation, key: String): Array { if (key != "class") { @@ -109,7 +109,7 @@ override fun createLookup(targetClass: ClassNode, result: CollectVisitor.Result): LookupElementBuilder? { val newInsn = result.originalInsn as? TypeInsnNode ?: return null - val methodInsn = findInitCall(newInsn) ?: return null + val methodInsn = Util.findInitCall(newInsn) ?: return null when (val target = result.target) { is PsiClass -> { return JavaLookupElementBuilder.forClass(target, target.internalName) @@ -166,7 +166,7 @@ for (insn in insns) { if (insn !is TypeInsnNode) continue if (insn.opcode != Opcodes.NEW) continue - val initCall = findInitCall(insn) ?: continue + val initCall = Util.findInitCall(insn) ?: continue val sourceMethod = nodeMatchesSelector(initCall, mode, selector, project) ?: continue addResult( @@ -178,8 +178,8 @@ } } - companion object { - private val ARGS_KEYS = arrayOf("class") + object Util { + val ARGS_KEYS = arrayOf("class") fun findInitCall(newInsn: TypeInsnNode): MethodInsnNode? { var newInsns = 0 Index: src/main/kotlin/platform/mixin/handlers/mixinextras/MixinExtrasInjectorAnnotationHandler.kt =================================================================== --- src/main/kotlin/platform/mixin/handlers/mixinextras/MixinExtrasInjectorAnnotationHandler.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/handlers/mixinextras/MixinExtrasInjectorAnnotationHandler.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -357,7 +357,7 @@ Opcodes.INSTANCEOF -> listOf(Parameter("object", Type.getType(Any::class.java).toPsiType(elementFactory))) - Opcodes.NEW -> NewInsnInjectionPoint.findInitCall(insn)?.let { + Opcodes.NEW -> NewInsnInjectionPoint.Util.findInitCall(insn)?.let { getPsiParameters(it, targetClass, annotation) } @@ -410,25 +410,25 @@ is LdcInsnNode -> { val cst = insn.cst when (cst) { - is Int -> return Type.INT_TYPE - is Float -> return Type.FLOAT_TYPE - is Long -> return Type.LONG_TYPE - is Double -> return Type.DOUBLE_TYPE - is String -> return Type.getType(String::class.java) - is Type -> return Type.getType(Class::class.java) + is Int -> Type.INT_TYPE + is Float -> Type.FLOAT_TYPE + is Long -> Type.LONG_TYPE + is Double -> Type.DOUBLE_TYPE + is String -> Type.getType(String::class.java) + is Type -> Type.getType(Class::class.java) else -> null } } is TypeInsnNode -> { - return if (insn.getOpcode() < Opcodes.CHECKCAST) { + if (insn.getOpcode() < Opcodes.CHECKCAST) { null // Don't treat NEW and ANEWARRAY as constants } else Type.getType(Class::class.java) } else -> { val index = CONSTANTS_ALL.indexOf(insn.opcode) - return if (index < 0) null else Type.getType(CONSTANTS_TYPES.get(index)) + if (index < 0) null else Type.getType(CONSTANTS_TYPES[index]) } } } Index: src/main/kotlin/platform/mixin/insight/target/AccessorTargetCodeVisionProvider.kt =================================================================== --- src/main/kotlin/platform/mixin/insight/target/AccessorTargetCodeVisionProvider.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/insight/target/AccessorTargetCodeVisionProvider.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -44,7 +44,7 @@ override fun getHint(element: PsiElement, file: PsiFile): String? { val targetClass = element as? PsiClass ?: return null - val numberOfMixins = FindMixinsAction.findMixins(targetClass, element.project)?.count { it.isAccessorMixin } + val numberOfMixins = FindMixinsAction.Util.findMixins(targetClass, element.project)?.count { it.isAccessorMixin } ?: return null if (numberOfMixins == 0) { return null @@ -55,7 +55,7 @@ override fun handleClick(editor: Editor, element: PsiElement, event: MouseEvent?) { val project = editor.project ?: return val targetClass = element.findReferencedClass() ?: return - FindMixinsAction.openFindMixinsUI( + FindMixinsAction.Util.openFindMixinsUI( project, targetClass, { Index: src/main/kotlin/platform/mixin/insight/target/MixinAccessorTargetLineMarkerProvider.kt =================================================================== --- src/main/kotlin/platform/mixin/insight/target/MixinAccessorTargetLineMarkerProvider.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/insight/target/MixinAccessorTargetLineMarkerProvider.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -50,7 +50,7 @@ val identifier = element.nameIdentifier ?: continue - val mixins = FindMixinsAction.findMixins(element, element.project) ?: continue + val mixins = FindMixinsAction.Util.findMixins(element, element.project) ?: continue if (mixins.none { it.isAccessorMixin }) { continue } @@ -69,7 +69,7 @@ override fun navigate(e: MouseEvent, elt: PsiIdentifier) { val targetClass = elt.parent as? PsiClass ?: return - FindMixinsAction.openFindMixinsUI( + FindMixinsAction.Util.openFindMixinsUI( targetClass.project, targetClass, { show(RelativePoint(e)) } Index: src/main/kotlin/platform/mixin/insight/target/MixinTargetCodeVisionProvider.kt =================================================================== --- src/main/kotlin/platform/mixin/insight/target/MixinTargetCodeVisionProvider.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/insight/target/MixinTargetCodeVisionProvider.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -44,7 +44,7 @@ override fun getHint(element: PsiElement, file: PsiFile): String? { val targetClass = element as? PsiClass ?: return null - val numberOfMixins = FindMixinsAction.findMixins(targetClass, element.project)?.count { !it.isAccessorMixin } + val numberOfMixins = FindMixinsAction.Util.findMixins(targetClass, element.project)?.count { !it.isAccessorMixin } ?: return null if (numberOfMixins == 0) { return null @@ -55,7 +55,7 @@ override fun handleClick(editor: Editor, element: PsiElement, event: MouseEvent?) { val project = editor.project ?: return val targetClass = element.findReferencedClass() ?: return - FindMixinsAction.openFindMixinsUI( + FindMixinsAction.Util.openFindMixinsUI( project, targetClass, { Index: src/main/kotlin/platform/mixin/insight/target/MixinTargetLineMarkerProvider.kt =================================================================== --- src/main/kotlin/platform/mixin/insight/target/MixinTargetLineMarkerProvider.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/insight/target/MixinTargetLineMarkerProvider.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -50,7 +50,7 @@ val identifier = element.nameIdentifier ?: continue - val mixins = FindMixinsAction.findMixins(element, element.project) ?: continue + val mixins = FindMixinsAction.Util.findMixins(element, element.project) ?: continue if (mixins.all { it.isAccessorMixin }) { continue } @@ -69,7 +69,7 @@ override fun navigate(e: MouseEvent, elt: PsiIdentifier) { val targetClass = elt.parent as? PsiClass ?: return - FindMixinsAction.openFindMixinsUI( + FindMixinsAction.Util.openFindMixinsUI( targetClass.project, targetClass, { show(RelativePoint(e)) } Index: src/main/kotlin/platform/mixin/inspection/MixinClassTypeInspection.kt =================================================================== --- src/main/kotlin/platform/mixin/inspection/MixinClassTypeInspection.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/inspection/MixinClassTypeInspection.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -52,7 +52,7 @@ } val classKeywordElement = mixinClass.children.firstOrNull { - (it as? PsiKeyword)?.tokenType in CLASS_KEYWORD_SET + (it as? PsiKeyword)?.tokenType in Const.CLASS_KEYWORD_SET } val problemElement = classKeywordElement ?: mixinClass.nameIdentifier ?: mixinClass @@ -95,8 +95,8 @@ } } - companion object { - private val CLASS_KEYWORD_SET = TokenSet.create( + private object Const { + val CLASS_KEYWORD_SET = TokenSet.create( JavaTokenType.CLASS_KEYWORD, JavaTokenType.INTERFACE_KEYWORD, JavaTokenType.ENUM_KEYWORD, Index: src/main/kotlin/platform/mixin/inspection/UnusedMixinInspection.kt =================================================================== --- src/main/kotlin/platform/mixin/inspection/UnusedMixinInspection.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/inspection/UnusedMixinInspection.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -30,16 +30,23 @@ import com.demonwav.mcdev.util.findModule import com.demonwav.mcdev.util.fullQualifiedName import com.demonwav.mcdev.util.mapFirstNotNull +import com.intellij.codeInsight.intention.FileModifier import com.intellij.codeInspection.LocalQuickFix +import com.intellij.codeInspection.LocalQuickFixOnPsiElement import com.intellij.codeInspection.ProblemDescriptor import com.intellij.codeInspection.ProblemsHolder +import com.intellij.codeInspection.util.IntentionFamilyName +import com.intellij.codeInspection.util.IntentionName import com.intellij.json.psi.JsonFile import com.intellij.json.psi.JsonObject import com.intellij.openapi.project.Project -import com.intellij.openapi.vfs.VirtualFile import com.intellij.psi.JavaElementVisitor import com.intellij.psi.PsiClass +import com.intellij.psi.PsiElement +import com.intellij.psi.PsiFile import com.intellij.psi.PsiManager +import com.intellij.psi.SmartPsiElementPointer +import com.intellij.psi.createSmartPointer import com.intellij.psi.search.GlobalSearchScope class UnusedMixinInspection : MixinInspection() { @@ -81,7 +88,8 @@ SideOnlyUtil.getSideForClass(stubClass) }?.second ?: Side.NONE } - val quickFix = QuickFix(bestQuickFixFile, qualifiedName, side) + val jsonQuickFixFile = PsiManager.getInstance(holder.project).findFile(bestQuickFixFile) as? JsonFile ?: return + val quickFix = QuickFix(jsonQuickFixFile.createSmartPointer(), qualifiedName, side) holder.registerProblem(problematicElement, "Mixin not found in any mixin config", quickFix) } else { holder.registerProblem(problematicElement, "Mixin not found in any mixin config") @@ -92,7 +100,7 @@ } private class QuickFix( - private val quickFixFile: VirtualFile, + private val quickFixFile: SmartPsiElementPointer, private val qualifiedName: String, private val side: Side, ) : LocalQuickFix { @@ -106,7 +114,7 @@ override fun getName() = "Add to Mixin config ($sideDisplayName side)" override fun applyFix(project: Project, descriptor: ProblemDescriptor) { - val psiFile = PsiManager.getInstance(project).findFile(quickFixFile) as? JsonFile ?: return + val psiFile = quickFixFile.element ?: return val root = psiFile.topLevelValue as? JsonObject ?: return val config = MixinConfig(project, root) val mixinList = when (side) { @@ -117,6 +125,34 @@ mixinList.add(qualifiedName) } + override fun getFileModifierForPreview(target: PsiFile): FileModifier? { + val file = quickFixFile.element ?: return null + val root = file.topLevelValue as? JsonObject ?: return null + @Suppress("StatefulEp") + return object : LocalQuickFixOnPsiElement(root) { + override fun getText(): @IntentionName String { + return "Add to Mixin config ($sideDisplayName side)" + } + override fun getFamilyName(): @IntentionFamilyName String = text + + override fun invoke( + project: Project, + psiFile: PsiFile, + startElement: PsiElement, + endElement: PsiElement + ) { + val jsonObject = startElement as JsonObject + val config = MixinConfig(project, jsonObject) + val mixinList = when (side) { + Side.CLIENT -> config.qualifiedClient + Side.SERVER -> config.qualifiedServer + else -> config.qualifiedMixins + } + mixinList.add(qualifiedName) + } + } + } + override fun getFamilyName() = name } } Index: src/main/kotlin/platform/mixin/inspection/addedMembers/AddedMembersNameFormatInspection.kt =================================================================== --- src/main/kotlin/platform/mixin/inspection/addedMembers/AddedMembersNameFormatInspection.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/inspection/addedMembers/AddedMembersNameFormatInspection.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -79,7 +79,7 @@ var validNameFixSearch = "^.+$".toRegex() @JvmField - var validNameFixReplace = "MOD_ID\\\$\$0" + var validNameFixReplace = $$"MOD_ID\\$$0" @JvmField var reportFields = ReportMode.NOT_ON_FABRIC Index: src/main/kotlin/platform/mixin/inspection/fix/AnnotationAttributeFix.kt =================================================================== --- src/main/kotlin/platform/mixin/inspection/fix/AnnotationAttributeFix.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/inspection/fix/AnnotationAttributeFix.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -40,13 +40,10 @@ @SafeFieldForPreview private val attributes = attributes.map { (key, value) -> key to value?.let { - if (it !is PsiAnnotationMemberValue) { - JavaPsiFacade.getElementFactory(annotation.project).createLiteralExpression(it) - } else { - it + it as? PsiAnnotationMemberValue + ?: JavaPsiFacade.getElementFactory(annotation.project).createLiteralExpression(it) - } - } + } + } - } private val description = run { val added = this.attributes Index: src/main/kotlin/platform/mixin/inspection/injector/CancellableBeforeSuperCallInspection.kt =================================================================== --- src/main/kotlin/platform/mixin/inspection/injector/CancellableBeforeSuperCallInspection.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/inspection/injector/CancellableBeforeSuperCallInspection.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -48,7 +48,7 @@ if (cancellableAttr.value?.constantValue != true) { return } - if (doesInjectBeforeSuperConstructorCall(annotation)) { + if (Util.doesInjectBeforeSuperConstructorCall(annotation)) { holder.registerProblem( cancellableAttr, "@Inject is cancellable before a superconstructor call", @@ -58,7 +58,7 @@ } } - companion object { + object Util { fun doesInjectBeforeSuperConstructorCall(annotation: PsiAnnotation): Boolean { val handler = MixinAnnotationHandler.forMixinAnnotation(MixinConstants.Annotations.INJECT)!! as InjectorAnnotationHandler Index: src/main/kotlin/platform/mixin/inspection/injector/CtorHeadUsedForNonConstructorInspection.kt =================================================================== --- src/main/kotlin/platform/mixin/inspection/injector/CtorHeadUsedForNonConstructorInspection.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/inspection/injector/CtorHeadUsedForNonConstructorInspection.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -41,7 +41,7 @@ if (atValue.constantValue != "CTOR_HEAD") { return } - if (!UnnecessaryUnsafeInspection.mightTargetConstructor(annotation)) { + if (!UnnecessaryUnsafeInspection.Util.mightTargetConstructor(annotation)) { holder.registerProblem( atValue, "CTOR_HEAD used without targeting a constructor", Index: src/main/kotlin/platform/mixin/inspection/injector/InjectCouldBeOverwriteInspection.kt =================================================================== --- src/main/kotlin/platform/mixin/inspection/injector/InjectCouldBeOverwriteInspection.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/inspection/injector/InjectCouldBeOverwriteInspection.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -131,7 +131,7 @@ private fun isDefinitelyCancelled(project: Project, method: PsiMethod): Boolean { val methodBody = method.body ?: return false - val ciParam = method.parameterList.parameters.firstOrNull(::isCallbackInfoParam) ?: return false + val ciParam = method.parameterList.parameters.firstOrNull(Util::isCallbackInfoParam) ?: return false val ciClass = (ciParam.type as? PsiClassType)?.resolve() ?: return false val factory = DfaValueFactory(project) @@ -300,7 +300,7 @@ // delete parameters not before the callback info parameter val paramsToDelete = oldMethod.parameterList.parameters.asSequence() - .dropWhile { !isCallbackInfoParam(it) } + .dropWhile { !Util.isCallbackInfoParam(it) } .map { it.createSmartPointer() } .toList() for (param in paramsToDelete) { @@ -363,8 +363,8 @@ override fun getDisplayName() = "Unnecessary local variable" } - companion object { - private fun isCallbackInfoParam(param: PsiParameter): Boolean { + private object Util { + fun isCallbackInfoParam(param: PsiParameter): Boolean { val type = (param.type as? PsiClassType)?.resolve() ?: return false val qName = type.qualifiedName ?: return false return qName == MixinConstants.Classes.CALLBACK_INFO || Index: src/main/kotlin/platform/mixin/inspection/injector/InjectIntoConstructorInspection.kt =================================================================== --- src/main/kotlin/platform/mixin/inspection/injector/InjectIntoConstructorInspection.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/inspection/injector/InjectIntoConstructorInspection.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -26,7 +26,6 @@ import com.demonwav.mcdev.platform.mixin.inspection.fix.AnnotationAttributeFix import com.demonwav.mcdev.platform.mixin.util.MethodTargetMember import com.demonwav.mcdev.platform.mixin.util.MixinConstants.Annotations.INJECT -import com.demonwav.mcdev.platform.mixin.util.findDelegateConstructorCall import com.demonwav.mcdev.platform.mixin.util.isConstructor import com.demonwav.mcdev.platform.mixin.util.isFabricMixin import com.demonwav.mcdev.util.constantValue Index: src/main/kotlin/platform/mixin/inspection/injector/InvalidInjectorMethodSignatureInspection.kt =================================================================== --- src/main/kotlin/platform/mixin/inspection/injector/InvalidInjectorMethodSignatureInspection.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/inspection/injector/InvalidInjectorMethodSignatureInspection.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -22,7 +22,6 @@ import com.demonwav.mcdev.platform.mixin.handlers.InjectorAnnotationHandler import com.demonwav.mcdev.platform.mixin.handlers.MixinAnnotationHandler -import com.demonwav.mcdev.platform.mixin.handlers.injectionPoint.AtResolver import com.demonwav.mcdev.platform.mixin.inspection.MixinInspection import com.demonwav.mcdev.platform.mixin.reference.MethodReference import com.demonwav.mcdev.platform.mixin.util.MixinConstants @@ -186,7 +185,7 @@ var isValid = false for ((expectedParameters, expectedReturnType) in possibleSignatures) { val paramsMatch = - checkParameters(parameters, expectedParameters, handler.allowCoerce) == CheckResult.OK + Util.checkParameters(parameters, expectedParameters, handler.allowCoerce) == CheckResult.OK if (paramsMatch) { val methodReturnType = method.returnType if (methodReturnType != null && @@ -205,7 +204,7 @@ else -> expectedReturnType } - val paramsCheck = checkParameters(parameters, expectedParameters, handler.allowCoerce) + val paramsCheck = Util.checkParameters(parameters, expectedParameters, handler.allowCoerce) val isWarning = paramsCheck == CheckResult.WARNING val methodReturnType = method.returnType val returnTypeOk = methodReturnType != null && @@ -264,7 +263,7 @@ } } - companion object { + object Util { fun checkParameters( parameterList: PsiParameterList, expected: List, Index: src/main/kotlin/platform/mixin/inspection/injector/MixinCancellableInspection.kt =================================================================== --- src/main/kotlin/platform/mixin/inspection/injector/MixinCancellableInspection.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/inspection/injector/MixinCancellableInspection.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -89,7 +89,7 @@ if (definitelyUsesCancel && !isCancellable) { val fixes = mutableListOf() - if (!CancellableBeforeSuperCallInspection.doesInjectBeforeSuperConstructorCall(injectAnnotation)) { + if (!CancellableBeforeSuperCallInspection.Util.doesInjectBeforeSuperConstructorCall(injectAnnotation)) { fixes += MakeInjectCancellableFix(injectAnnotation) } Index: src/main/kotlin/platform/mixin/inspection/injector/MixinParameterNameInspection.kt =================================================================== --- src/main/kotlin/platform/mixin/inspection/injector/MixinParameterNameInspection.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/inspection/injector/MixinParameterNameInspection.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -132,7 +132,7 @@ var anyValidSignatures = false for ((expectedParams, _) in expectedSignatures) { - if (InvalidInjectorMethodSignatureInspection.checkParameters( + if (InvalidInjectorMethodSignatureInspection.Util.checkParameters( method.parameterList, expectedParams, handler.allowCoerce Index: src/main/kotlin/platform/mixin/inspection/injector/ModifyVariableArgsOnlyInspection.kt =================================================================== --- src/main/kotlin/platform/mixin/inspection/injector/ModifyVariableArgsOnlyInspection.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/inspection/injector/ModifyVariableArgsOnlyInspection.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -54,7 +54,7 @@ MixinAnnotationHandler.forMixinAnnotation(MODIFY_VARIABLE) as? InjectorAnnotationHandler ?: return val localInfo = LocalInfo.fromAnnotation(localType, modifyVariable) - if (shouldReport(localInfo, injector, modifyVariable)) { + if (Util.shouldReport(localInfo, injector, modifyVariable)) { val description = "@ModifyVariable may be argsOnly = true" holder.registerProblem( problemElement, @@ -66,7 +66,7 @@ } } - companion object { + object Util { fun shouldReport( localInfo: LocalInfo, injector: InjectorAnnotationHandler, Index: src/main/kotlin/platform/mixin/inspection/injector/ModifyVariableMayUseNameInspection.kt =================================================================== --- src/main/kotlin/platform/mixin/inspection/injector/ModifyVariableMayUseNameInspection.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/inspection/injector/ModifyVariableMayUseNameInspection.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -69,7 +69,7 @@ return } - val variableName = getVariableNameToIntroduce(localInfo, injector, modifyVariable) ?: return + val variableName = Util.getVariableNameToIntroduce(localInfo, injector, modifyVariable) ?: return val fixes = mutableListOf(ReplaceWithNameFix(modifyVariable, variableName)) @@ -103,7 +103,7 @@ } } - companion object { + object Util { fun getVariableNameToIntroduce( localInfo: LocalInfo, injector: InjectorAnnotationHandler, Index: src/main/kotlin/platform/mixin/inspection/injector/UnnecessaryUnsafeInspection.kt =================================================================== --- src/main/kotlin/platform/mixin/inspection/injector/UnnecessaryUnsafeInspection.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/inspection/injector/UnnecessaryUnsafeInspection.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -80,7 +80,7 @@ return } - if (alwaysUnnecessary || !mightTargetConstructor(annotation)) { + if (alwaysUnnecessary || !Util.mightTargetConstructor(annotation)) { holder.registerProblem( unsafeValue, "Unnecessary unsafe = true", @@ -91,7 +91,7 @@ } } - companion object { + object Util { fun mightTargetConstructor(at: PsiAnnotation): Boolean { val injectorAnnotation = AtResolver.findInjectorAnnotation(at) ?: return true Index: src/main/kotlin/platform/mixin/inspection/injector/UnusedLocalCaptureInspection.kt =================================================================== --- src/main/kotlin/platform/mixin/inspection/injector/UnusedLocalCaptureInspection.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/inspection/injector/UnusedLocalCaptureInspection.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -42,7 +42,7 @@ import com.intellij.psi.util.PsiUtil class UnusedLocalCaptureInspection : MixinInspection() { - companion object { + object Util { fun findCallbackInfoParam(parameters: Array): Int { return parameters.indexOfFirst { param -> val classType = param.type as? PsiClassType ?: return@indexOfFirst false @@ -87,7 +87,7 @@ // find the start of the locals in the parameter list val parameters = method.parameterList.parameters - val callbackInfoIndex = findCallbackInfoParam(parameters) + val callbackInfoIndex = Util.findCallbackInfoParam(parameters) if (callbackInfoIndex == -1) { return } Index: src/main/kotlin/platform/mixin/inspection/mixinextras/InjectLocalCaptureReplaceWithLocalInspection.kt =================================================================== --- src/main/kotlin/platform/mixin/inspection/mixinextras/InjectLocalCaptureReplaceWithLocalInspection.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/inspection/mixinextras/InjectLocalCaptureReplaceWithLocalInspection.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -94,7 +94,7 @@ // find the start of the locals in the parameter list val parameters = method.parameterList.parameters - val callbackInfoIndex = UnusedLocalCaptureInspection.findCallbackInfoParam(parameters) + val callbackInfoIndex = UnusedLocalCaptureInspection.Util.findCallbackInfoParam(parameters) if (callbackInfoIndex == -1) { return } Index: src/main/kotlin/platform/mixin/inspection/mixinextras/InvokeAssignReplaceWithExpressionInspection.kt =================================================================== --- src/main/kotlin/platform/mixin/inspection/mixinextras/InvokeAssignReplaceWithExpressionInspection.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/inspection/mixinextras/InvokeAssignReplaceWithExpressionInspection.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -69,10 +69,7 @@ if (atValue.constantStringValue != "INVOKE_ASSIGN") { return } - val atTarget = annotation.findDeclaredAttributeValue("target") - if (atTarget == null) { - return - } + val atTarget = annotation.findDeclaredAttributeValue("target") ?: return val target = parseMixinSelector(atTarget) ?: return val methodInsn = resolveMethodInsn(annotation, target) ?: return val customArgs = AtResolver.getArgs(annotation) Index: src/main/kotlin/platform/mixin/inspection/mixinextras/LocalArgsOnlyInspection.kt =================================================================== --- src/main/kotlin/platform/mixin/inspection/mixinextras/LocalArgsOnlyInspection.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/inspection/mixinextras/LocalArgsOnlyInspection.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -60,7 +60,7 @@ val localType = parameter.type.unwrapLocalRef() val localInfo = LocalInfo.fromAnnotation(localType, localAnnotation) - if (ModifyVariableArgsOnlyInspection.shouldReport(localInfo, injector, injectorAnnotation)) { + if (ModifyVariableArgsOnlyInspection.Util.shouldReport(localInfo, injector, injectorAnnotation)) { holder.registerProblem( localAnnotation.nameReferenceElement ?: localAnnotation, "@Local may be argsOnly = true", Index: src/main/kotlin/platform/mixin/inspection/mixinextras/LocalMayUseNameInspection.kt =================================================================== --- src/main/kotlin/platform/mixin/inspection/mixinextras/LocalMayUseNameInspection.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/inspection/mixinextras/LocalMayUseNameInspection.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -23,7 +23,7 @@ import com.demonwav.mcdev.platform.mixin.handlers.InjectorAnnotationHandler import com.demonwav.mcdev.platform.mixin.handlers.MixinAnnotationHandler import com.demonwav.mcdev.platform.mixin.inspection.MixinInspection -import com.demonwav.mcdev.platform.mixin.inspection.injector.ModifyVariableMayUseNameInspection.Companion.getVariableNameToIntroduce +import com.demonwav.mcdev.platform.mixin.inspection.injector.ModifyVariableMayUseNameInspection.Util.getVariableNameToIntroduce import com.demonwav.mcdev.platform.mixin.inspection.injector.ModifyVariableMayUseNameInspection.ReplaceWithNameFix import com.demonwav.mcdev.platform.mixin.util.LocalInfo import com.demonwav.mcdev.platform.mixin.util.MixinConstants Index: src/main/kotlin/platform/mixin/inspection/mixinextras/WrapWithConditionValidNonVoidInspection.kt =================================================================== --- src/main/kotlin/platform/mixin/inspection/mixinextras/WrapWithConditionValidNonVoidInspection.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/inspection/mixinextras/WrapWithConditionValidNonVoidInspection.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -77,41 +77,6 @@ } } - companion object { - private fun WrapWithConditionHandler.getReplaceWithWrapOpInfo(annotation: PsiAnnotation): ReplaceWithWrapOpInfo? { - var targetType: Type? = null - var requiredParameterCount: Int? = null - - for (target in MixinAnnotationHandler.resolveTarget(annotation)) { - if (target !is MethodTargetMember) { - continue - } - - for (insn in resolveInstructions(annotation, target.classAndMethod.clazz, target.classAndMethod.method)) { - val newTargetType = getValidTargetType(insn.insn) ?: continue - if (targetType != null && targetType != newTargetType) { - return null - } - targetType = newTargetType - - val newRequiredParameterCount = getRequiredParameterCount(insn.insn, target.classAndMethod.clazz, annotation) - if (requiredParameterCount != null && requiredParameterCount != newRequiredParameterCount) { - return null - } - requiredParameterCount = newRequiredParameterCount - } - } - - if (targetType == null || requiredParameterCount == null) { - return null - } - - return ReplaceWithWrapOpInfo(targetType, requiredParameterCount) - } - } - - private class ReplaceWithWrapOpInfo(val targetType: Type, val requiredParameterCount: Int) - private class ReplaceWithWrapOpFix(annotation: PsiAnnotation) : LocalQuickFixOnPsiElement(annotation) { override fun getFamilyName() = "Replace with @WrapOperation" override fun getText() = "Replace with @WrapOperation" @@ -203,3 +168,36 @@ } } } + +private class ReplaceWithWrapOpInfo(val targetType: Type, val requiredParameterCount: Int) + +private fun WrapWithConditionHandler.getReplaceWithWrapOpInfo(annotation: PsiAnnotation): ReplaceWithWrapOpInfo? { + var targetType: Type? = null + var requiredParameterCount: Int? = null + + for (target in MixinAnnotationHandler.resolveTarget(annotation)) { + if (target !is MethodTargetMember) { + continue + } + + for (insn in resolveInstructions(annotation, target.classAndMethod.clazz, target.classAndMethod.method)) { + val newTargetType = getValidTargetType(insn.insn) ?: continue + if (targetType != null && targetType != newTargetType) { + return null + } + targetType = newTargetType + + val newRequiredParameterCount = getRequiredParameterCount(insn.insn, target.classAndMethod.clazz, annotation) + if (requiredParameterCount != null && requiredParameterCount != newRequiredParameterCount) { + return null + } + requiredParameterCount = newRequiredParameterCount + } + } + + if (targetType == null || requiredParameterCount == null) { + return null + } + + return ReplaceWithWrapOpInfo(targetType, requiredParameterCount) +} Index: src/main/kotlin/platform/mixin/inspection/reference/UnnecessaryQualifiedMemberReferenceInspection.kt =================================================================== --- src/main/kotlin/platform/mixin/inspection/reference/UnnecessaryQualifiedMemberReferenceInspection.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/inspection/reference/UnnecessaryQualifiedMemberReferenceInspection.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -60,12 +60,12 @@ holder.registerProblem( value, "Unnecessary qualified reference to '${selector.displayName}' in target class", - QuickFix(selector), + QuickFix(selector.withoutOwner.toMixinString()), ) } } - private class QuickFix(private val reference: MemberReference) : LocalQuickFix { + private class QuickFix(private val replacement: String) : LocalQuickFix { override fun getFamilyName() = "Remove qualifier" @@ -73,7 +73,7 @@ val element = descriptor.psiElement element.replace( JavaPsiFacade.getElementFactory(project) - .createExpressionFromText("\"${reference.withoutOwner.toMixinString()}\"", element), + .createExpressionFromText("\"${replacement}\"", element), ) } } Index: src/main/kotlin/platform/mixin/inspection/suppress/DefaultAnnotationParamInspectionSuppressor.kt =================================================================== --- src/main/kotlin/platform/mixin/inspection/suppress/DefaultAnnotationParamInspectionSuppressor.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/inspection/suppress/DefaultAnnotationParamInspectionSuppressor.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -43,14 +43,14 @@ class DefaultAnnotationParamInspectionSuppressor : InspectionSuppressor { override fun isSuppressedFor(element: PsiElement, toolId: String): Boolean { - if (toolId != INSPECTION) { + if (toolId != Const.INSPECTION) { return false } val name = element.parentOfType()?.attributeName ?: return false val annotation = element.parentOfType() ?: return false - if (name in CONSTANT_SUPPRESSED && annotation.hasQualifiedName(CONSTANT)) { + if (name in Const.CONSTANT_SUPPRESSED && annotation.hasQualifiedName(CONSTANT)) { return true } @@ -64,7 +64,7 @@ .filterIsInstance() .drop(1) // don't look at our own owner .mapNotNull { annotationOwner -> - HAS_REMAP.mapFirstNotNull { + Const.HAS_REMAP.mapFirstNotNull { annotationOwner.findAnnotation(it) } } @@ -79,14 +79,14 @@ return false } - private val PsiAnnotation.hasRemap get() = qualifiedName?.let { it in HAS_REMAP } == true + private val PsiAnnotation.hasRemap get() = qualifiedName?.let { it in Const.HAS_REMAP } == true override fun getSuppressActions(element: PsiElement?, toolId: String): Array = SuppressQuickFix.EMPTY_ARRAY - companion object { - private const val INSPECTION = "DefaultAnnotationParam" - private val HAS_REMAP = buildSet { + private object Const { + const val INSPECTION = "DefaultAnnotationParam" + val HAS_REMAP = buildSet { add(MIXIN) add(AT) add(ACCESSOR) @@ -95,7 +95,7 @@ add(SHADOW) addAll(MixinAnnotationHandler.getBuiltinHandlers().map { it.first }) } - private val CONSTANT_SUPPRESSED = setOf( + val CONSTANT_SUPPRESSED = setOf( "intValue", "floatValue", "longValue", Index: src/main/kotlin/platform/mixin/inspection/suppress/MixinClassCastInspectionSuppressor.kt =================================================================== --- src/main/kotlin/platform/mixin/inspection/suppress/MixinClassCastInspectionSuppressor.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/inspection/suppress/MixinClassCastInspectionSuppressor.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -47,7 +47,7 @@ class MixinClassCastInspectionSuppressor : InspectionSuppressor { override fun isSuppressedFor(element: PsiElement, toolId: String): Boolean { - if (toolId !in INSPECTIONS) { + if (toolId !in Const.INSPECTIONS) { return false } @@ -98,7 +98,7 @@ is PsiClassType -> psiType.resolve() else -> null } ?: return typeConstraint - val mixins = FindMixinsAction.findMixins(targetClass, project) ?: return typeConstraint + val mixins = FindMixinsAction.Util.findMixins(targetClass, project) ?: return typeConstraint if (mixins.isEmpty()) return typeConstraint val elementFactory = JavaPsiFacade.getElementFactory(project) val mixinTypes = mixins.map { mixinClass -> @@ -120,7 +120,7 @@ override fun getSuppressActions(element: PsiElement?, toolId: String): Array = SuppressQuickFix.EMPTY_ARRAY - companion object { - private val INSPECTIONS = setOf("ConstantConditions", "ConstantValue", "DataFlowIssue") + private object Const { + val INSPECTIONS = setOf("ConstantConditions", "ConstantValue", "DataFlowIssue") } } Index: src/main/kotlin/platform/mixin/inspection/suppress/ShadowOverwriteInspectionSuppressor.kt =================================================================== --- src/main/kotlin/platform/mixin/inspection/suppress/ShadowOverwriteInspectionSuppressor.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/inspection/suppress/ShadowOverwriteInspectionSuppressor.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -32,7 +32,7 @@ class ShadowOverwriteInspectionSuppressor : InspectionSuppressor { override fun isSuppressedFor(element: PsiElement, toolId: String): Boolean { - if (toolId !in SUPPRESSED_INSPECTIONS) { + if (toolId !in Const.SUPPRESSED_INSPECTIONS) { return false } @@ -43,8 +43,8 @@ override fun getSuppressActions(element: PsiElement?, toolId: String): Array = SuppressQuickFix.EMPTY_ARRAY - companion object { - private val SUPPRESSED_INSPECTIONS = setOf( + private object Const { + val SUPPRESSED_INSPECTIONS = setOf( "UnusedReturnValue", "SameParameterValue", "Guava", Index: src/main/kotlin/platform/mixin/inspection/suppress/StaticInvokerUnusedParamInspectionSuppressor.kt =================================================================== --- src/main/kotlin/platform/mixin/inspection/suppress/StaticInvokerUnusedParamInspectionSuppressor.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/inspection/suppress/StaticInvokerUnusedParamInspectionSuppressor.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -58,13 +58,9 @@ } val clazz = method.findContainingClass() ?: return false - if (!clazz.isMixin) { - return false + return clazz.isMixin - } + } - return true - } - override fun getSuppressActions(element: PsiElement?, toolId: String): Array = SuppressQuickFix.EMPTY_ARRAY } Index: src/main/kotlin/platform/mixin/reference/AbstractMethodReference.kt =================================================================== --- src/main/kotlin/platform/mixin/reference/AbstractMethodReference.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/reference/AbstractMethodReference.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -129,10 +129,6 @@ } } - fun resolveIfUnique(context: PsiElement): ClassAndMethodNode? { - return resolve(context)?.singleOrNull() - } - fun resolveAllIfNotAmbiguous(context: PsiElement): List? { val targets = getTargets(context) ?: return null Index: src/main/kotlin/platform/mixin/reference/DescReference.kt =================================================================== --- src/main/kotlin/platform/mixin/reference/DescReference.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/reference/DescReference.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -58,7 +58,7 @@ override fun parseSelector(context: PsiElement): DescSelector? { val annotation = context.parentOfType() ?: return null // @Desc - return DescSelectorParser.descSelectorFromAnnotation(annotation) + return DescSelectorParser.Util.descSelectorFromAnnotation(annotation) } override fun getTargets(context: PsiElement): Collection? { Index: src/main/kotlin/platform/mixin/reference/MixinReferenceContributor.kt =================================================================== --- src/main/kotlin/platform/mixin/reference/MixinReferenceContributor.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/reference/MixinReferenceContributor.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -23,10 +23,6 @@ import com.demonwav.mcdev.platform.mixin.reference.target.FieldDefinitionReference import com.demonwav.mcdev.platform.mixin.reference.target.MethodDefinitionReference import com.demonwav.mcdev.platform.mixin.reference.target.TargetReference -import com.demonwav.mcdev.platform.mixin.util.MixinConstants.Annotations.AT -import com.demonwav.mcdev.util.insideAnnotationAttribute -import com.intellij.patterns.PsiJavaPatterns -import com.intellij.patterns.StandardPatterns import com.intellij.psi.PsiReferenceContributor import com.intellij.psi.PsiReferenceRegistrar Index: src/main/kotlin/platform/mixin/reference/MixinSelectors.kt =================================================================== --- src/main/kotlin/platform/mixin/reference/MixinSelectors.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/reference/MixinSelectors.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -244,10 +244,10 @@ return null } var foundAny = false - var ownerPattern = MATCH_EVERYTHING - var namePattern = MATCH_EVERYTHING - var descPattern = MATCH_EVERYTHING - for (match in PATTERN.findAll(value)) { + var ownerPattern = Const.MATCH_EVERYTHING + var namePattern = Const.MATCH_EVERYTHING + var descPattern = Const.MATCH_EVERYTHING + for (match in Const.PATTERN.findAll(value)) { foundAny = true val pattern = match.groups[3]!!.value when (match.groups[2]?.value) { @@ -275,8 +275,8 @@ private fun String.safeToRegex(): Regex { return try { toRegex() - } catch (e: PatternSyntaxException) { - MATCH_EVERYTHING + } catch (_: PatternSyntaxException) { + Const.MATCH_EVERYTHING } } @@ -286,19 +286,19 @@ return null } var entirePattern = pattern.substring(1, pattern.length - 1) - if (SPECIAL_CHARS.containsMatchIn(entirePattern)) { + if (Const.SPECIAL_CHARS.containsMatchIn(entirePattern)) { return null } - entirePattern = entirePattern.replace(UNESCAPED_BACKSLASH, "") + entirePattern = entirePattern.replace(Const.UNESCAPED_BACKSLASH, "") entirePattern = entirePattern.replace("\\\\", "\\") return entirePattern } - companion object { - private val MATCH_EVERYTHING = ".*".toRegex() - private val PATTERN = "((owner|name|desc)\\s*=\\s*)?/(.*?)(? = PsiJavaPatterns.psiLiteral(StandardPatterns.string()) .insideAnnotationAttribute(MixinConstants.MixinExtras.DEFINITION, "field") override fun getFullReferenceIfMatches(memberReference: MemberReference, node: FlowValue): MemberReference? { @@ -149,7 +151,7 @@ } object MethodDefinitionReference : AbstractDefinitionReference() { - val ELEMENT_PATTERN = PsiJavaPatterns.psiLiteral(StandardPatterns.string()) + val ELEMENT_PATTERN: PsiJavaElementPattern.Capture = PsiJavaPatterns.psiLiteral(StandardPatterns.string()) .insideAnnotationAttribute(MixinConstants.MixinExtras.DEFINITION, "method") override fun getFullReferenceIfMatches(memberReference: MemberReference, node: FlowValue): MemberReference? { Index: src/main/kotlin/platform/mixin/util/AsmDfaUtil.kt =================================================================== --- src/main/kotlin/platform/mixin/util/AsmDfaUtil.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/util/AsmDfaUtil.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -122,7 +122,7 @@ private val currentSuperClass: Type?, currentClassInterfaces: List, private val isInterface: Boolean, - ) : SimpleVerifier(Opcodes.ASM7, currentClass, currentSuperClass, currentClassInterfaces, isInterface) { + ) : SimpleVerifier(ASM7, currentClass, currentSuperClass, currentClassInterfaces, isInterface) { override fun getClass(type: Type?): Class<*> { // should never be called given we have overridden the other methods throw UnsupportedOperationException() Index: src/main/kotlin/platform/mixin/util/AsmUtil.kt =================================================================== --- src/main/kotlin/platform/mixin/util/AsmUtil.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/util/AsmUtil.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -65,7 +65,6 @@ import com.intellij.psi.PsiField import com.intellij.psi.PsiFileFactory import com.intellij.psi.PsiJavaFile -import com.intellij.psi.PsiKeyword import com.intellij.psi.PsiLambdaExpression import com.intellij.psi.PsiManager import com.intellij.psi.PsiMethod Index: src/main/kotlin/platform/mixin/util/LocalVariables.kt =================================================================== --- src/main/kotlin/platform/mixin/util/LocalVariables.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/util/LocalVariables.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -949,12 +949,9 @@ const val TRIM = 'X' fun of(ancestor: LocalVariable?, type: Char): ZombieLocalVariable? { - return if (ancestor is ZombieLocalVariable) { - ancestor - } else { - ancestor?.let { ZombieLocalVariable(it, type) } + return ancestor as? ZombieLocalVariable + ?: ancestor?.let { ZombieLocalVariable(it, type) } - } - } - } - } + } + } + } +} -} Index: src/main/kotlin/platform/mixin/util/Mixin.kt =================================================================== --- src/main/kotlin/platform/mixin/util/Mixin.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/util/Mixin.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -265,12 +265,12 @@ } } - val mixins = FindMixinsAction.findMixins(rightClass, rightClass.project) ?: return false + val mixins = FindMixinsAction.Util.findMixins(rightClass, rightClass.project) ?: return false if (mixins.any { isClassAssignable(leftClass, it) }) { return true } - return isClassAssignable(leftClass, rightClass) + isClassAssignable(leftClass, rightClass) } } } Index: src/main/kotlin/platform/mixin/util/MixinConstants.kt =================================================================== --- src/main/kotlin/platform/mixin/util/MixinConstants.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/mixin/util/MixinConstants.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -20,7 +20,7 @@ package com.demonwav.mcdev.platform.mixin.util -@Suppress("MemberVisibilityCanBePrivate") +@Suppress("unused") object MixinConstants { const val PACKAGE = "org.spongepowered.asm.mixin." const val SMAP_STRATUM = "Mixin" Index: src/main/kotlin/platform/neoforge/NeoForgeModule.kt =================================================================== --- src/main/kotlin/platform/neoforge/NeoForgeModule.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/neoforge/NeoForgeModule.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -105,7 +105,7 @@ val psiClass = runCatchingKtIdeaExceptions { identifier.uastParent as? UClass } ?: return false - return !psiClass.hasModifier(JvmModifier.ABSTRACT) && + return !psiClass.javaPsi.hasModifier(JvmModifier.ABSTRACT) && psiClass.findAnnotation(NeoForgeConstants.MOD_ANNOTATION) != null } Index: src/main/kotlin/platform/neoforge/gradle/NeoForgeRunConfigDataService.kt =================================================================== --- src/main/kotlin/platform/neoforge/gradle/NeoForgeRunConfigDataService.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/neoforge/gradle/NeoForgeRunConfigDataService.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -72,7 +72,7 @@ return } - val (moduleName, mcVersion, forgeVersion, task) = lines + val (moduleName, _, _, task) = lines val moduleMap = modelsProvider.modules.associateBy { it.name } val module = moduleMap[moduleName] ?: return @@ -92,7 +92,7 @@ val mainModule = findMainModule(moduleMap, module) ProgressManager.getInstance().run( - object : Task.Backgroundable(project, "genIntellijRuns", false) { + object : Task.Backgroundable(project, @Suppress("DialogTitleCapitalization") "genIntellijRuns", false) { override fun run(indicator: ProgressIndicator) { indicator.isIndeterminate = true @@ -131,7 +131,6 @@ private val disposable = Disposer.newDisposable() init { - Disposer.register(module, disposable) module.project.messageBus.connect(disposable).subscribe(RunManagerListener.TOPIC, this) // If we don't have a data run, don't wait for it if (!hasData) { Index: src/main/kotlin/platform/sponge/SpongeVersion.kt =================================================================== --- src/main/kotlin/platform/sponge/SpongeVersion.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/sponge/SpongeVersion.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -24,7 +24,7 @@ data class SpongeVersion(var versions: LinkedHashMap, var selectedIndex: Int) { companion object { - suspend fun downloadData(): SpongeVersion? { + suspend fun downloadData(): SpongeVersion { return getVersionJson("sponge_v2.json") } } Index: src/main/kotlin/platform/sponge/color/SpongeColorAnnotator.kt =================================================================== --- src/main/kotlin/platform/sponge/color/SpongeColorAnnotator.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/sponge/color/SpongeColorAnnotator.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -35,6 +35,6 @@ val pair = element.findSpongeColor() ?: return - ColorAnnotator.setColorAnnotator(pair.first, element, holder) + ColorAnnotator.Util.setColorAnnotator(pair.first, element, holder) } } Index: src/main/kotlin/platform/sponge/creator/maven-steps.kt =================================================================== --- src/main/kotlin/platform/sponge/creator/maven-steps.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/sponge/creator/maven-steps.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -94,7 +94,7 @@ assets.addTemplateProperties( "PLUGIN_ID" to pluginId, - "VERSION_PLACEHOLDER" to "\${version}", + "VERSION_PLACEHOLDER" to $$"${version}", "SPONGEAPI_VERSION" to spongeApiVersion, "LICENSE" to license.id, "PLUGIN_NAME" to pluginName, Index: src/main/kotlin/platform/sponge/inspection/SpongeInjectionInspection.kt =================================================================== --- src/main/kotlin/platform/sponge/inspection/SpongeInjectionInspection.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/sponge/inspection/SpongeInjectionInspection.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -66,10 +66,10 @@ class SpongeInjectionInspection : AbstractBaseJavaLocalInspectionTool() { - private val injectableTypesList = defaultInjectableTypes.toMutableList() + private val injectableTypesList = Const.defaultInjectableTypes.toMutableList() @JvmField - var injectableTypes: String = serializedDefaultInjectableTypes + var injectableTypes: String = Const.serializedDefaultInjectableTypes override fun getStaticDescription() = "Invalid @Inject usage in Sponge plugin class." @@ -317,7 +317,7 @@ } } - companion object { + object Const { val defaultInjectableTypes = listOf( // https://github.com/SpongePowered/SpongeCommon/blob/f92cef4/src/main/java/org/spongepowered/common/inject/SpongeImplementationModule.java @@ -472,7 +472,7 @@ val chooserList = UiUtils.createTreeClassChooserList( injectableTypesList, "Injectable types", - "Choose injectable type", + "Choose Injectable Type", ) UiUtils.setComponentSize(chooserList, 7, 25) return chooserList @@ -485,7 +485,7 @@ override fun writeSettings(node: Element) { injectableTypes = if (injectableTypesList.isEmpty()) { - serializedDefaultInjectableTypes + Const.serializedDefaultInjectableTypes } else { formatString(injectableTypesList) } Index: src/main/kotlin/platform/sponge/util/Events.kt =================================================================== --- src/main/kotlin/platform/sponge/util/Events.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/sponge/util/Events.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -71,9 +71,10 @@ } val eventClass = this.uastParameters[0].typeReference?.resolve() ?: return false - val baseEventClass = JavaPsiFacade.getInstance(this.project) - .findClass(SpongeConstants.EVENT, ProjectScope.getAllScope(this.project)) ?: return false - return eventClass.isInheritor(baseEventClass, true) + val project = this.sourcePsi?.project ?: return false + val baseEventClass = JavaPsiFacade.getInstance(project) + .findClass(SpongeConstants.EVENT, ProjectScope.getAllScope(project)) ?: return false + return eventClass.javaPsi.isInheritor(baseEventClass, true) } fun UMethod.resolveSpongeEventClass(): UClass? { @@ -83,7 +84,7 @@ fun UAnnotation.resolveSpongeGetterTarget(): UMethod? { val method = this.getContainingUMethod() ?: return null - val eventClass = method.resolveSpongeEventClass() ?: return null + val eventClass = method.resolveSpongeEventClass()?.javaPsi ?: return null val getterMethodName = this.findAttributeValue("value")?.evaluateString() ?: return null return eventClass.findMethodsByName(getterMethodName, true) .firstOrNull { !it.isConstructor && !it.hasParameters() } Index: src/main/kotlin/platform/velocity/VelocityModule.kt =================================================================== --- src/main/kotlin/platform/velocity/VelocityModule.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/platform/velocity/VelocityModule.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -51,7 +51,7 @@ val psiClass = runCatchingKtIdeaExceptions { identifier.uastParent as? UClass } ?: return false - return !psiClass.hasModifier(JvmModifier.ABSTRACT) && + return !psiClass.javaPsi.hasModifier(JvmModifier.ABSTRACT) && psiClass.findAnnotation(VelocityConstants.PLUGIN_ANNOTATION) != null } } Index: src/main/kotlin/toml/platform/forge/ModsTomlDocumentationProvider.kt =================================================================== --- src/main/kotlin/toml/platform/forge/ModsTomlDocumentationProvider.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/toml/platform/forge/ModsTomlDocumentationProvider.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -119,12 +119,12 @@ private val dummyHolder = DummyHolderFactory.createHolder(psiManager, null) - override fun getParent(): PsiElement? = dummyHolder + override fun getParent(): PsiElement = dummyHolder - override fun getManager(): PsiManager? = psiManager + override fun getManager(): PsiManager = psiManager - override fun getPresentation(): ItemPresentation? = object : ItemPresentation { - override fun getPresentableText(): @NlsSafe String? = key + override fun getPresentation(): ItemPresentation = object : ItemPresentation { + override fun getPresentableText(): @NlsSafe String = key override fun getIcon(unused: Boolean): Icon? = null } Index: src/main/kotlin/toml/platform/forge/inspections/ModsTomlValidationInspection.kt =================================================================== --- src/main/kotlin/toml/platform/forge/inspections/ModsTomlValidationInspection.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/toml/platform/forge/inspections/ModsTomlValidationInspection.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -74,7 +74,7 @@ "modId" -> { val value = keyValue.value ?: return val modId = value.stringValue() ?: return - if (modId != "\"" && !(modId.startsWith("\${") && modId.endsWith("}")) && + if (modId != "\"" && !(modId.startsWith($$"${") && modId.endsWith("}")) && !ForgeConstants.MOD_ID_REGEX.matches(modId) ) { val endOffset = if (value.text.endsWith('"')) modId.length + 1 else modId.length Index: src/main/kotlin/toml/platform/forge/reference/ModsTomlReferenceContributor.kt =================================================================== --- src/main/kotlin/toml/platform/forge/reference/ModsTomlReferenceContributor.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/toml/platform/forge/reference/ModsTomlReferenceContributor.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -118,7 +118,7 @@ override fun getReferencesByElement(element: PsiElement, context: ProcessingContext): Array { val value = element as? TomlValue ?: return PsiReference.EMPTY_ARRAY val stringValue = value.stringValue() - if (stringValue != null && stringValue.startsWith("\${") && stringValue.endsWith("}")) { + if (stringValue != null && stringValue.startsWith($$"${") && stringValue.endsWith("}")) { return PsiReference.EMPTY_ARRAY } Index: src/main/kotlin/translations/TranslationEditorNotificationProvider.kt =================================================================== --- src/main/kotlin/translations/TranslationEditorNotificationProvider.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/translations/TranslationEditorNotificationProvider.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -116,8 +116,8 @@ private fun getMissingTranslations(project: Project, file: VirtualFile): Sequence { val domain = file.mcDomain - val defaultTranslations = TranslationIndex.getProjectDefaultTranslations(project, domain) - val translations = TranslationIndex.getTranslations(project, file) + val defaultTranslations = TranslationIndex.Util.getProjectDefaultTranslations(project, domain) + val translations = TranslationIndex.Util.getTranslations(project, file) val keys = translations.map { it.key }.toSet() Index: src/main/kotlin/translations/TranslationFiles.kt =================================================================== --- src/main/kotlin/translations/TranslationFiles.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/translations/TranslationFiles.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -58,6 +58,7 @@ import com.intellij.util.DocumentUtil import com.intellij.util.indexing.FileBasedIndex import java.util.Locale +import kotlin.collections.map object TranslationFiles { private val MC_1_12_2 = SemanticVersion.release(1, 12, 2) @@ -84,12 +85,13 @@ fun toTranslation(element: PsiElement): Translation? = if (element.containingFile?.virtualFile?.let { isTranslationFile(it) } == true) { - when { - element is JsonProperty && element.value is JsonStringLiteral -> Translation( + when (element) { + is JsonProperty if element.value is JsonStringLiteral -> Translation( element.name, (element.value as JsonStringLiteral).value, ) - element is LangEntry -> Translation(element.key, element.value) + + is LangEntry -> Translation(element.key, element.value) else -> null } } else { @@ -290,7 +292,7 @@ fun buildFileEntries(project: Project, locale: String, entries: Iterable, keepComments: Int) = sequence { for (entry in entries) { - val langElement = TranslationInverseIndex.findElements( + val langElement = TranslationInverseIndex.Util.findElements( entry.key, GlobalSearchScope.allScope(project), locale, @@ -337,7 +339,7 @@ val defaultTranslationFile = FileBasedIndex.getInstance() .getContainingFiles( - TranslationIndex.NAME, + TranslationIndex.Util.NAME, TranslationConstants.DEFAULT_LOCALE, GlobalSearchScope.moduleScope(module), ) Index: src/main/kotlin/translations/actions/SortTranslationsAction.kt =================================================================== --- src/main/kotlin/translations/actions/SortTranslationsAction.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/translations/actions/SortTranslationsAction.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -40,7 +40,7 @@ TranslationSorter.query( file.project, file, - TranslationIndex.hasDefaultTranslations(file.project, file.virtualFile.mcDomain) + TranslationIndex.Util.hasDefaultTranslations(file.project, file.virtualFile.mcDomain) ) } catch (e: Exception) { Notification( Index: src/main/kotlin/translations/actions/TranslationSortOrderDialog.kt =================================================================== --- src/main/kotlin/translations/actions/TranslationSortOrderDialog.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/translations/actions/TranslationSortOrderDialog.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -32,6 +32,7 @@ import java.awt.event.KeyEvent import java.awt.event.WindowAdapter import java.awt.event.WindowEvent +import java.io.Serial import javax.swing.DefaultListCellRenderer import javax.swing.JComponent import javax.swing.JDialog @@ -74,7 +75,7 @@ title = MCDevBundle("translation_sort.title") // call onCancel() when cross is clicked - defaultCloseOperation = WindowConstants.DO_NOTHING_ON_CLOSE + defaultCloseOperation = DO_NOTHING_ON_CLOSE addWindowListener( object : WindowAdapter() { override fun windowClosing(e: WindowEvent?) { @@ -111,6 +112,9 @@ val displayValue = (value as? Ordering)?.text return super.getListCellRendererComponent(list, displayValue, index, isSelected, cellHasFocus) } + + @Serial + private fun readResolve(): Any = CellRenderer } companion object { Index: src/main/kotlin/translations/identification/TranslationIdentifier.kt =================================================================== --- src/main/kotlin/translations/identification/TranslationIdentifier.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/translations/identification/TranslationIdentifier.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -101,7 +101,7 @@ val shouldFold = element is ULiteralExpression && element.isString && key !in deprecations.removed && key !in deprecations.renamed - val entries = TranslationIndex.getAllDefaultEntries(project).merge("") + val entries = TranslationIndex.Util.getAllDefaultEntries(project).merge("") val translation = entries[deprecations.inverseRenamed[key] ?: key]?.text ?: return TranslationInstance( // translation doesn't exist null, @@ -223,7 +223,7 @@ fun UExpression.paramDisplayString(): String { val visited = mutableSetOf() - fun eval(expr: UExpression, defaultValue: String = "\${${expr.asSourceString()}}"): String { + fun eval(expr: UExpression, defaultValue: String = $$"${$${expr.asSourceString()}}"): String { if (!visited.add(expr)) { return defaultValue } @@ -232,7 +232,7 @@ is UQualifiedReferenceExpression -> { val selector = expr.selector if (selector is UCallExpression) { - return eval(selector, "\${${expr.asSourceString()}}") + return eval(selector, $$"${$${expr.asSourceString()}}") } } Index: src/main/kotlin/translations/index/TranslationIndex.kt =================================================================== --- src/main/kotlin/translations/index/TranslationIndex.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/translations/index/TranslationIndex.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -40,7 +40,7 @@ import java.io.DataOutput class TranslationIndex : FileBasedIndexExtension() { - override fun getName() = NAME + override fun getName() = Util.NAME override fun getVersion() = 6 @@ -54,7 +54,7 @@ override fun getKeyDescriptor(): KeyDescriptor = EnumeratorStringDescriptor.INSTANCE - companion object { + object Util { val NAME = ID.create("TranslationIndex") fun getAllDefaultTranslations(project: Project, domain: String? = null) = @@ -98,7 +98,7 @@ getEntries(GlobalSearchScope.projectScope(project), TranslationConstants.DEFAULT_LOCALE, domain) fun getEntries(scope: GlobalSearchScope, locale: String, domain: String? = null) = - FileBasedIndex.getInstance().getValues(NAME, locale, scope,).asSequence() + FileBasedIndex.getInstance().getValues(NAME, locale, scope).asSequence() .filter { domain == null || it.sourceDomain == domain } private fun Sequence.flatten() = this.flatMap { it.translations.asSequence() } Index: src/main/kotlin/translations/index/TranslationInverseIndex.kt =================================================================== --- src/main/kotlin/translations/index/TranslationInverseIndex.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/translations/index/TranslationInverseIndex.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -36,7 +36,7 @@ import com.intellij.util.io.VoidDataExternalizer class TranslationInverseIndex : FileBasedIndexExtension() { - override fun getName() = NAME + override fun getName() = Util.NAME override fun getVersion() = 1 @@ -50,7 +50,7 @@ override fun getKeyDescriptor(): KeyDescriptor = EnumeratorStringDescriptor.INSTANCE - companion object { + object Util { val NAME = ID.create("TranslationInverseIndex") fun findElements(key: String, filter: GlobalSearchScope, locale: String? = null): List { Index: src/main/kotlin/translations/index/providers.kt =================================================================== --- src/main/kotlin/translations/index/providers.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/translations/index/providers.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -79,7 +79,7 @@ val psiFile = PsiManager.getInstance(project).findFile(file) as? JsonFile ?: return emptyList() return CachedValuesManager.getCachedValue( psiFile, - Key>>("translation_lookup.$key"), + Key("translation_lookup.$key"), ) { val value = psiFile.topLevelValue as? JsonObject CachedValueProvider.Result.create( Index: src/main/kotlin/translations/intentions/ConvertToTranslationIntention.kt =================================================================== --- src/main/kotlin/translations/intentions/ConvertToTranslationIntention.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/translations/intentions/ConvertToTranslationIntention.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -95,7 +95,7 @@ val documentManager = PsiDocumentManager.getInstance(project) val psi = documentManager.getPsiFile(editor.document) ?: return val callCode = if (translationSettings.isUseCustomConvertToTranslationTemplate) { - translationSettings.convertToTranslationTemplate.replace("\$key", key) + translationSettings.convertToTranslationTemplate.replace($$"$key", key) } else { element.findModule()?.getMappedMethodCall( "net.minecraft.client.resource.language.I18n", Index: src/main/kotlin/translations/intentions/RemoveDuplicatesIntention.kt =================================================================== --- src/main/kotlin/translations/intentions/RemoveDuplicatesIntention.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/translations/intentions/RemoveDuplicatesIntention.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -46,7 +46,7 @@ endElement: PsiElement ) { val keep = TranslationFiles.seekTranslation(startElement) ?: return - val entries = TranslationInverseIndex.findElements( + val entries = TranslationInverseIndex.Util.findElements( translation.key, GlobalSearchScope.fileScope(file), ) Index: src/main/kotlin/translations/intentions/TranslationFileAnnotator.kt =================================================================== --- src/main/kotlin/translations/intentions/TranslationFileAnnotator.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/translations/intentions/TranslationFileAnnotator.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -55,7 +55,7 @@ } private fun checkEntryDuplicates(element: PsiElement, translation: Translation, annotations: AnnotationHolder) { - val count = TranslationIndex.getTranslations(element.containingFile).count { it.key == translation.key } + val count = TranslationIndex.Util.getTranslations(element.containingFile).count { it.key == translation.key } if (count > 1) { annotations.newAnnotation(HighlightSeverity.WARNING, "Duplicate translation keys \"${translation.key}\".") .newFix(RemoveDuplicatesIntention(translation, element)).universal().registerFix() @@ -65,7 +65,7 @@ private fun checkEntryMatchesDefault(element: PsiElement, translation: Translation, annotations: AnnotationHolder) { val domain = element.containingFile?.virtualFile?.mcDomain - val defaultEntries = TranslationIndex.getAllDefaultEntries(element.project, domain) + val defaultEntries = TranslationIndex.Util.getAllDefaultEntries(element.project, domain) if (defaultEntries.any { it.contains(translation.key) }) { return } Index: src/main/kotlin/translations/lang/LangParserDefinition.kt =================================================================== --- src/main/kotlin/translations/lang/LangParserDefinition.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/translations/lang/LangParserDefinition.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -39,13 +39,13 @@ override fun spaceExistenceTypeBetweenTokens(left: ASTNode, right: ASTNode) = LanguageUtil.canStickTokensTogetherByLexer(left, right, LangLexerAdapter()) - override fun getStringLiteralElements() = STRING_LITERALS - override fun getWhitespaceTokens() = WHITE_SPACES - override fun getFileNodeType() = FILE + override fun getStringLiteralElements() = TokenSets.STRING_LITERALS + override fun getWhitespaceTokens() = TokenSets.WHITE_SPACES + override fun getFileNodeType() = TokenSets.FILE override fun createElement(node: ASTNode) = LangTypes.Factory.createElement(node)!! override fun getCommentTokens() = TokenSet.EMPTY!! - companion object { + object TokenSets { val WHITE_SPACES = TokenSet.create(TokenType.WHITE_SPACE) val STRING_LITERALS = TokenSet.create(LangTypes.KEY, LangTypes.VALUE) Index: src/main/kotlin/translations/lang/MCLangLanguage.kt =================================================================== --- src/main/kotlin/translations/lang/MCLangLanguage.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/translations/lang/MCLangLanguage.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -21,5 +21,9 @@ package com.demonwav.mcdev.translations.lang import com.intellij.lang.Language +import java.io.Serial -object MCLangLanguage : Language("MCLang") +object MCLangLanguage : Language("MCLang") { + @Serial + private fun readResolve(): Any = MCLangLanguage +} Index: src/main/kotlin/translations/lang/colors/LangColorSettingsPage.kt =================================================================== --- src/main/kotlin/translations/lang/colors/LangColorSettingsPage.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/translations/lang/colors/LangColorSettingsPage.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -31,17 +31,17 @@ override fun getIcon() = PlatformAssets.MINECRAFT_ICON override fun getHighlighter() = LangSyntaxHighlighter(LangLexerAdapter()) override fun getAdditionalHighlightingTagToDescriptorMap() = emptyMap() - override fun getAttributeDescriptors() = DESCRIPTORS + override fun getAttributeDescriptors() = Const.DESCRIPTORS override fun getColorDescriptors(): Array = ColorDescriptor.EMPTY_ARRAY - override fun getDisplayName() = "Minecraft localization" + override fun getDisplayName() = "Minecraft Localization" override fun getDemoText() = """ # This is a comment path.to.key=This is a value """.trimIndent() - companion object { - private val DESCRIPTORS = arrayOf( + private object Const { + val DESCRIPTORS = arrayOf( AttributesDescriptor("Key", LangSyntaxHighlighter.KEY), AttributesDescriptor("Separator", LangSyntaxHighlighter.EQUALS), AttributesDescriptor("Value", LangSyntaxHighlighter.VALUE), Index: src/main/kotlin/translations/lang/psi/mixins/LangEntryMixin.kt =================================================================== --- src/main/kotlin/translations/lang/psi/mixins/LangEntryMixin.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/translations/lang/psi/mixins/LangEntryMixin.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -25,8 +25,5 @@ interface LangEntryMixin : PsiNameIdentifierOwner { val key: String - val trimmedKey: String - get() = key.trim() - val value: String } Index: src/main/kotlin/translations/reference/TranslationGotoSymbolContributor.kt =================================================================== --- src/main/kotlin/translations/reference/TranslationGotoSymbolContributor.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/translations/reference/TranslationGotoSymbolContributor.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -39,10 +39,10 @@ } else { GlobalSearchScope.projectScope(project) } - val keys = FileBasedIndex.getInstance().getAllKeys(TranslationIndex.NAME, project) + val keys = FileBasedIndex.getInstance().getAllKeys(TranslationIndex.Util.NAME, project) val translations = keys .asSequence() - .flatMap { TranslationIndex.getEntries(scope, it).merge("").translations.asSequence() } + .flatMap { TranslationIndex.Util.getEntries(scope, it).merge("").translations.asSequence() } return translations.map { it.key }.distinct().filter { it.isNotEmpty() }.toTypedArray() } @@ -59,7 +59,7 @@ GlobalSearchScope.projectScope(project) } val deprecations = DeprecatedTranslations.getInstance(project) - val elements = TranslationInverseIndex.findElements(deprecations.inverseRenamed[name] ?: name, scope) + val elements = TranslationInverseIndex.Util.findElements(deprecations.inverseRenamed[name] ?: name, scope) return elements.mapToArray { it as NavigationItem } } Index: src/main/kotlin/translations/reference/TranslationReference.kt =================================================================== --- src/main/kotlin/translations/reference/TranslationReference.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/translations/reference/TranslationReference.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -28,7 +28,6 @@ import com.demonwav.mcdev.translations.index.TranslationIndex import com.demonwav.mcdev.translations.index.TranslationInverseIndex import com.demonwav.mcdev.translations.lang.gen.psi.LangEntry -import com.demonwav.mcdev.util.filterNotNull import com.demonwav.mcdev.util.mapToArray import com.demonwav.mcdev.util.toTypedArray import com.intellij.codeInsight.lookup.LookupElementBuilder @@ -55,7 +54,7 @@ override fun multiResolve(incompleteCode: Boolean): Array { val project = myElement.project val deprecations = DeprecatedTranslations.getInstance(project) - val entries = TranslationInverseIndex.findElements( + val entries = TranslationInverseIndex.Util.findElements( deprecations.inverseRenamed[key.full] ?: key.full, GlobalSearchScope.allScope(project), TranslationConstants.DEFAULT_LOCALE, @@ -65,7 +64,7 @@ override fun getVariants(): Array { val project = myElement.project - val defaultTranslations = TranslationIndex.getAllDefaultTranslations(project) + val defaultTranslations = TranslationIndex.Util.getAllDefaultTranslations(project) val deprecations = DeprecatedTranslations.getInstance(project) val pattern = Regex("${Regex.escape(key.prefix)}(.*?)${Regex.escape(key.suffix)}") return defaultTranslations Index: src/main/kotlin/translations/reference/completion.kt =================================================================== --- src/main/kotlin/translations/reference/completion.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/translations/reference/completion.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -45,8 +45,8 @@ sealed class TranslationCompletionContributor : CompletionContributor() { protected fun handleKey(text: String, element: PsiElement, domain: String?, result: CompletionResultSet) { - val defaultEntries = TranslationIndex.getAllDefaultTranslations(element.project, domain) - val availableKeys = TranslationIndex.getTranslations(element.containingFile.originalFile).map { it.key }.toSet() + val defaultEntries = TranslationIndex.Util.getAllDefaultTranslations(element.project, domain) + val availableKeys = TranslationIndex.Util.getTranslations(element.containingFile.originalFile).map { it.key }.toSet() val prefixResult = result.withPrefixMatcher(text) for (entry in defaultEntries) { @@ -123,14 +123,14 @@ return } - if (KEY_PATTERN.accepts(position) || DUMMY_PATTERN.accepts(position)) { + if (Const.KEY_PATTERN.accepts(position) || Const.DUMMY_PATTERN.accepts(position)) { val text = position.text.let { it.substring(0, it.length - CompletionUtil.DUMMY_IDENTIFIER.length) } val domain = file.mcDomain handleKey(text, position, domain, result) } } - companion object { + private object Const { val KEY_PATTERN = PlatformPatterns.psiElement() .withElementType(PlatformPatterns.elementType().oneOf(LangTypes.KEY)) val DUMMY_PATTERN = PlatformPatterns.psiElement() Index: src/main/kotlin/translations/sorting/TranslationSorter.kt =================================================================== --- src/main/kotlin/translations/sorting/TranslationSorter.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/translations/sorting/TranslationSorter.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -63,7 +63,7 @@ private fun sort(project: Project, file: PsiFile, ordering: Ordering, keepComments: Int) { val domain = file.virtualFile.mcDomain val locale = TranslationFiles.getLocale(file.virtualFile) ?: return - val translations = TranslationIndex.getTranslations(file) + val translations = TranslationIndex.Util.getTranslations(file) val sorted = translations.let { when (ordering) { Ordering.ASCENDING -> TranslationFiles.buildFileEntries( @@ -86,8 +86,8 @@ keepComments, ) else -> { - val template = TranslationFiles.buildSortingTemplateFromDefault(file, domain).getOrElse { - return showBalloon(project, null, null, it.message) + val template = TranslationFiles.buildSortingTemplateFromDefault(file, domain).getOrElse { e -> + return showBalloon(project, null, null, e.message) } ?: return showBalloon(project, null, null, "Could not generate template from default translation file") sortByTemplate( project, Index: src/main/kotlin/translations/sorting/TranslationTemplateConfigurable.kt =================================================================== --- src/main/kotlin/translations/sorting/TranslationTemplateConfigurable.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/translations/sorting/TranslationTemplateConfigurable.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -133,7 +133,7 @@ } override fun isModified(): Boolean { - return templateEditor?.document?.text != getActiveTemplateText() != false || panel.isModified() + return templateEditor?.document?.text != getActiveTemplateText() || panel.isModified() } override fun apply() { Index: src/main/kotlin/update/ConfigurePluginUpdatesDialog.kt =================================================================== --- src/main/kotlin/update/ConfigurePluginUpdatesDialog.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/update/ConfigurePluginUpdatesDialog.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -44,7 +44,7 @@ channelBox = comboBox(listOf("Stable")) } row { - button("Check for updates now") { + button("Check for Updates Now") { saveSettings() updateCheckInProgressIcon.component.isVisible = true resetUpdateStatus() @@ -87,11 +87,11 @@ init { title = "Configure Minecraft Development Plugin Updates" - for (channels in Channels.values()) { + for (channels in Channels.entries) { channelBox.component.addItem(channels.title) } - Channels.values().forEachIndexed { i, channel -> + Channels.entries.forEachIndexed { i, channel -> if (channel.hasChannel()) { initialSelectedChannel = i + 1 return@forEachIndexed @@ -109,12 +109,12 @@ private fun saveSelectedChannel(index: Int) { val hosts = UpdateSettings.getInstance().storedPluginHosts - for (channel in Channels.values()) { + for (channel in Channels.entries) { hosts.remove(channel.url) } if (index != 0) { - val channel = Channels.values()[index - 1] + val channel = Channels.entries[index - 1] hosts.add(channel.url) } } Index: src/main/kotlin/util/CommonColors.kt =================================================================== --- src/main/kotlin/util/CommonColors.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/util/CommonColors.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -20,27 +20,28 @@ package com.demonwav.mcdev.util +import com.intellij.ui.JBColor import java.awt.Color @Suppress("MemberVisibilityCanBePrivate") object CommonColors { - val DARK_RED = Color(0xAA0000) - val RED = Color(0xFF5555) - val GOLD = Color(0xFFAA00) - val YELLOW = Color(0xFFFF55) - val DARK_GREEN = Color(0x00AA00) - val GREEN = Color(0x55FF55) - val AQUA = Color(0x55FFFF) - val DARK_AQUA = Color(0x00AAAA) - val DARK_BLUE = Color(0x0000AA) - val BLUE = Color(0x5555FF) - val LIGHT_PURPLE = Color(0xFF55FF) - val DARK_PURPLE = Color(0xAA00AA) - val WHITE = Color(0xFFFFFF) - val GRAY = Color(0xAAAAAA) - val DARK_GRAY = Color(0x555555) - val BLACK = Color(0x000000) + val DARK_RED = JBColor(0xAA0000, 0xAA0000) + val RED = JBColor(0xFF5555, 0xFF5555) + val GOLD = JBColor(0xFFAA00, 0xFFAA00) + val YELLOW = JBColor(0xFFFF55, 0xFFFF55) + val DARK_GREEN = JBColor(0x00AA00, 0x00AA00) + val GREEN = JBColor(0x55FF55, 0x55FF55) + val AQUA = JBColor(0x55FFFF, 0x55FFFF) + val DARK_AQUA = JBColor(0x00AAAA, 0x00AAAA) + val DARK_BLUE = JBColor(0x0000AA, 0x0000AA) + val BLUE = JBColor(0x5555FF, 0x5555FF) + val LIGHT_PURPLE = JBColor(0xFF55FF, 0xFF55FF) + val DARK_PURPLE = JBColor(0xAA00AA, 0xAA00AA) + val WHITE = JBColor(0xFFFFFF, 0xFFFFFF) + val GRAY = JBColor(0xAAAAAA, 0xAAAAAA) + val DARK_GRAY = JBColor(0x555555, 0x555555) + val BLACK = JBColor(0x000000, 0x000000) fun applyStandardColors(map: MutableMap, prefix: String) { map.apply { Index: src/main/kotlin/util/License.kt =================================================================== --- src/main/kotlin/util/License.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/util/License.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -38,7 +38,7 @@ override fun toString() = displayName companion object { - private val byId = values().associateBy { it.id } + private val byId = entries.associateBy { it.id } fun byId(id: String) = byId[id] } } Index: src/main/kotlin/util/MinecraftTemplates.kt =================================================================== --- src/main/kotlin/util/MinecraftTemplates.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/util/MinecraftTemplates.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -25,6 +25,7 @@ import com.intellij.ide.fileTemplates.FileTemplateDescriptor import com.intellij.ide.fileTemplates.FileTemplateGroupDescriptor import com.intellij.ide.fileTemplates.FileTemplateGroupDescriptorFactory +import kotlin.enums.enumEntries class MinecraftTemplates : FileTemplateGroupDescriptorFactory { @@ -169,7 +170,7 @@ FileTemplateGroupDescriptor("Licenses", null).let { licenseGroup -> group.addTemplate(licenseGroup) - enumValues().forEach { license -> + enumEntries().forEach { license -> licenseGroup.addTemplate(FileTemplateDescriptor(license.id)) } } Index: src/main/kotlin/util/annotation-utils.kt =================================================================== --- src/main/kotlin/util/annotation-utils.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/util/annotation-utils.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -79,7 +79,7 @@ return if (this is PsiArrayInitializerMemberValue) { initializers.mapNotNull(func) } else { - return listOfNotNull(func(this)) + listOfNotNull(func(this)) } } Index: src/main/kotlin/util/psi-utils.kt =================================================================== --- src/main/kotlin/util/psi-utils.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/util/psi-utils.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -24,7 +24,6 @@ import com.demonwav.mcdev.platform.mcp.McpModule import com.demonwav.mcdev.platform.mcp.McpModuleType import com.demonwav.mcdev.platform.mixin.handlers.desugar.DesugarUtil -import com.intellij.codeInsight.lookup.LookupElementBuilder import com.intellij.debugger.impl.DebuggerUtilsEx import com.intellij.ide.highlighter.JavaClassFileType import com.intellij.lang.injection.InjectedLanguageManager @@ -91,7 +90,6 @@ import com.intellij.refactoring.changeSignature.ChangeSignatureUtil import com.intellij.util.CachedValueBase import com.intellij.util.IncorrectOperationException -import com.siyeh.ig.psiutils.ImportUtils import java.util.concurrent.ConcurrentHashMap import java.util.concurrent.ConcurrentMap import java.util.concurrent.locks.ReentrantReadWriteLock @@ -263,11 +261,6 @@ return mappedLineNumber + 1 } -/** - * Returns the line number of the start of this `PsiElement`'s text range, with line numbers starting at 1 - */ -fun PsiElement.lineNumber(): Int? = findDocument()?.let(this::lineNumber) - fun PsiElement.lineNumber(document: Document): Int? { val index = this.textRange.startOffset if (index > document.textLength) { @@ -343,19 +336,12 @@ } } -fun LookupElementBuilder.withImportInsertion(toImport: List): LookupElementBuilder = - this.withInsertHandler { insertionContext, _ -> - toImport.forEach { ImportUtils.addImportIfNeeded(it, insertionContext.file) } - } - fun PsiElement.findMcpModule() = this.cached { val file = containingFile?.viewProvider?.virtualFile ?: return@cached null val index = ProjectFileIndex.getInstance(project) val modules = if (index.isInLibrary(file)) { val library = index.getOrderEntriesForFile(file) - .asSequence() - .mapNotNull { it as? LibraryOrderEntry } - .firstOrNull() + .firstNotNullOfOrNull { it as? LibraryOrderEntry } ?.library ?: return@cached null ModuleManager.getInstance(project).modules.asSequence() @@ -364,7 +350,7 @@ sequenceOf(this.findModule()) } - modules.mapNotNull { it?.findMcpModule() }.firstOrNull() + modules.firstNotNullOfOrNull { it?.findMcpModule() } } private fun Module.findMcpModule(): McpModule? { Index: src/main/kotlin/util/utils.kt =================================================================== --- src/main/kotlin/util/utils.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/util/utils.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -29,8 +29,6 @@ import com.intellij.openapi.application.runReadAction import com.intellij.openapi.command.WriteCommandAction import com.intellij.openapi.diagnostic.Logger -import com.intellij.openapi.module.Module -import com.intellij.openapi.module.ModuleManager import com.intellij.openapi.progress.ProcessCanceledException import com.intellij.openapi.project.DumbService import com.intellij.openapi.project.Project @@ -56,7 +54,7 @@ import org.jetbrains.concurrency.Promise import org.jetbrains.concurrency.runAsync -inline fun runWriteTask(crossinline func: () -> T): T { +inline fun runWriteTask(crossinline func: () -> T): T { return invokeAndWait { ApplicationManager.getApplication().runWriteAction(Computable { func() }) } @@ -89,7 +87,7 @@ dumbService.runWhenSmart(runnable) } -fun invokeAndWait(func: () -> T): T { +fun invokeAndWait(func: () -> T): T { val ref = Ref() ApplicationManager.getApplication().invokeAndWait({ ref.set(func()) }, ModalityState.defaultModalityState()) return ref.get() @@ -103,18 +101,14 @@ ApplicationManager.getApplication().invokeLater(func, ModalityState.defaultModalityState(), expired) } -fun invokeLaterAny(func: () -> Unit) { - ApplicationManager.getApplication().invokeLater(func, ModalityState.any()) -} - inline fun runWriteActionAndWait(crossinline action: () -> T): T { return WriteAction.computeAndWait(ThrowableComputable { action() }) } -inline fun PsiFile.runWriteAction(crossinline func: () -> T) = +inline fun PsiFile.runWriteAction(crossinline func: () -> T) = applyWriteAction { func() } -inline fun PsiFile.applyWriteAction(crossinline func: PsiFile.() -> T): T { +inline fun PsiFile.applyWriteAction(crossinline func: PsiFile.() -> T): T { val result = WriteCommandAction.writeCommandAction(this).withGlobalUndo().compute { func() } val documentManager = PsiDocumentManager.getInstance(project) val document = documentManager.getDocument(this) ?: return result @@ -234,41 +228,11 @@ return null } -fun Module.findChildren(): Set { - return runReadAction { - val manager = ModuleManager.getInstance(project) - val result = mutableSetOf() - - for (m in manager.modules) { - if (m === this) { - continue - } - - val path = manager.getModuleGrouper(null).getGroupPath(m) - if (path.isEmpty()) { - continue - } - - val namedModule = manager.findModuleByName(path.last()) ?: continue - - if (namedModule != this) { - continue - } - - result.add(m) - } - - return@runReadAction result - } -} - // Using the ugly TypeToken approach we can use any complex generic signature, including // nested generics inline fun Gson.fromJson(text: String): T = fromJson(text, object : TypeToken() {}.type) fun Gson.fromJson(text: String, type: KClass): T = fromJson(text, type.java) -fun Map.containsAllKeys(vararg keys: K) = keys.all { this.containsKey(it) } - /** * Splits a string into the longest prefix matching a predicate and the corresponding suffix *not* matching. * @@ -392,7 +356,7 @@ } fun Result.getOrLogException(logger: Logger): T? { - return getOrLogException(logger::error) + return getOrLogException(logger::error) } inline fun Result.getOrLogException(log: (Throwable) -> Unit): T? { @@ -418,7 +382,7 @@ inline fun > enumValueOfOrNull(str: String): T? { return try { enumValueOf(str) - } catch (e: IllegalArgumentException) { + } catch (_: IllegalArgumentException) { null } } Index: src/main/kotlin/yaml/PluginYmlInspection.kt =================================================================== --- src/main/kotlin/yaml/PluginYmlInspection.kt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/kotlin/yaml/PluginYmlInspection.kt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -40,7 +40,7 @@ class PluginYmlInspection : LocalInspectionTool() { @Nls - override fun getStaticDescription(): String? = "Reports issues in Bukkit-like plugin.yml files" + override fun getStaticDescription(): String = "Reports issues in Bukkit-like plugin.yml files" override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean): PsiElementVisitor { val module = holder.file.findModule() ?: return PsiElementVisitor.EMPTY_VISITOR Index: src/main/resources/META-INF/plugin.xml =================================================================== --- src/main/resources/META-INF/plugin.xml (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/resources/META-INF/plugin.xml (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ https://mcdev.io/ - Copyright (C) 2025 minecraft-dev + Copyright (C) 2026 minecraft-dev This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published @@ -15,7 +15,7 @@ GNU General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see https://www.gnu.org/licenses/. + along with this program. If not, see . --> @@ -496,7 +496,6 @@ order="first"/> - Index: src/main/resources/inspectionDescriptions/CleanupJoinDeclarationAndAssignment.html =================================================================== --- src/main/resources/inspectionDescriptions/CleanupJoinDeclarationAndAssignment.html (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) +++ src/main/resources/inspectionDescriptions/CleanupJoinDeclarationAndAssignment.html (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -0,0 +1,40 @@ + + + + +

+ Reports local variable declarations that are followed by an assignment and can be combined into a single statement. +

+

+ Joining declarations and assignments helps simplify the code and clarifies the scope of variables. +

+

Example:

+

+String s;
+s = "foo";
+
+

After the fix:

+

+String s = "foo";
+
+ + + Index: src/main/resources/inspectionDescriptions/CleanupUnnecessaryLocalVariable.html =================================================================== --- src/main/resources/inspectionDescriptions/CleanupUnnecessaryLocalVariable.html (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) +++ src/main/resources/inspectionDescriptions/CleanupUnnecessaryLocalVariable.html (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -0,0 +1,40 @@ + + + + +

+ Reports local variable declarations that can be removed and their initializers inlined. +

+

+ Removing unnecessary local variables helps simplify the code and clarifies its intent. +

+

Example:

+

+String s = "foo";
+return s;
+
+

After the fix:

+

+return "foo";
+
+ + + Index: src/main/resources/messages/MinecraftDevelopment.properties =================================================================== --- src/main/resources/messages/MinecraftDevelopment.properties (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/main/resources/messages/MinecraftDevelopment.properties (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -3,7 +3,7 @@ # # https://mcdev.io/ # -# Copyright (C) 2025 minecraft-dev +# Copyright (C) 2026 minecraft-dev # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published @@ -275,7 +275,7 @@ minecraft.settings.chat_color_underline_style=Chat color underline style\: minecraft.settings.display_name=Minecraft Development minecraft.settings.creator=Creator -minecraft.settings.creator.repos=Template Repositories\: +minecraft.settings.creator.repos=Template repositories\: minecraft.settings.creator.repos.column.name=Name minecraft.settings.creator.repos.column.provider=Provider minecraft.settings.creator.repos.column.provider.none=None @@ -286,7 +286,7 @@ minecraft.settings.creator.repo_config.title={0} Template Repo Configuration minecraft.settings.creator.repo.default_name=My Repo minecraft.settings.creator.repo.builtin_name=Built In -minecraft.settings.creator.maven=Maven Repositories\: +minecraft.settings.creator.maven=Maven repositories\: minecraft.settings.creator.maven.comment=If Username is blank, credentials are sourced from either\:\
- ~/.m2/settings.xml servers, see Maven's documentation\
- ~/.gradle/gradle.properties, see Gradle's documentation Index: src/test/resources/com/demonwav/mcdev/platform/mcp/at/parser/fixtures/asterisks_at.txt =================================================================== --- src/test/resources/com/demonwav/mcdev/platform/mcp/at/parser/fixtures/asterisks_at.txt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/test/resources/com/demonwav/mcdev/platform/mcp/at/parser/fixtures/asterisks_at.txt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -1,4 +1,4 @@ -Access Transformers(0,127) +Access transformers(0,127) AtEntryImpl(ENTRY)(0,56) AtKeywordImpl(KEYWORD)(0,6) PsiElement(KEYWORD_ELEMENT)('public')(0,6) Index: src/test/resources/com/demonwav/mcdev/platform/mcp/at/parser/fixtures/comments_at.txt =================================================================== --- src/test/resources/com/demonwav/mcdev/platform/mcp/at/parser/fixtures/comments_at.txt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/test/resources/com/demonwav/mcdev/platform/mcp/at/parser/fixtures/comments_at.txt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -1,4 +1,4 @@ -Access Transformers(0,350) +Access transformers(0,350) PsiComment(COMMENT)('# Comment one')(0,13) PsiElement(CRLF)('\n')(13,14) PsiComment(COMMENT)('# Comment two')(14,27) Index: src/test/resources/com/demonwav/mcdev/platform/mcp/at/parser/fixtures/fields_at.txt =================================================================== --- src/test/resources/com/demonwav/mcdev/platform/mcp/at/parser/fixtures/fields_at.txt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/test/resources/com/demonwav/mcdev/platform/mcp/at/parser/fixtures/fields_at.txt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -1,4 +1,4 @@ -Access Transformers(0,728) +Access transformers(0,728) AtEntryImpl(ENTRY)(0,63) AtKeywordImpl(KEYWORD)(0,6) PsiElement(KEYWORD_ELEMENT)('public')(0,6) Index: src/test/resources/com/demonwav/mcdev/platform/mcp/at/parser/fixtures/funcs_at.txt =================================================================== --- src/test/resources/com/demonwav/mcdev/platform/mcp/at/parser/fixtures/funcs_at.txt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/test/resources/com/demonwav/mcdev/platform/mcp/at/parser/fixtures/funcs_at.txt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -1,4 +1,4 @@ -Access Transformers(0,2318) +Access transformers(0,2318) AtEntryImpl(ENTRY)(0,64) AtKeywordImpl(KEYWORD)(0,6) PsiElement(KEYWORD_ELEMENT)('public')(0,6) Index: src/test/resources/com/demonwav/mcdev/platform/mcp/at/parser/fixtures/keywords_at.txt =================================================================== --- src/test/resources/com/demonwav/mcdev/platform/mcp/at/parser/fixtures/keywords_at.txt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/test/resources/com/demonwav/mcdev/platform/mcp/at/parser/fixtures/keywords_at.txt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -1,4 +1,4 @@ -Access Transformers(0,354) +Access transformers(0,354) AtEntryImpl(ENTRY)(0,26) AtKeywordImpl(KEYWORD)(0,6) PsiElement(KEYWORD_ELEMENT)('public')(0,6) Index: src/test/resources/com/demonwav/mcdev/platform/mcp/at/parser/fixtures/no_value_at.txt =================================================================== --- src/test/resources/com/demonwav/mcdev/platform/mcp/at/parser/fixtures/no_value_at.txt (revision 9a4e5d33475a0466e4b26648df8eb34eb65d2fdb) +++ src/test/resources/com/demonwav/mcdev/platform/mcp/at/parser/fixtures/no_value_at.txt (revision 5c430ae035ca3bb1a9702d853cd2b53fc58e57c6) @@ -1,4 +1,4 @@ -Access Transformers(0,173) +Access transformers(0,173) AtEntryImpl(ENTRY)(0,37) AtKeywordImpl(KEYWORD)(0,8) PsiElement(KEYWORD_ELEMENT)('public-f')(0,8)