User: kyle wood Date: 01 Mar 23 05:09 Revision: c9139e6a56d8e423957c79a6c0558eda10be5529 Summary: Fix up all duplicaate code warnings Also messed up the ktlint configuration trying to upgrade it, but future versions are still a broken mess. Sorry about that. TeamCity URL: http://ci.mcdev.io:80/viewModification.html?tab=vcsModificationFiles&modId=8328&personal=false Index: build.gradle.kts =================================================================== --- build.gradle.kts (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ build.gradle.kts (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -9,12 +9,14 @@ */ import org.cadixdev.gradle.licenser.header.HeaderStyle +import org.cadixdev.gradle.licenser.tasks.LicenseUpdate import org.gradle.internal.jvm.Jvm import org.gradle.internal.os.OperatingSystem import org.jetbrains.gradle.ext.settings import org.jetbrains.gradle.ext.taskTriggers import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import org.jlleitschuh.gradle.ktlint.tasks.BaseKtLintCheckTask +import org.jlleitschuh.gradle.ktlint.tasks.KtLintFormatTask plugins { kotlin("jvm") version "1.8.0" @@ -22,7 +24,7 @@ mcdev groovy idea - id("org.jetbrains.intellij") version "1.12.0" + id("org.jetbrains.intellij") version "1.13.0" id("org.cadixdev.licenser") id("org.jlleitschuh.gradle.ktlint") version "10.3.0" } @@ -278,7 +280,7 @@ fileTree(project.projectDir) { include("*.gradle.kts", "gradle.properties") exclude("**/buildSrc/**", "**/build/**") - } + }, ) } register("buildSrc") { @@ -286,7 +288,7 @@ project.fileTree(project.projectDir.resolve("buildSrc")) { include("**/*.kt", "**/*.kts") exclude("**/build/**") - } + }, ) } register("grammars") { @@ -295,6 +297,9 @@ } } +ktlint { + disabledRules.add("filename") +} tasks.withType().configureEach { workerMaxHeapSize.set("512m") } @@ -302,9 +307,7 @@ tasks.register("format") { group = "minecraft" description = "Formats source code according to project style" - val licenseFormat by tasks.existing - val ktlintFormat by tasks.existing - dependsOn(licenseFormat, ktlintFormat) + dependsOn(tasks.withType(), tasks.withType()) } val generateAtLexer by lexer("AtLexer", "com/demonwav/mcdev/platform/mcp/at/gen") @@ -334,7 +337,7 @@ generateNbttParser, generateLangLexer, generateLangParser, - generateTranslationTemplateLexer + generateTranslationTemplateLexer, ) } @@ -376,7 +379,7 @@ "--add-opens=java.desktop/javax.swing=ALL-UNNAMED", "--add-opens=java.desktop/sun.awt=ALL-UNNAMED", "--add-opens=java.desktop/sun.font=ALL-UNNAMED", - "--add-opens=java.desktop/sun.swing=ALL-UNNAMED" + "--add-opens=java.desktop/sun.swing=ALL-UNNAMED", ) if (OperatingSystem.current().isMacOsX) { Index: src/main/kotlin/MinecraftSettings.kt =================================================================== --- src/main/kotlin/MinecraftSettings.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/MinecraftSettings.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -24,7 +24,7 @@ var isShowEventListenerGutterIcons: Boolean = true, var isShowChatColorGutterIcons: Boolean = true, var isShowChatColorUnderlines: Boolean = false, - var underlineType: UnderlineType = UnderlineType.DOTTED + var underlineType: UnderlineType = UnderlineType.DOTTED, ) private var state = State() @@ -81,7 +81,8 @@ DOTTED("Dotted", EffectType.BOLD_DOTTED_LINE), BOXED("Boxed", EffectType.BOXED), ROUNDED_BOXED("Rounded Boxed", EffectType.ROUNDED_BOX), - WAVED("Waved", EffectType.WAVE_UNDERSCORE); + WAVED("Waved", EffectType.WAVE_UNDERSCORE), + ; override fun toString(): String { return regular Index: src/main/kotlin/creator/JdkComboBoxWithPreference.kt =================================================================== --- src/main/kotlin/creator/JdkComboBoxWithPreference.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/creator/JdkComboBoxWithPreference.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -107,7 +107,7 @@ fun Row.jdkComboBoxWithPreference( context: WizardContext, sdkProperty: ObservableMutableProperty, - sdkPropertyId: String + sdkPropertyId: String, ): Cell { val sdkModel = ProjectSdksModel() @@ -152,7 +152,7 @@ preferenceData.sdkPathByJdk[jdk] = homePath stateComponent.setList( preferenceDataProperty, - preferenceData.sdkPathByJdk.map { (jdk, sdk) -> "${jdk.ordinal}=$sdk" } + preferenceData.sdkPathByJdk.map { (jdk, sdk) -> "${jdk.ordinal}=$sdk" }, ) } } Index: src/main/kotlin/creator/ProjectSetupFinalizerWizardStep.kt =================================================================== --- src/main/kotlin/creator/ProjectSetupFinalizerWizardStep.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/creator/ProjectSetupFinalizerWizardStep.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -10,6 +10,7 @@ package com.demonwav.mcdev.creator +import com.demonwav.mcdev.creator.ProjectSetupFinalizer.Factory import com.demonwav.mcdev.util.mapFirstNotNull import com.demonwav.mcdev.util.toTypedArray import com.intellij.ide.wizard.AbstractNewProjectWizardStep @@ -60,7 +61,7 @@ .validation( validationErrorFor { finalizers.mapFirstNotNull(ProjectSetupFinalizer::validate) - } + }, ) } } @@ -96,7 +97,7 @@ } class JdkProjectSetupFinalizer( - parent: NewProjectWizardStep + parent: NewProjectWizardStep, ) : AbstractNewProjectWizardStep(parent), ProjectSetupFinalizer { private val sdkProperty: GraphProperty = propertyGraph.property(null) private var sdk by sdkProperty Index: src/main/kotlin/creator/buildsystem/AbstractBuildSystemStep.kt =================================================================== --- src/main/kotlin/creator/buildsystem/AbstractBuildSystemStep.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/creator/buildsystem/AbstractBuildSystemStep.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -25,7 +25,7 @@ import com.intellij.ui.dsl.builder.Row abstract class AbstractBuildSystemStep( - parent: NewProjectWizardStep + parent: NewProjectWizardStep, ) : AbstractNewProjectWizardMultiStep(parent, EP_NAME) { companion object { private val PLATFORM_NAME_KEY = Key.create("mcdev.platformName") @@ -95,7 +95,7 @@ abstract class AbstractRunBuildSystemStep( parent: NewProjectWizardStep, - private val buildSystemStepClass: Class + private val buildSystemStepClass: Class, ) : AbstractNewProjectWizardStep(parent) { abstract val step: String Index: src/main/kotlin/creator/buildsystem/BuildSystem.kt =================================================================== --- src/main/kotlin/creator/buildsystem/BuildSystem.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/creator/buildsystem/BuildSystem.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -22,11 +22,11 @@ val artifactId: String = "", val version: String = "", val mavenScope: String? = null, - val gradleConfiguration: String? = null + val gradleConfiguration: String? = null, ) data class BuildRepository( var id: String = "", var url: String = "", - val buildSystems: EnumSet = EnumSet.allOf(BuildSystemType::class.java) + val buildSystems: EnumSet = EnumSet.allOf(BuildSystemType::class.java), ) Index: src/main/kotlin/creator/buildsystem/BuildSystemSupport.kt =================================================================== --- src/main/kotlin/creator/buildsystem/BuildSystemSupport.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/creator/buildsystem/BuildSystemSupport.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -21,7 +21,7 @@ interface BuildSystemSupport { companion object { private val EP_NAME = ExtensionPointName>( - "com.demonwav.minecraft-dev.buildSystemSupport" + "com.demonwav.minecraft-dev.buildSystemSupport", ) private val COLLECTOR = KeyedExtensionCollector>(EP_NAME) Index: src/main/kotlin/creator/buildsystem/gradle-steps.kt =================================================================== --- src/main/kotlin/creator/buildsystem/gradle-steps.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/creator/buildsystem/gradle-steps.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -160,7 +160,7 @@ "$gradleConfig \"${escapeGString(dep.groupId)}:${ escapeGString(dep.artifactId) }:${escapeGString(dep.version)}\"", - depsBlock + depsBlock, ) depsBlock.addStatementBefore(stmt, null) } @@ -175,7 +175,7 @@ val stmt = elementFactory.createExpression( "$gradleConfig(\"${escapeGString(dep.groupId)}:${ escapeGString(dep.artifactId) - }:${escapeGString(dep.version)}\")" + }:${escapeGString(dep.version)}\")", ) depsBlock.addBefore(stmt, depsBlock.rBrace) } @@ -249,7 +249,7 @@ project: Project, element: GrStatementOwner, name: String, - first: Boolean = false + first: Boolean = false, ): GrClosableBlock { findGroovyBlock(element, name)?.let { return it } val block = GroovyPsiElementFactory.getInstance(project).createStatementFromText("$name {\n}", element) @@ -277,7 +277,7 @@ project: Project, element: KtBlockExpression, name: String, - first: Boolean = false + first: Boolean = false, ): KtBlockExpression { findKotlinBlock(element, name)?.let { return it } val block = KtPsiFactory(project).createExpression("$name {\n}") @@ -313,7 +313,7 @@ class GradleFiles( private val project: Project, - private val rootDir: VirtualFile + private val rootDir: VirtualFile, ) { private val lazyBuildGradle = lazy { val file = rootDir.findChild("build.gradle") ?: rootDir.findChild("build.gradle.kts") @@ -413,7 +413,7 @@ project: Project, rootDirectory: Path, buildSystemProps: BuildSystemPropertiesStep<*>, - task: String + task: String, ) { val gradleType = GradleExternalTaskConfigurationType.getInstance() @@ -431,7 +431,7 @@ val settings = runManager.createConfiguration( runConfiguration, - gradleType.factory + gradleType.factory, ) settings.isActivateToolWindowBeforeRun = true Index: src/main/kotlin/creator/buildsystem/maven-steps.kt =================================================================== --- src/main/kotlin/creator/buildsystem/maven-steps.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/creator/buildsystem/maven-steps.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -87,7 +87,7 @@ protected fun setupDependencies( model: MavenDomProjectModel, repositories: List, - dependencies: List + dependencies: List, ) { for ((id, url, types) in repositories) { if (!types.contains(BuildSystemType.MAVEN)) { Index: src/main/kotlin/creator/creator-utils.kt =================================================================== --- src/main/kotlin/creator/creator-utils.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/creator/creator-utils.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -140,12 +140,13 @@ class EmptyStep(parent: NewProjectWizardStep) : AbstractNewProjectWizardStep(parent) +@Suppress("DuplicatedCode") fun T1.chain( f1: (T1) -> T2, f2: (T2) -> T3, f3: (T3) -> T4, f4: (T4) -> T5, - f5: (T5) -> T6 + f5: (T5) -> T6, ): NewProjectWizardStep where T1 : NewProjectWizardStep, T2 : NewProjectWizardStep, @@ -153,7 +154,6 @@ T4 : NewProjectWizardStep, T5 : NewProjectWizardStep, T6 : NewProjectWizardStep { - val s1 = f1(this) val s2 = f2(s1) val s3 = f3(s2) @@ -162,13 +162,14 @@ return stepSequence(this, s1, s2, s3, s4, s5) } +@Suppress("DuplicatedCode") fun T1.chain( f1: (T1) -> T2, f2: (T2) -> T3, f3: (T3) -> T4, f4: (T4) -> T5, f5: (T5) -> T6, - f6: (T6) -> T7 + f6: (T6) -> T7, ): NewProjectWizardStep where T1 : NewProjectWizardStep, T2 : NewProjectWizardStep, @@ -177,7 +178,6 @@ T5 : NewProjectWizardStep, T6 : NewProjectWizardStep, T7 : NewProjectWizardStep { - val s1 = f1(this) val s2 = f2(s1) val s3 = f3(s2) @@ -187,6 +187,7 @@ return stepSequence(this, s1, s2, s3, s4, s5, s6) } +@Suppress("DuplicatedCode") fun T1.chain( f1: (T1) -> T2, f2: (T2) -> T3, @@ -194,7 +195,7 @@ f4: (T4) -> T5, f5: (T5) -> T6, f6: (T6) -> T7, - f7: (T7) -> T8 + f7: (T7) -> T8, ): NewProjectWizardStep where T1 : NewProjectWizardStep, T2 : NewProjectWizardStep, @@ -204,7 +205,6 @@ T6 : NewProjectWizardStep, T7 : NewProjectWizardStep, T8 : NewProjectWizardStep { - val s1 = f1(this) val s2 = f2(s1) val s3 = f3(s2) @@ -215,6 +215,7 @@ return stepSequence(this, s1, s2, s3, s4, s5, s6, s7) } +@Suppress("DuplicatedCode") fun T1.chain( f1: (T1) -> T2, f2: (T2) -> T3, @@ -223,7 +224,7 @@ f5: (T5) -> T6, f6: (T6) -> T7, f7: (T7) -> T8, - f8: (T8) -> T9 + f8: (T8) -> T9, ): NewProjectWizardStep where T1 : NewProjectWizardStep, T2 : NewProjectWizardStep, @@ -234,7 +235,6 @@ T7 : NewProjectWizardStep, T8 : NewProjectWizardStep, T9 : NewProjectWizardStep { - val s1 = f1(this) val s2 = f2(s1) val s3 = f3(s2) @@ -246,6 +246,7 @@ return stepSequence(this, s1, s2, s3, s4, s5, s6, s7, s8) } +@Suppress("DuplicatedCode") fun T1.chain( f1: (T1) -> T2, f2: (T2) -> T3, @@ -255,7 +256,7 @@ f6: (T6) -> T7, f7: (T7) -> T8, f8: (T8) -> T9, - f9: (T9) -> T10 + f9: (T9) -> T10, ): NewProjectWizardStep where T1 : NewProjectWizardStep, T2 : NewProjectWizardStep, @@ -267,7 +268,6 @@ T8 : NewProjectWizardStep, T9 : NewProjectWizardStep, T10 : NewProjectWizardStep { - val s1 = f1(this) val s2 = f2(s1) val s3 = f3(s2) @@ -280,6 +280,7 @@ return stepSequence(this, s1, s2, s3, s4, s5, s6, s7, s8, s9) } +@Suppress("DuplicatedCode") fun T1.chain( f1: (T1) -> T2, f2: (T2) -> T3, @@ -290,7 +291,7 @@ f7: (T7) -> T8, f8: (T8) -> T9, f9: (T9) -> T10, - f10: (T10) -> T11 + f10: (T10) -> T11, ): NewProjectWizardStep where T1 : NewProjectWizardStep, T2 : NewProjectWizardStep, @@ -303,7 +304,6 @@ T9 : NewProjectWizardStep, T10 : NewProjectWizardStep, T11 : NewProjectWizardStep { - val s1 = f1(this) val s2 = f2(s1) val s3 = f3(s2) @@ -317,6 +317,7 @@ return stepSequence(this, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10) } +@Suppress("DuplicatedCode") fun T1.chain( f1: (T1) -> T2, f2: (T2) -> T3, @@ -328,7 +329,7 @@ f8: (T8) -> T9, f9: (T9) -> T10, f10: (T10) -> T11, - f11: (T11) -> T12 + f11: (T11) -> T12, ): NewProjectWizardStep where T1 : NewProjectWizardStep, T2 : NewProjectWizardStep, @@ -342,7 +343,6 @@ T10 : NewProjectWizardStep, T11 : NewProjectWizardStep, T12 : NewProjectWizardStep { - val s1 = f1(this) val s2 = f2(s1) val s3 = f3(s2) Index: src/main/kotlin/creator/platformtype/ModPlatformStep.kt =================================================================== --- src/main/kotlin/creator/platformtype/ModPlatformStep.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/creator/platformtype/ModPlatformStep.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -10,6 +10,7 @@ package com.demonwav.mcdev.creator.platformtype +import com.demonwav.mcdev.creator.platformtype.ModPlatformStep.Factory import com.intellij.ide.wizard.AbstractNewProjectWizardMultiStep import com.intellij.ide.wizard.NewProjectWizardMultiStepFactory import com.intellij.openapi.extensions.ExtensionPointName @@ -21,8 +22,8 @@ * point. */ class ModPlatformStep( - parent: PlatformTypeStep -) : AbstractNewProjectWizardMultiStep(parent, EP_NAME) { + parent: PlatformTypeStep, +) : AbstractNewProjectWizardMultiStep(parent, EP_NAME) { companion object { val EP_NAME = ExtensionPointName("com.demonwav.minecraft-dev.modPlatformWizard") } Index: src/main/kotlin/creator/platformtype/PlatformTypeStep.kt =================================================================== --- src/main/kotlin/creator/platformtype/PlatformTypeStep.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/creator/platformtype/PlatformTypeStep.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -10,6 +10,7 @@ package com.demonwav.mcdev.creator.platformtype +import com.demonwav.mcdev.creator.platformtype.PlatformTypeStep.Factory import com.intellij.ide.wizard.AbstractNewProjectWizardMultiStep import com.intellij.ide.wizard.NewProjectWizardBaseData import com.intellij.ide.wizard.NewProjectWizardMultiStepFactory @@ -23,7 +24,7 @@ * point. */ class PlatformTypeStep private constructor( - parent: NewProjectWizardStep + parent: NewProjectWizardStep, ) : AbstractNewProjectWizardMultiStep(parent, EP_NAME), NewProjectWizardBaseData by parent as NewProjectWizardBaseData { companion object { Index: src/main/kotlin/creator/platformtype/PluginPlatformStep.kt =================================================================== --- src/main/kotlin/creator/platformtype/PluginPlatformStep.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/creator/platformtype/PluginPlatformStep.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -10,6 +10,7 @@ package com.demonwav.mcdev.creator.platformtype +import com.demonwav.mcdev.creator.platformtype.PluginPlatformStep.Factory import com.intellij.ide.wizard.AbstractNewProjectWizardMultiStep import com.intellij.ide.wizard.NewProjectWizardMultiStepFactory import com.intellij.openapi.extensions.ExtensionPointName @@ -21,7 +22,7 @@ * point. */ class PluginPlatformStep( - parent: PlatformTypeStep + parent: PlatformTypeStep, ) : AbstractNewProjectWizardMultiStep(parent, EP_NAME) { companion object { val EP_NAME = ExtensionPointName("com.demonwav.minecraft-dev.pluginPlatformWizard") Index: src/main/kotlin/creator/step/AbstractLatentStep.kt =================================================================== --- src/main/kotlin/creator/step/AbstractLatentStep.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/creator/step/AbstractLatentStep.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -139,13 +139,13 @@ lifetime?.let(Disposer::dispose) lifetime = null } - } + }, ) .validationRequestor(AFTER_GRAPH_PROPAGATION(propertyGraph)) .validation( validationErrorFor { "Haven't finished $description" - } + }, ) } } Index: src/main/kotlin/creator/step/AbstractLongRunningStep.kt =================================================================== --- src/main/kotlin/creator/step/AbstractLongRunningStep.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/creator/step/AbstractLongRunningStep.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -74,7 +74,8 @@ } indicator.text2 = null } - }) + }, + ) } companion object { Index: src/main/kotlin/creator/step/AbstractSelectVersionStep.kt =================================================================== --- src/main/kotlin/creator/step/AbstractSelectVersionStep.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/creator/step/AbstractSelectVersionStep.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -21,7 +21,7 @@ abstract class AbstractSelectVersionStep>( parent: NewProjectWizardStep, - val versions: List + val versions: List, ) : AbstractNewProjectWizardStep(parent) { protected abstract val label: String Index: src/main/kotlin/creator/step/AbstractVersionChainStep.kt =================================================================== --- src/main/kotlin/creator/step/AbstractVersionChainStep.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/creator/step/AbstractVersionChainStep.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -62,7 +62,7 @@ } } ?: run { versionProperties[j].set( - preferredVersion ?: step.getAvailableVersions(versionsAboveChild).first() + preferredVersion ?: step.getAvailableVersions(versionsAboveChild).first(), ) } @@ -128,13 +128,13 @@ */ abstract class AbstractVersionChainStep( parent: NewProjectWizardStep, - private vararg val labels: String + private vararg val labels: String, ) : AbstractNewProjectWizardStep(parent) { private val versionProperties by lazy { val versionProperties = mutableListOf>>() for (i in labels.indices) { versionProperties += propertyGraph.property( - getAvailableVersions(versionProperties.map(ObservableMutableProperty>::get)).first() + getAvailableVersions(versionProperties.map(ObservableMutableProperty>::get)).first(), ) } val preferredVersions = labels.indices.map { mutableMapOf>, Comparable<*>>() } @@ -165,11 +165,12 @@ for ((i, label) in labels.withIndex()) { row(label) { val comboBox = createComboBox( - this, i, + this, + i, getAvailableVersions( versionProperties.versionProperties - .take(i).map(ObservableMutableProperty>::get) - ).sortedDescending() + .take(i).map(ObservableMutableProperty>::get), + ).sortedDescending(), ).bindItem(versionProperties.versionProperties[i]) comboBoxes += comboBox.component } @@ -184,7 +185,7 @@ @Service @State( name = "PreferredVersions", - storages = [Storage("mcdev.CreatorPreferredVersions.xml", roamingType = RoamingType.DISABLED)] + storages = [Storage("mcdev.CreatorPreferredVersions.xml", roamingType = RoamingType.DISABLED)], ) class PreferredVersionStateComponent : PersistentStateComponent> { private var state = mutableMapOf() Index: src/main/kotlin/creator/step/McVersionStep.kt =================================================================== --- src/main/kotlin/creator/step/McVersionStep.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/creator/step/McVersionStep.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -22,7 +22,7 @@ class SimpleMcVersionStep( parent: NewProjectWizardStep, - versions: List + versions: List, ) : AbstractSelectVersionStep(parent, versions) { override val label = "Minecraft Version:" @@ -45,7 +45,7 @@ val version = SemanticVersion.tryParse(version) ?: return findStep().setPreferredJdk( MinecraftVersions.requiredJavaVersion(version), - "Minecraft $version" + "Minecraft $version", ) } @@ -56,7 +56,7 @@ abstract class AbstractMcVersionChainStep( parent: NewProjectWizardStep, - vararg otherLabels: String + vararg otherLabels: String, ) : AbstractVersionChainStep(parent, *(listOf("Minecraft Version:") + otherLabels).toTypedArray()) { companion object { const val MINECRAFT_VERSION = 0 @@ -81,7 +81,7 @@ val version = SemanticVersion.tryParse(getVersion(MINECRAFT_VERSION).toString()) ?: return findStep().setPreferredJdk( MinecraftVersions.requiredJavaVersion(version), - "Minecraft ${getVersion(MINECRAFT_VERSION)}" + "Minecraft ${getVersion(MINECRAFT_VERSION)}", ) } } Index: src/main/kotlin/creator/step/OptionalSteps.kt =================================================================== --- src/main/kotlin/creator/step/OptionalSteps.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/creator/step/OptionalSteps.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -46,7 +46,7 @@ } abstract class AbstractOptionalStringBasedOnProjectNameStep( - parent: NewProjectWizardStep + parent: NewProjectWizardStep, ) : AbstractOptionalStringStep(parent) { private val formatProperty = propertyGraph.property("").bindStorage("${javaClass.name}.format") var format by formatProperty Index: src/main/kotlin/creator/step/TemplateOutdatedStep.kt =================================================================== --- src/main/kotlin/creator/step/TemplateOutdatedStep.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/creator/step/TemplateOutdatedStep.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -31,7 +31,7 @@ "&operating-system=${SystemInfoRt.OS_NAME.urlEncode()}" text( "Is the Minecraft project wizard outdated? " + - "Create an issue on the MinecraftDev issue tracker." + "Create an issue on the MinecraftDev issue tracker.", ) } } Index: src/main/kotlin/errorreporter/AnonymousFeedback.kt =================================================================== --- src/main/kotlin/errorreporter/AnonymousFeedback.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/errorreporter/AnonymousFeedback.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -35,7 +35,7 @@ fun sendFeedback( factory: HttpConnectionFactory, envDetails: LinkedHashMap, - attachments: List + attachments: List, ): FeedbackData { val duplicateId = findDuplicateIssue(envDetails, factory) if (duplicateId != null) { @@ -51,7 +51,7 @@ private fun convertToGitHubIssueFormat( envDetails: LinkedHashMap, - attachments: List + attachments: List, ): ByteArray { val result = LinkedHashMap(5) result["title"] = "[auto-generated] Exception in plugin" Index: src/main/kotlin/errorreporter/AnonymousFeedbackTask.kt =================================================================== --- src/main/kotlin/errorreporter/AnonymousFeedbackTask.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/errorreporter/AnonymousFeedbackTask.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -23,7 +23,7 @@ private val params: LinkedHashMap, private val attachments: List, private val callback: (String, Int, Boolean) -> Unit, - private val errorCallback: (Exception) -> Unit + private val errorCallback: (Exception) -> Unit, ) : Task.Backgroundable(project, title, canBeCancelled) { override fun run(indicator: ProgressIndicator) { Index: src/main/kotlin/errorreporter/ErrorReporter.kt =================================================================== --- src/main/kotlin/errorreporter/ErrorReporter.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/errorreporter/ErrorReporter.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -33,7 +33,7 @@ class ErrorReporter : ErrorReportSubmitter() { private val ignoredErrorMessages = listOf( "Key com.demonwav.mcdev.translations.TranslationFoldingSettings duplicated", - "Inspection #EntityConstructor has no description" + "Inspection #EntityConstructor has no description", ) override fun getReportActionText() = "Report to Minecraft Dev GitHub Issue Tracker" @@ -41,7 +41,7 @@ events: Array, additionalInfo: String?, parentComponent: Component, - consumer: Consumer + consumer: Consumer, ): Boolean { val dataContext = DataManager.getInstance().getDataContext(parentComponent) val project = CommonDataKeys.PROJECT.getData(dataContext) @@ -108,7 +108,7 @@ NotificationGroupManager.getInstance().getNotificationGroup("Error Report").createNotification( DiagnosticBundle.message("error.report.title"), message, - NotificationType.INFORMATION + NotificationType.INFORMATION, ).addAction(BrowseNotificationAction(actionText, htmlUrl)).setImportant(false).notify(project) val reportInfo = SubmittedReportInfo(htmlUrl, "Issue #$token", type) @@ -125,7 +125,7 @@ ).addAction(BrowseNotificationAction(actionText, userUrl)).setImportant(false).notify(project) consumer.consume(SubmittedReportInfo(null, null, SubmittedReportInfo.SubmissionStatus.FAILED)) - } + }, ) if (project == null) { Index: src/main/kotlin/facet/LibraryPresentationProviders.kt =================================================================== --- src/main/kotlin/facet/LibraryPresentationProviders.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/facet/LibraryPresentationProviders.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -24,7 +24,7 @@ abstract class ManifestLibraryPresentationProvider( kind: LibraryKind, private val title: String, - private val startsWith: Boolean = false + private val startsWith: Boolean = false, ) : LibraryPresentationProvider(kind) { @@ -55,7 +55,7 @@ kind: LibraryKind, private val groupId: String, private val artifactId: String, - private val strict: Boolean = true + private val strict: Boolean = true, ) : LibraryPresentationProvider(kind) { Index: src/main/kotlin/facet/MinecraftFacet.kt =================================================================== --- src/main/kotlin/facet/MinecraftFacet.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/facet/MinecraftFacet.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -35,7 +35,6 @@ import com.intellij.psi.PsiMethod import java.util.concurrent.ConcurrentHashMap import javax.swing.Icon -import kotlin.jvm.Throws import org.jetbrains.jps.model.java.JavaResourceRootType import org.jetbrains.jps.model.java.JavaSourceRootType @@ -43,7 +42,7 @@ module: Module, name: String, configuration: MinecraftFacetConfiguration, - underlyingFacet: Facet<*>? + underlyingFacet: Facet<*>?, ) : Facet(facetType, module, name, configuration, underlyingFacet) { private val moduleMap = ConcurrentHashMap, AbstractModule>() Index: src/main/kotlin/facet/MinecraftFacetConfiguration.kt =================================================================== --- src/main/kotlin/facet/MinecraftFacetConfiguration.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/facet/MinecraftFacetConfiguration.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -39,5 +39,5 @@ @XCollection(elementName = "platformType", valueAttributeName = "", style = XCollection.Style.v2) var autoDetectTypes: MutableSet = mutableSetOf(), @Tag("forgePatcher") - var forgePatcher: Boolean = false + var forgePatcher: Boolean = false, ) Index: src/main/kotlin/facet/MinecraftFacetDetector.kt =================================================================== --- src/main/kotlin/facet/MinecraftFacetDetector.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/facet/MinecraftFacetDetector.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -136,7 +136,7 @@ object : LibraryDetectionManager.LibraryPropertiesProcessor { override fun

> processProperties( kind: LibraryKind, - properties: P + properties: P, ): Boolean { return if (properties is LibraryVersionProperties) { libraryVersions[kind] = properties.versionString ?: return true @@ -145,7 +145,7 @@ true } } - } + }, ) platformKinds.add(kind) } Index: src/main/kotlin/facet/MinecraftFacetEditorTab.kt =================================================================== --- src/main/kotlin/facet/MinecraftFacetEditorTab.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/facet/MinecraftFacetEditorTab.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -71,7 +71,7 @@ bungeecordEnabledCheckBox, waterfallEnabledCheckBox, velocityEnabledCheckBox, - adventureEnabledCheckBox + adventureEnabledCheckBox, ) } @@ -90,7 +90,7 @@ bungeecordAutoCheckBox, waterfallAutoCheckBox, velocityAutoCheckBox, - adventureAutoCheckBox + adventureAutoCheckBox, ) } @@ -109,40 +109,40 @@ unique( bukkitEnabledCheckBox, spigotEnabledCheckBox, - paperEnabledCheckBox + paperEnabledCheckBox, ) } spigotEnabledCheckBox.addActionListener { unique( spigotEnabledCheckBox, bukkitEnabledCheckBox, - paperEnabledCheckBox + paperEnabledCheckBox, ) } paperEnabledCheckBox.addActionListener { unique( paperEnabledCheckBox, bukkitEnabledCheckBox, - spigotEnabledCheckBox + spigotEnabledCheckBox, ) } bukkitAutoCheckBox.addActionListener { all(bukkitAutoCheckBox, spigotAutoCheckBox, paperAutoCheckBox)( SPIGOT, - PAPER + PAPER, ) } spigotAutoCheckBox.addActionListener { all(spigotAutoCheckBox, bukkitAutoCheckBox, paperAutoCheckBox)( BUKKIT, - PAPER + PAPER, ) } paperAutoCheckBox.addActionListener { all(paperAutoCheckBox, bukkitAutoCheckBox, spigotAutoCheckBox)( BUKKIT, - SPIGOT + SPIGOT, ) } @@ -158,28 +158,28 @@ unique( architecturyEnabledCheckBox, fabricEnabledCheckBox, - forgeEnabledCheckBox + forgeEnabledCheckBox, ) } forgeAutoCheckBox.addActionListener { all(forgeAutoCheckBox, fabricAutoCheckBox, architecturyAutoCheckBox)( FABRIC, - ARCHITECTURY + ARCHITECTURY, ) } fabricAutoCheckBox.addActionListener { all(fabricAutoCheckBox, forgeAutoCheckBox, architecturyAutoCheckBox)( FORGE, - ARCHITECTURY + ARCHITECTURY, ) } architecturyAutoCheckBox.addActionListener { all(architecturyAutoCheckBox, forgeAutoCheckBox, fabricAutoCheckBox)( FORGE, - FABRIC + FABRIC, ) } @@ -226,7 +226,7 @@ } private inline fun runOnAll( - run: (JCheckBox, JCheckBox, PlatformType, MutableMap, Set) -> Unit + run: (JCheckBox, JCheckBox, PlatformType, MutableMap, Set) -> Unit, ) { val state = configuration.state for (i in indexes) { @@ -235,7 +235,7 @@ autoCheckBoxArray[i], platformTypes[i], state.userChosenTypes, - state.autoDetectTypes + state.autoDetectTypes, ) } } @@ -326,7 +326,7 @@ PlatformType.BUNGEECORD, PlatformType.WATERFALL, PlatformType.VELOCITY, - PlatformType.ADVENTURE + PlatformType.ADVENTURE, ) private val indexes = intArrayOf( @@ -342,7 +342,7 @@ BUNGEECORD, WATERFALL, VELOCITY, - ADVENTURE + ADVENTURE, ) } } Index: src/main/kotlin/facet/MinecraftFacetType.kt =================================================================== --- src/main/kotlin/facet/MinecraftFacetType.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/facet/MinecraftFacetType.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -24,7 +24,7 @@ module: Module, name: String, configuration: MinecraftFacetConfiguration, - underlyingFacet: Facet<*>? + underlyingFacet: Facet<*>?, ) = MinecraftFacet(module, name, configuration, underlyingFacet) override fun createDefaultConfiguration() = MinecraftFacetConfiguration() Index: src/main/kotlin/facet/MinecraftLibraryKinds.kt =================================================================== --- src/main/kotlin/facet/MinecraftLibraryKinds.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/facet/MinecraftLibraryKinds.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -37,5 +37,5 @@ BUNGEECORD_LIBRARY_KIND, WATERFALL_LIBRARY_KIND, VELOCITY_LIBRARY_KIND, - ADVENTURE_LIBRARY_KIND + ADVENTURE_LIBRARY_KIND, ) Index: src/main/kotlin/insight/ColorLineMarkerProvider.kt =================================================================== --- src/main/kotlin/insight/ColorLineMarkerProvider.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/insight/ColorLineMarkerProvider.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -58,7 +58,7 @@ color: Color, map: Map, colorName: String, - workElement: UElement + workElement: UElement, ) : super( element, element.textRange, @@ -78,7 +78,7 @@ } }, GutterIconRenderer.Alignment.RIGHT, - { "$colorName color indicator" } + { "$colorName color indicator" }, ) { this.color = color } @@ -90,7 +90,7 @@ FunctionUtil.nullConstant(), handler, GutterIconRenderer.Alignment.RIGHT, - { "color indicator" } + { "color indicator" }, ) { this.color = color } @@ -113,7 +113,7 @@ class CommonColorInfo( element: PsiElement, color: Color, - workElement: UElement + workElement: UElement, ) : ColorLineMarkerProvider.ColorInfo( element, color, @@ -140,7 +140,7 @@ is ULiteralExpression -> workElement.setColor(c.rgb and 0xFFFFFF) is UCallExpression -> workElement.setColor(c.red, c.green, c.blue) } - } + }, ) abstract class CommonLineMarkerProvider : LineMarkerProvider { Index: src/main/kotlin/insight/ColorPicker.kt =================================================================== --- src/main/kotlin/insight/ColorPicker.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/insight/ColorPicker.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -63,7 +63,7 @@ chosenColor = entry.key dialog.close(0) } - } + }, ) val constraints = GridBagConstraints() Index: src/main/kotlin/insight/ColorUtil.kt =================================================================== --- src/main/kotlin/insight/ColorUtil.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/insight/ColorUtil.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -85,7 +85,7 @@ className: String, vectorClasses: Array?, maxDepth: Int = 10, - depth: Int = 0 + depth: Int = 0, ): Pair? { if (depth >= maxDepth) { return null @@ -133,7 +133,7 @@ private fun findColorFromCallExpression( methodExpression: UCallExpression, - vectorClasses: Array? + vectorClasses: Array?, ): Pair? { val project = methodExpression.sourcePsi?.project ?: return null Index: src/main/kotlin/insight/ListenerLineMarkerProvider.kt =================================================================== --- src/main/kotlin/insight/ListenerLineMarkerProvider.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/insight/ListenerLineMarkerProvider.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -63,7 +63,7 @@ element, element.textRange, icon, - createHandler() + createHandler(), ) } @@ -84,7 +84,7 @@ element: PsiElement, range: TextRange, icon: Icon, - handler: GutterIconNavigationHandler + handler: GutterIconNavigationHandler, ) : MergeableLineMarkerInfo( element, range, @@ -92,7 +92,7 @@ Function { "Go to Event declaration" }, handler, GutterIconRenderer.Alignment.RIGHT, - { "event listener indicator" } + { "event listener indicator" }, ) { override fun canMergeWith(info: MergeableLineMarkerInfo<*>): Boolean { Index: src/main/kotlin/insight/PluginLineMarkerProvider.kt =================================================================== --- src/main/kotlin/insight/PluginLineMarkerProvider.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/insight/PluginLineMarkerProvider.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -43,7 +43,7 @@ FunctionUtil.nullConstant(), null, GutterIconRenderer.Alignment.RIGHT, - { "minecraft plugin entry point indicator" } + { "minecraft plugin entry point indicator" }, ) } } Index: src/main/kotlin/insight/generation/GenerateEventListenerHandler.kt =================================================================== --- src/main/kotlin/insight/generation/GenerateEventListenerHandler.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/insight/generation/GenerateEventListenerHandler.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -48,7 +48,7 @@ var data: GenerationData?, var chosenClass: PsiClass, var chosenName: String, - var relevantModule: AbstractModule + var relevantModule: AbstractModule, ) private var data: GenerateData? = null @@ -65,7 +65,7 @@ RefactoringBundle.message("choose.destination.class"), GlobalSearchScope.moduleWithDependenciesAndLibrariesScope(moduleForPsiElement, false), { aClass1 -> isSuperEventListenerAllowed(aClass1, facet) }, - null + null, ) chooser.showDialog() @@ -81,7 +81,7 @@ editor, relevantModule.moduleType.getEventGenerationPanel(chosenClass), chosenClassName, - relevantModule.moduleType.getDefaultListenerName(chosenClass) + relevantModule.moduleType.getDefaultListenerName(chosenClass), ) val okay = generationDialog.showAndGet() @@ -97,7 +97,7 @@ val method = PsiTreeUtil.getParentOfType( aClass.containingFile.findElementAt(editor.caretModel.offset), - PsiMethod::class.java + PsiMethod::class.java, ) this.data = GenerateData( @@ -108,7 +108,7 @@ dialogDAta, chosenClass, chosenName, - relevantModule + relevantModule, ) return DUMMY_RESULT Index: src/main/kotlin/insight/generation/MinecraftClassCreateAction.kt =================================================================== --- src/main/kotlin/insight/generation/MinecraftClassCreateAction.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/insight/generation/MinecraftClassCreateAction.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -43,7 +43,7 @@ CAPTION, "Class generation for modders", GeneralAssets.MC_TEMPLATE, - JavaModuleSourceRootTypes.SOURCES + JavaModuleSourceRootTypes.SOURCES, ), DumbAware { @@ -117,7 +117,7 @@ private class ClassInputValidator( private val project: Project, - private val directory: PsiDirectory + private val directory: PsiDirectory, ) : InputValidatorEx { override fun getErrorText(inputString: String): String? { if (inputString.isNotEmpty() && !PsiNameHelper.getInstance(project).isQualifiedName(inputString)) { Index: src/main/kotlin/insight/generation/ui/EventGenerationDialog.kt =================================================================== --- src/main/kotlin/insight/generation/ui/EventGenerationDialog.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/insight/generation/ui/EventGenerationDialog.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -20,7 +20,7 @@ editor: Editor, private val panel: EventGenerationPanel, className: String, - defaultListenerName: String + defaultListenerName: String, ) : DialogWrapper(editor.component, false) { private val wizard: EventListenerWizard = EventListenerWizard(panel.panel, className, defaultListenerName) Index: src/main/kotlin/inspection/IsCancelled.kt =================================================================== --- src/main/kotlin/inspection/IsCancelled.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/inspection/IsCancelled.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -16,7 +16,7 @@ class IsCancelled( fix: (ProblemDescriptor) -> Unit, - val errorString: String + val errorString: String, ) { val buildFix: InspectionGadgetsFix Index: src/main/kotlin/inspection/WrongEntityDataParameterClassInspection.kt =================================================================== --- src/main/kotlin/inspection/WrongEntityDataParameterClassInspection.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/inspection/WrongEntityDataParameterClassInspection.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -60,7 +60,7 @@ holder.registerProblem( expression, "Entity class does not match this entity class", - QuickFix(firstParameter) + QuickFix(firstParameter), ) } } @@ -77,9 +77,9 @@ firstParameter.replace( factory.createExpressionFromText( "${containingClass.name}.class", - firstParameter + firstParameter, + ), - ) + ) - ) } override fun getFamilyName() = name @@ -93,12 +93,12 @@ private val ENTITY_DATA_MANAGER_CLASSES = setOf( "net.minecraft.network.datasync.EntityDataManager", "net.minecraft.network.syncher.SynchedEntityData", - "net.minecraft.entity.data.DataTracker" + "net.minecraft.entity.data.DataTracker", ) private val DEFINE_ID_METHODS = setOf( "defineId", "createKey", - "registerData" + "registerData", ) private fun isEntitySubclass(clazz: PsiClass): Boolean = Index: src/main/kotlin/nbt/NbtVirtualFile.kt =================================================================== --- src/main/kotlin/nbt/NbtVirtualFile.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/nbt/NbtVirtualFile.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -85,7 +85,7 @@ "Error saving NBT file", "The file is not recognised as a NBTT file. This might be caused by wrong file type associations," + " or the file could be too large.", - NotificationType.WARNING + NotificationType.WARNING, ).notify(project) return@runReadActionAsync } @@ -97,7 +97,7 @@ "NBT Save Error", "Error saving NBT file", "Due to errors in the text representation, ${backingFile.name} could not be saved.", - NotificationType.WARNING + NotificationType.WARNING, ).notify(project) return@runReadActionAsync } @@ -118,7 +118,7 @@ "NBT Save Success", "Saved NBT file successfully", "${backingFile.name} was saved successfully.", - NotificationType.INFORMATION + NotificationType.INFORMATION, ).notify(project) } } Index: src/main/kotlin/nbt/editor/CompressionSelection.kt =================================================================== --- src/main/kotlin/nbt/editor/CompressionSelection.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/nbt/editor/CompressionSelection.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -12,7 +12,8 @@ enum class CompressionSelection(private val selectionName: String) { GZIP("GZipped"), - UNCOMPRESSED("Uncompressed"); + UNCOMPRESSED("Uncompressed"), + ; override fun toString() = selectionName } Index: src/main/kotlin/nbt/editor/NbtFileEditorProvider.kt =================================================================== --- src/main/kotlin/nbt/editor/NbtFileEditorProvider.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/nbt/editor/NbtFileEditorProvider.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -76,7 +76,7 @@ private class NbtFileEditor( private val file: VirtualFile, - private val editorProvider: (NbtVirtualFile) -> FileEditor + private val editorProvider: (NbtVirtualFile) -> FileEditor, ) : FileEditor { private var editor: FileEditor? = null @@ -147,7 +147,7 @@ nbtFile.writeFile(this) } - } + }, ) } Index: src/main/kotlin/nbt/lang/NbttBraceMatcher.kt =================================================================== --- src/main/kotlin/nbt/lang/NbttBraceMatcher.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/nbt/lang/NbttBraceMatcher.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -38,7 +38,7 @@ override fun getPairs() = arrayOf( BracePair(NbttTypes.LPAREN, NbttTypes.RPAREN, true), BracePair(NbttTypes.LBRACE, NbttTypes.RBRACE, true), - BracePair(NbttTypes.LBRACKET, NbttTypes.RBRACKET, true) + BracePair(NbttTypes.LBRACKET, NbttTypes.RBRACKET, true), ) override fun isPairedBracesAllowedBeforeType(lbraceType: IElementType, contextType: IElementType?) = true Index: src/main/kotlin/nbt/lang/NbttParserDefinition.kt =================================================================== --- src/main/kotlin/nbt/lang/NbttParserDefinition.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/nbt/lang/NbttParserDefinition.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -47,19 +47,19 @@ NbttTypes.INT_ARRAY, NbttTypes.LONG_ARRAY, NbttTypes.COMPOUND, - NbttTypes.LIST + NbttTypes.LIST, ) val NBTT_OPEN_BRACES = TokenSet.create( NbttTypes.LPAREN, NbttTypes.LBRACE, - NbttTypes.LBRACKET + NbttTypes.LBRACKET, ) val NBTT_CLOSE_BRACES = TokenSet.create( NbttTypes.RPAREN, NbttTypes.RBRACE, - NbttTypes.RBRACKET + NbttTypes.RBRACKET, ) val NBTT_BRACES = TokenSet.orSet(NBTT_OPEN_BRACES, NBTT_CLOSE_BRACES) Index: src/main/kotlin/nbt/lang/colors/NbttColorSettingsPage.kt =================================================================== --- src/main/kotlin/nbt/lang/colors/NbttColorSettingsPage.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/nbt/lang/colors/NbttColorSettingsPage.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -76,13 +76,13 @@ AttributesDescriptor("Long", NbttSyntaxHighlighter.LONG), AttributesDescriptor("Float", NbttSyntaxHighlighter.FLOAT), AttributesDescriptor("Double", NbttSyntaxHighlighter.DOUBLE), - AttributesDescriptor("Material", NbttSyntaxHighlighter.MATERIAL) + AttributesDescriptor("Material", NbttSyntaxHighlighter.MATERIAL), ) private val map = mapOf( "name" to NbttSyntaxHighlighter.STRING_NAME, "uname" to NbttSyntaxHighlighter.UNQUOTED_STRING_NAME, - "material" to NbttSyntaxHighlighter.MATERIAL + "material" to NbttSyntaxHighlighter.MATERIAL, ) } } Index: src/main/kotlin/nbt/lang/format/NbttBlock.kt =================================================================== --- src/main/kotlin/nbt/lang/format/NbttBlock.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/nbt/lang/format/NbttBlock.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -34,7 +34,7 @@ private val node: ASTNode, private val settings: CodeStyleSettings, private val indent: Indent, - private val wrap: Wrap? + private val wrap: Wrap?, ) : ASTBlock { private val psiElement = node.psi Index: src/main/kotlin/nbt/lang/format/NbttFoldingBuilder.kt =================================================================== --- src/main/kotlin/nbt/lang/format/NbttFoldingBuilder.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/nbt/lang/format/NbttFoldingBuilder.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -60,9 +60,9 @@ list.add( FoldingDescriptor( node, - TextRange(lbrace.textRange.endOffset, rbrace.textRange.startOffset) + TextRange(lbrace.textRange.endOffset, rbrace.textRange.startOffset), + ), - ) + ) - ) } } } @@ -74,9 +74,9 @@ list.add( FoldingDescriptor( node, - TextRange(lbracket.textRange.endOffset, rbracket.textRange.startOffset) + TextRange(lbracket.textRange.endOffset, rbracket.textRange.startOffset), + ), - ) + ) - ) } } } @@ -88,9 +88,9 @@ list.add( FoldingDescriptor( node, - TextRange(lparen.textRange.endOffset, rparen.textRange.startOffset) + TextRange(lparen.textRange.endOffset, rparen.textRange.startOffset), + ), - ) + ) - ) } } } Index: src/main/kotlin/nbt/lang/format/NbttFormattingModelBuilder.kt =================================================================== --- src/main/kotlin/nbt/lang/format/NbttFormattingModelBuilder.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/nbt/lang/format/NbttFormattingModelBuilder.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -26,7 +26,7 @@ return FormattingModelProvider.createFormattingModelForPsiFile( formattingContext.containingFile, block, - formattingContext.codeStyleSettings + formattingContext.codeStyleSettings, ) } Index: src/main/kotlin/nbt/lang/format/NbttLanguageCodeStyleSettingsProvider.kt =================================================================== --- src/main/kotlin/nbt/lang/format/NbttLanguageCodeStyleSettingsProvider.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/nbt/lang/format/NbttLanguageCodeStyleSettingsProvider.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -40,8 +40,8 @@ CommonCodeStyleSettings.DO_NOT_WRAP, CommonCodeStyleSettings.WRAP_AS_NEEDED, CommonCodeStyleSettings.WRAP_ALWAYS, + ), - ) + ) - ) consumer.showCustomOption( NbttCodeStyleSettings::class.java, "ARRAY_WRAPPING", @@ -56,8 +56,8 @@ CommonCodeStyleSettings.DO_NOT_WRAP, CommonCodeStyleSettings.WRAP_AS_NEEDED, CommonCodeStyleSettings.WRAP_ALWAYS, + ), - ) + ) - ) } SettingsType.SPACING_SETTINGS -> { @@ -65,19 +65,19 @@ "SPACE_WITHIN_BRACKETS", "SPACE_WITHIN_PARENTHESES", "SPACE_BEFORE_COMMA", - "SPACE_AFTER_COMMA" + "SPACE_AFTER_COMMA", ) consumer.showCustomOption( NbttCodeStyleSettings::class.java, "SPACE_BEFORE_COLON", "Space before colon", - CodeStyleSettingsCustomizableOptions.getInstance().SPACES_AROUND_OPERATORS + CodeStyleSettingsCustomizableOptions.getInstance().SPACES_AROUND_OPERATORS, ) consumer.showCustomOption( NbttCodeStyleSettings::class.java, "SPACE_AFTER_COLON", "Space after colon", - CodeStyleSettingsCustomizableOptions.getInstance().SPACES_AROUND_OPERATORS + CodeStyleSettingsCustomizableOptions.getInstance().SPACES_AROUND_OPERATORS, ) consumer.renameStandardOption("SPACE_WITHIN_BRACKETS", "List brackets") @@ -95,7 +95,7 @@ override fun customizeDefaults( commonSettings: CommonCodeStyleSettings, - indentOptions: CommonCodeStyleSettings.IndentOptions + indentOptions: CommonCodeStyleSettings.IndentOptions, ) { commonSettings.RIGHT_MARGIN = 150 indentOptions.USE_TAB_CHARACTER = true Index: src/main/kotlin/nbt/lang/format/NbttParameterNameHints.kt =================================================================== --- src/main/kotlin/nbt/lang/format/NbttParameterNameHints.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/nbt/lang/format/NbttParameterNameHints.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -30,9 +30,9 @@ list.add( InlayInfo( "$size ${if (size == 1) "child" else "children"}", - element.textRange.startOffset + 1 + element.textRange.startOffset + 1, + ), - ) + ) - ) } is NbttList -> { // Size hint @@ -40,9 +40,9 @@ list.add( InlayInfo( "$size ${if (size == 1) "child" else "children"}", - element.textRange.startOffset + 1 + element.textRange.startOffset + 1, + ), - ) + ) - ) if (size > 5) { // Index hints @@ -56,9 +56,9 @@ list.add( InlayInfo( "$size ${if (size == 1) "child" else "children"}", - element.node.getChildren(null)[1].textRange.startOffset + 1 + element.node.getChildren(null)[1].textRange.startOffset + 1, + ), - ) + ) - ) if (size > 5) { // Index hints @@ -72,9 +72,9 @@ list.add( InlayInfo( "$size ${if (size == 1) "child" else "children"}", - element.node.getChildren(null)[1].textRange.startOffset + 1 + element.node.getChildren(null)[1].textRange.startOffset + 1, + ), - ) + ) - ) if (size > 5) { // Index hints @@ -88,9 +88,9 @@ list.add( InlayInfo( "$size ${if (size == 1) "child" else "children"}", - element.node.getChildren(null)[1].textRange.startOffset + 1 + element.node.getChildren(null)[1].textRange.startOffset + 1, + ), - ) + ) - ) // Index hints element.getLongList().forEachIndexed { i, param -> Index: src/main/kotlin/nbt/tags/NbtTypeId.kt =================================================================== --- src/main/kotlin/nbt/tags/NbtTypeId.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/nbt/tags/NbtTypeId.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -25,7 +25,8 @@ LIST(9, "TAG_List", TagList::class), COMPOUND(10, "TAG_Compound", TagCompound::class), INT_ARRAY(11, "TAG_Int_Array", TagIntArray::class), - LONG_ARRAY(12, "TAG_Long_Array", TagLongArray::class); + LONG_ARRAY(12, "TAG_Long_Array", TagLongArray::class), + ; companion object { fun getById(id: Byte) = values().firstOrNull { it.typeIdByte == id } Index: src/main/kotlin/platform/AbstractModule.kt =================================================================== --- src/main/kotlin/platform/AbstractModule.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/AbstractModule.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -59,7 +59,7 @@ containingClass: PsiClass, chosenClass: PsiClass, chosenName: String, - data: GenerationData? + data: GenerationData?, ): PsiMethod? = null open fun shouldShowPluginIcon(element: PsiElement?) = false Index: src/main/kotlin/platform/BaseTemplate.kt =================================================================== --- src/main/kotlin/platform/BaseTemplate.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/BaseTemplate.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -17,7 +17,7 @@ protected fun Project.applyTemplate( templateName: String, - properties: Map? = null + properties: Map? = null, ): String { val manager = FileTemplateManager.getInstance(this) val template = manager.getJ2eeTemplate(templateName) Index: src/main/kotlin/platform/PlatformType.kt =================================================================== --- src/main/kotlin/platform/PlatformType.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/PlatformType.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -41,7 +41,7 @@ enum class PlatformType( val type: AbstractModuleType<*>, val versionJson: String? = null, - private val parent: PlatformType? = null + private val parent: PlatformType? = null, ) { BUKKIT(BukkitModuleType, "bukkit.json"), @@ -56,7 +56,8 @@ VELOCITY(VelocityModuleType, "velocity.json"), MIXIN(MixinModuleType), MCP(McpModuleType), - ADVENTURE(AdventureModuleType); + ADVENTURE(AdventureModuleType), + ; private val children = mutableListOf() Index: src/main/kotlin/platform/adventure/AdventureModuleType.kt =================================================================== --- src/main/kotlin/platform/adventure/AdventureModuleType.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/adventure/AdventureModuleType.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -19,7 +19,7 @@ object AdventureModuleType : AbstractModuleType( AdventureConstants.GROUP_ID, - AdventureConstants.API_ARTIFACT_ID + AdventureConstants.API_ARTIFACT_ID, ) { const val ID = "ADVENTURE_MODULE_TYPE" Index: src/main/kotlin/platform/architectury/creator/asset-steps.kt =================================================================== --- src/main/kotlin/platform/architectury/creator/asset-steps.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/architectury/creator/asset-steps.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -147,7 +147,7 @@ if (useMixins) { assets.addTemplateProperties( - "MIXINS" to "true" + "MIXINS" to "true", ) val commonMixinsFile = "common/src/main/resources/${buildSystemProps.artifactId}-common.mixins.json" val forgeMixinsFile = "forge/src/main/resources/${buildSystemProps.artifactId}.mixins.json" @@ -173,7 +173,7 @@ abstract class ArchitecturyMainClassStep( parent: NewProjectWizardStep, - phase: Int + phase: Int, ) : AbstractLongRunningAssetsStep(parent) { abstract val projectDir: String abstract val template: String @@ -231,7 +231,7 @@ } class ArchitecturyPostBuildSystemStep( - parent: NewProjectWizardStep + parent: NewProjectWizardStep, ) : AbstractRunBuildSystemStep(parent, ArchitecturyBuildSystemStep::class.java) { override val step = BuildSystemSupport.POST_STEP } Index: src/main/kotlin/platform/architectury/creator/gradle-steps.kt =================================================================== --- src/main/kotlin/platform/architectury/creator/gradle-steps.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/architectury/creator/gradle-steps.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -71,7 +71,7 @@ "FORGE_VERSION" to "$mcVersion-$forgeVersion", "FABRIC_LOADER_VERSION" to fabricLoaderVersion, "ARCHITECTURY_GROUP" to architecturyGroup, - "JAVA_VERSION" to javaVersion + "JAVA_VERSION" to javaVersion, ) if (fabricApiVersion != null) { Index: src/main/kotlin/platform/architectury/creator/ui-steps.kt =================================================================== --- src/main/kotlin/platform/architectury/creator/ui-steps.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/architectury/creator/ui-steps.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -86,7 +86,7 @@ class ArchitecturyVersionChainStep( parent: NewProjectWizardStep, - private val versionData: ArchitecturyVersionData + private val versionData: ArchitecturyVersionData, ) : AbstractMcVersionChainStep( parent, "Forge Version:", @@ -118,7 +118,7 @@ .intersect( versionData.fabricVersions.game.mapNotNullTo(mutableSetOf()) { SemanticVersion.tryParse(it.version) - } + }, ) .toList() } @@ -145,7 +145,7 @@ } else { "Unable to match API versions to Minecraft version" } - } + }, ).bindEnabled(useFabricApiProperty).component.foreground = JBColor.YELLOW comboBox } Index: src/main/kotlin/platform/architectury/framework/ArchitecturyGradleData.kt =================================================================== --- src/main/kotlin/platform/architectury/framework/ArchitecturyGradleData.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/architectury/framework/ArchitecturyGradleData.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -18,7 +18,7 @@ data class ArchitecturyGradleData( val module: ModuleData, - val moduleType: ArchitecturyModel.ModuleType + val moduleType: ArchitecturyModel.ModuleType, ) : AbstractExternalEntityData(module.owner) { companion object { val KEY = Key.create(ArchitecturyGradleData::class.java, ProjectKeys.TASK.processingWeight + 1) Index: src/main/kotlin/platform/architectury/framework/ArchitecturyPresentationProvider.kt =================================================================== --- src/main/kotlin/platform/architectury/framework/ArchitecturyPresentationProvider.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/architectury/framework/ArchitecturyPresentationProvider.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -18,7 +18,7 @@ import java.util.jar.JarFile class ArchitecturyPresentationProvider : LibraryPresentationProvider( - ARCHITECTURY_LIBRARY_KIND + ARCHITECTURY_LIBRARY_KIND, ) { override fun getIcon(properties: LibraryVersionProperties?) = PlatformAssets.ARCHITECTURY_ICON Index: src/main/kotlin/platform/bukkit/BukkitModule.kt =================================================================== --- src/main/kotlin/platform/bukkit/BukkitModule.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/bukkit/BukkitModule.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -20,6 +20,7 @@ import com.demonwav.mcdev.platform.bukkit.util.BukkitConstants import com.demonwav.mcdev.util.SourceType import com.demonwav.mcdev.util.addImplements +import com.demonwav.mcdev.util.createVoidMethodWithParameterType import com.demonwav.mcdev.util.extendsOrImplements import com.demonwav.mcdev.util.findContainingMethod import com.demonwav.mcdev.util.nullable @@ -27,13 +28,10 @@ import com.intellij.openapi.project.Project import com.intellij.psi.JavaPsiFacade import com.intellij.psi.PsiClass -import com.intellij.psi.PsiClassType import com.intellij.psi.PsiElement import com.intellij.psi.PsiLiteralExpression import com.intellij.psi.PsiMethod import com.intellij.psi.PsiMethodCallExpression -import com.intellij.psi.PsiType -import com.intellij.psi.search.GlobalSearchScope import org.jetbrains.uast.UClass import org.jetbrains.uast.UIdentifier import org.jetbrains.uast.toUElementOfType @@ -66,7 +64,7 @@ containingClass: PsiClass, chosenClass: PsiClass, chosenName: String, - data: GenerationData? + data: GenerationData?, ): PsiMethod? { val bukkitData = data as BukkitGenerationData @@ -75,7 +73,7 @@ chosenName, project, BukkitConstants.HANDLER_ANNOTATION, - bukkitData.isIgnoreCanceled + bukkitData.isIgnoreCanceled, ) ?: return null if (bukkitData.eventPriority != "NORMAL") { @@ -85,7 +83,7 @@ val value = JavaPsiFacade.getElementFactory(project) .createExpressionFromText( BukkitConstants.EVENT_PRIORITY_CLASS + "." + bukkitData.eventPriority, - annotation + annotation, ) annotation.setDeclaredAttributeValue("priority", value) @@ -147,12 +145,12 @@ expression.replace( JavaPsiFacade.getElementFactory(project).createExpressionFromText( "false", - expression + expression, + ), - ) + ) + }, - ) - } + ) + } - ) - } override fun shouldShowPluginIcon(element: PsiElement?): Boolean { val identifier = element?.toUElementOfType() @@ -180,19 +178,9 @@ chosenName: String, project: Project, annotationName: String, - setIgnoreCancelled: Boolean + setIgnoreCancelled: Boolean, ): PsiMethod? { - val newMethod = JavaPsiFacade.getElementFactory(project).createMethod(chosenName, PsiType.VOID) - - val list = newMethod.parameterList - val qName = chosenClass.qualifiedName ?: return null - val parameter = JavaPsiFacade.getElementFactory(project) - .createParameter( - "event", - PsiClassType.getTypeByName(qName, project, GlobalSearchScope.allScope(project)) - ) - list.add(parameter) - + val newMethod = createVoidMethodWithParameterType(project, chosenName, chosenClass) ?: return null val modifierList = newMethod.modifierList val annotation = modifierList.addAnnotation(annotationName) Index: src/main/kotlin/platform/bukkit/creator/LoadOrder.kt =================================================================== --- src/main/kotlin/platform/bukkit/creator/LoadOrder.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/bukkit/creator/LoadOrder.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -12,7 +12,8 @@ enum class LoadOrder(private val myName: String) { STARTUP("Startup"), - POSTWORLD("Post World"); + POSTWORLD("Post World"), + ; override fun toString() = myName } Index: src/main/kotlin/platform/bukkit/creator/asset-steps.kt =================================================================== --- src/main/kotlin/platform/bukkit/creator/asset-steps.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/bukkit/creator/asset-steps.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -110,7 +110,7 @@ } class BukkitPostBuildSystemStep( - parent: NewProjectWizardStep + parent: NewProjectWizardStep, ) : AbstractRunBuildSystemStep(parent, BukkitBuildSystemStep::class.java) { override val step = BuildSystemSupport.POST_STEP } Index: src/main/kotlin/platform/bukkit/creator/bukkit-platforms.kt =================================================================== --- src/main/kotlin/platform/bukkit/creator/bukkit-platforms.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/bukkit/creator/bukkit-platforms.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -20,11 +20,11 @@ override fun getRepositories(mcVersion: SemanticVersion) = listOf( BuildRepository( "spigotmc-repo", - "https://hub.spigotmc.org/nexus/content/repositories/snapshots/" + "https://hub.spigotmc.org/nexus/content/repositories/snapshots/", ), BuildRepository( "sonatype", - "https://oss.sonatype.org/content/groups/public/" + "https://oss.sonatype.org/content/groups/public/", ), ) @@ -35,8 +35,8 @@ "$mcVersion-R0.1-SNAPSHOT", mavenScope = "provided", gradleConfiguration = "compileOnly", + ), - ) + ) - ) class Factory : BukkitPlatformStep.Factory { override val name = "Spigot" @@ -49,11 +49,11 @@ override fun getRepositories(mcVersion: SemanticVersion) = listOf( BuildRepository( "papermc-repo", - "https://repo.papermc.io/repository/maven-public/" + "https://repo.papermc.io/repository/maven-public/", ), BuildRepository( "sonatype", - "https://oss.sonatype.org/content/groups/public/" + "https://oss.sonatype.org/content/groups/public/", ), ) @@ -68,9 +68,9 @@ "paper-api", "$mcVersion-R0.1-SNAPSHOT", mavenScope = "provided", - gradleConfiguration = "compileOnly" + gradleConfiguration = "compileOnly", + ), - ) + ) - ) } class Factory : BukkitPlatformStep.Factory { Index: src/main/kotlin/platform/bukkit/creator/gradle-steps.kt =================================================================== --- src/main/kotlin/platform/bukkit/creator/gradle-steps.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/bukkit/creator/gradle-steps.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -35,7 +35,7 @@ return when (step) { BuildSystemSupport.PRE_STEP -> BukkitGradleFilesStep(parent).chain( ::BukkitPatchBuildGradleStep, - ::GradleWrapperStep + ::GradleWrapperStep, ) BuildSystemSupport.POST_STEP -> GradleImportStep(parent).chain(::ReformatBuildGradleStep) else -> EmptyStep(parent) Index: src/main/kotlin/platform/bukkit/creator/ui-steps.kt =================================================================== --- src/main/kotlin/platform/bukkit/creator/ui-steps.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/bukkit/creator/ui-steps.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -43,7 +43,7 @@ import kotlinx.coroutines.coroutineScope class BukkitPlatformStep( - parent: PluginPlatformStep + parent: PluginPlatformStep, ) : AbstractNewProjectWizardMultiStep(parent, EP_NAME) { companion object { val EP_NAME = ExtensionPointName("com.demonwav.minecraft-dev.bukkitPlatformWizard") @@ -63,7 +63,7 @@ abstract class AbstractBukkitPlatformStep( parent: BukkitPlatformStep, - private val platform: PlatformType + private val platform: PlatformType, ) : AbstractLatentStep(parent) { override val description = "download versions" Index: src/main/kotlin/platform/bungeecord/BungeeCordModule.kt =================================================================== --- src/main/kotlin/platform/bungeecord/BungeeCordModule.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/bungeecord/BungeeCordModule.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -73,14 +73,14 @@ containingClass: PsiClass, chosenClass: PsiClass, chosenName: String, - data: GenerationData? + data: GenerationData?, ): PsiMethod? { val method = BukkitModule.generateBukkitStyleEventListenerMethod( chosenClass, chosenName, project, BungeeCordConstants.HANDLER_ANNOTATION, - false + false, ) ?: return null val generationData = data as BungeeCordGenerationData? ?: return method @@ -95,7 +95,7 @@ val value = JavaPsiFacade.getElementFactory(project) .createExpressionFromText( BungeeCordConstants.EVENT_PRIORITY_CLASS + "." + generationData.eventPriority, - annotation + annotation, ) annotation.setDeclaredAttributeValue("priority", value) Index: src/main/kotlin/platform/bungeecord/creator/asset-steps.kt =================================================================== --- src/main/kotlin/platform/bungeecord/creator/asset-steps.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/bungeecord/creator/asset-steps.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -50,22 +50,22 @@ if (authors.isNotEmpty()) { assets.addTemplateProperties( - "AUTHOR" to authors.joinToString(", ") + "AUTHOR" to authors.joinToString(", "), ) } if (description.isNotBlank()) { assets.addTemplateProperties( - "DESCRIPTION" to description + "DESCRIPTION" to description, ) } if (depend.isNotEmpty()) { assets.addTemplateProperties( - "DEPEND" to depend + "DEPEND" to depend, ) } if (softDepend.isNotEmpty()) { assets.addTemplateProperties( - "SOFT_DEPEND" to softDepend + "SOFT_DEPEND" to softDepend, ) } @@ -86,7 +86,7 @@ } class BungeePostBuildSystemStep( - parent: NewProjectWizardStep + parent: NewProjectWizardStep, ) : AbstractRunBuildSystemStep(parent, BungeeBuildSystemStep::class.java) { override val step = BuildSystemSupport.POST_STEP } Index: src/main/kotlin/platform/bungeecord/creator/bungee-platforms.kt =================================================================== --- src/main/kotlin/platform/bungeecord/creator/bungee-platforms.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/bungeecord/creator/bungee-platforms.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -17,7 +17,7 @@ class BungeeMainPlatformStep(parent: BungeePlatformStep) : AbstractBungeePlatformStep(parent, PlatformType.BUNGEECORD) { override fun getRepositories(mcVersion: SemanticVersion) = listOf( - BuildRepository("sonatype", "https://oss.sonatype.org/content/groups/public/") + BuildRepository("sonatype", "https://oss.sonatype.org/content/groups/public/"), ) override fun getDependencies(mcVersion: SemanticVersion) = listOf( @@ -26,9 +26,9 @@ "bungeecord-api", mcVersion.toString(), mavenScope = "provided", - gradleConfiguration = "compileOnly" + gradleConfiguration = "compileOnly", + ), - ) + ) - ) class Factory : BungeePlatformStep.Factory { override val name = "BungeeCord" @@ -42,7 +42,7 @@ BuildRepository("sonatype", "https://oss.sonatype.org/content/groups/public/"), BuildRepository( "papermc-repo", - "https://repo.papermc.io/repository/maven-public/" + "https://repo.papermc.io/repository/maven-public/", ), ) @@ -52,7 +52,7 @@ "waterfall-api", "$mcVersion-SNAPSHOT", mavenScope = "provided", - gradleConfiguration = "compileOnly" + gradleConfiguration = "compileOnly", ), ) Index: src/main/kotlin/platform/bungeecord/creator/gradle-steps.kt =================================================================== --- src/main/kotlin/platform/bungeecord/creator/gradle-steps.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/bungeecord/creator/gradle-steps.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -35,7 +35,7 @@ return when (step) { BuildSystemSupport.PRE_STEP -> BungeeGradleFilesStep(parent).chain( ::BungeePatchBuildGradleStep, - ::GradleWrapperStep + ::GradleWrapperStep, ) BuildSystemSupport.POST_STEP -> GradleImportStep(parent).chain(::ReformatBuildGradleStep) else -> EmptyStep(parent) Index: src/main/kotlin/platform/bungeecord/creator/ui-steps.kt =================================================================== --- src/main/kotlin/platform/bungeecord/creator/ui-steps.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/bungeecord/creator/ui-steps.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -38,7 +38,7 @@ import kotlinx.coroutines.coroutineScope class BungeePlatformStep( - parent: PluginPlatformStep + parent: PluginPlatformStep, ) : AbstractNewProjectWizardMultiStep(parent, EP_NAME) { companion object { val EP_NAME = ExtensionPointName("com.demonwav.minecraft-dev.bungeePlatformWizard") @@ -58,7 +58,7 @@ abstract class AbstractBungeePlatformStep( parent: BungeePlatformStep, - private val platform: PlatformType + private val platform: PlatformType, ) : AbstractLatentStep(parent) { override val description = "download versions" Index: src/main/kotlin/platform/fabric/EntryPoint.kt =================================================================== --- src/main/kotlin/platform/fabric/EntryPoint.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/fabric/EntryPoint.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -23,7 +23,7 @@ val type: Type, val className: String, val interfaceName: String, - val methodName: String? = null + val methodName: String? = null, ) { private val dumbReference = when (type) { Type.CLASS -> className Index: src/main/kotlin/platform/fabric/creator/asset-steps.kt =================================================================== --- src/main/kotlin/platform/fabric/creator/asset-steps.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/fabric/creator/asset-steps.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -222,7 +222,7 @@ // find the class, and create it if it doesn't exist val clazz = JavaPsiFacade.getInstance(project).findClass( entryPoint.className, - GlobalSearchScope.projectScope(project) + GlobalSearchScope.projectScope(project), ) ?: run { val packageName = entryPoint.className.substringBeforeLast('.', missingDelimiterValue = "") val className = entryPoint.className.substringAfterLast('.') @@ -236,12 +236,12 @@ val message = MCDevBundle.message( "intention.error.cannot.create.class.message", className, - e.localizedMessage + e.localizedMessage, ) Messages.showErrorDialog( project, message, - MCDevBundle.message("intention.error.cannot.create.class.title") + MCDevBundle.message("intention.error.cannot.create.class.title"), ) } return @@ -289,7 +289,7 @@ } class FabricPostBuildSystemStep( - parent: NewProjectWizardStep + parent: NewProjectWizardStep, ) : AbstractRunBuildSystemStep(parent, FabricBuildSystemStep::class.java) { override val step = BuildSystemSupport.POST_STEP } Index: src/main/kotlin/platform/fabric/creator/ui-steps.kt =================================================================== --- src/main/kotlin/platform/fabric/creator/ui-steps.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/fabric/creator/ui-steps.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -50,7 +50,7 @@ import kotlinx.coroutines.coroutineScope class FabricPlatformStep( - parent: ModPlatformStep + parent: ModPlatformStep, ) : AbstractLatentStep>(parent) { override val description = "download Fabric versions" @@ -86,7 +86,7 @@ class FabricVersionChainStep( parent: NewProjectWizardStep, private val fabricVersions: FabricVersions, - private val apiVersions: FabricApiVersions + private val apiVersions: FabricApiVersions, ) : AbstractMcVersionChainStep(parent, "Loader Version:", "Yarn Version:", "API Version:") { companion object { private const val LOADER_VERSION = 1 @@ -135,7 +135,7 @@ } else { "Unable to match Yarn versions to Minecraft version" } - } + }, ).component.foreground = JBColor.YELLOW comboBox } @@ -151,7 +151,7 @@ } else { "Unable to match API versions to Minecraft version" } - } + }, ).bindEnabled(useApiProperty).component.foreground = JBColor.YELLOW comboBox } @@ -235,7 +235,7 @@ "Server" -> Side.SERVER else -> Side.NONE } - }) + },), ) } } @@ -256,6 +256,6 @@ override fun createStep() = DescriptionStep(this).chain( ::AuthorsStep, ::WebsiteStep, - ::RepositoryStep + ::RepositoryStep, ) } Index: src/main/kotlin/platform/fabric/inspection/UnresolvedReferenceInspection.kt =================================================================== --- src/main/kotlin/platform/fabric/inspection/UnresolvedReferenceInspection.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/fabric/inspection/UnresolvedReferenceInspection.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -53,7 +53,7 @@ literal, "Cannot resolve ${reference.description}".format(reference.canonicalText), ProblemHighlightType.LIKE_UNKNOWN_SYMBOL, - reference.rangeInElement + reference.rangeInElement, ) } } Index: src/main/kotlin/platform/fabric/reference/EntryPointReference.kt =================================================================== --- src/main/kotlin/platform/fabric/reference/EntryPointReference.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/fabric/reference/EntryPointReference.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -49,9 +49,9 @@ element, range.cutOut(TextRange.from(cursor, clazzPart.length)), innerClassDepth, - false + false, + ), - ) + ) - ) cursor += clazzPart.length } if (methodParts.size == 2) { @@ -61,9 +61,9 @@ element, range.cutOut(TextRange.from(cursor, methodParts[1].length)), innerClassDepth, - true + true, + ), - ) + ) - ) } return references.toTypedArray() } @@ -71,7 +71,7 @@ private fun resolveReference( element: JsonStringLiteral, innerClassDepth: Int, - isMethodReference: Boolean + isMethodReference: Boolean, ): Array { val strReference = element.value val methodParts = strReference.split("::", limit = 2) @@ -81,7 +81,9 @@ if (innerClassDepth >= clazzParts.size || innerClassDepth + 1 < clazzParts.size && isMethodReference - ) throw IncorrectOperationException("Invalid reference") + ) { + throw IncorrectOperationException("Invalid reference") + } var clazz = JavaPsiFacade.getInstance(element.project).findClass(clazzParts[0], element.resolveScope) ?: return PsiElement.EMPTY_ARRAY // if class is inner class, then a dot "." was used as separator instead of a dollar sign "$", this does not work to reference an inner class @@ -112,7 +114,7 @@ element: JsonStringLiteral, range: TextRange, private val innerClassDepth: Int, - private val isMethodReference: Boolean + private val isMethodReference: Boolean, ) : PsiReferenceBase(element, range), PsiPolyVariantReference, Index: src/main/kotlin/platform/fabric/reference/FabricReferenceContributor.kt =================================================================== --- src/main/kotlin/platform/fabric/reference/FabricReferenceContributor.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/fabric/reference/FabricReferenceContributor.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -28,24 +28,24 @@ PlatformPatterns.psiElement(JsonArray::class.java) .withSuperParent( 2, - PlatformPatterns.psiElement(JsonObject::class.java).isPropertyValue("entrypoints") + PlatformPatterns.psiElement(JsonObject::class.java).isPropertyValue("entrypoints"), + ), - ) + ) - ) registrar.registerReferenceProvider(entryPointPattern, EntryPointReference) val mixinConfigPattern = stringInModJson.withParent( - PlatformPatterns.psiElement(JsonArray::class.java).isPropertyValue("mixins") + PlatformPatterns.psiElement(JsonArray::class.java).isPropertyValue("mixins"), ) registrar.registerReferenceProvider(mixinConfigPattern, ResourceFileReference("mixin config '%s'")) registrar.registerReferenceProvider( stringInModJson.isPropertyValue("accessWidener"), - ResourceFileReference("access widener '%s'") + ResourceFileReference("access widener '%s'"), ) registrar.registerReferenceProvider( stringInModJson.isPropertyValue("icon"), - ResourceFileReference("icon '%s'") + ResourceFileReference("icon '%s'"), ) registrar.registerReferenceProvider(stringInModJson.isPropertyValue("license"), LicenseReference) Index: src/main/kotlin/platform/forge/ForgeModule.kt =================================================================== --- src/main/kotlin/platform/forge/ForgeModule.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/forge/ForgeModule.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -21,6 +21,7 @@ import com.demonwav.mcdev.platform.mcp.McpModuleSettings import com.demonwav.mcdev.util.SemanticVersion import com.demonwav.mcdev.util.SourceType +import com.demonwav.mcdev.util.createVoidMethodWithParameterType import com.demonwav.mcdev.util.extendsOrImplements import com.demonwav.mcdev.util.nullable import com.demonwav.mcdev.util.runWriteTaskLater @@ -32,11 +33,9 @@ import com.intellij.openapi.project.DumbService import com.intellij.psi.JavaPsiFacade import com.intellij.psi.PsiClass -import com.intellij.psi.PsiClassType import com.intellij.psi.PsiElement import com.intellij.psi.PsiMethod import com.intellij.psi.PsiMethodCallExpression -import com.intellij.psi.PsiType import com.intellij.psi.search.GlobalSearchScope import com.intellij.psi.search.searches.AnnotatedElementsSearch import org.jetbrains.uast.UClass @@ -117,7 +116,7 @@ return formatWrongEventMessage( ForgeConstants.EVENTBUS_EVENT, ForgeConstants.EVENTBUS_SUBSCRIBE_EVENT_ANNOTATION, - ForgeConstants.EVENTBUS_EVENT == eventClass.qualifiedName + ForgeConstants.EVENTBUS_EVENT == eventClass.qualifiedName, ) } @@ -127,14 +126,14 @@ return formatWrongEventMessage( ForgeConstants.FML_EVENT, ForgeConstants.SUBSCRIBE_EVENT_ANNOTATION, - ForgeConstants.EVENT == eventClass.qualifiedName + ForgeConstants.EVENT == eventClass.qualifiedName, ) } return formatWrongEventMessage( ForgeConstants.EVENT, ForgeConstants.EVENT_HANDLER_ANNOTATION, - ForgeConstants.FML_EVENT == eventClass.qualifiedName + ForgeConstants.FML_EVENT == eventClass.qualifiedName, ) } @@ -152,21 +151,11 @@ containingClass: PsiClass, chosenClass: PsiClass, chosenName: String, - data: GenerationData? + data: GenerationData?, ): PsiMethod? { val isFmlEvent = chosenClass.extendsOrImplements(ForgeConstants.FML_EVENT) - val method = JavaPsiFacade.getElementFactory(project).createMethod(chosenName, PsiType.VOID) - val parameterList = method.parameterList - - val qName = chosenClass.qualifiedName ?: return null - val parameter = JavaPsiFacade.getElementFactory(project) - .createParameter( - "event", - PsiClassType.getTypeByName(qName, project, GlobalSearchScope.allScope(project)) - ) - - parameterList.add(parameter) + val method = createVoidMethodWithParameterType(project, chosenName, chosenClass) ?: return null val modifierList = method.modifierList if (isFmlEvent) { Index: src/main/kotlin/platform/forge/ForgeModuleType.kt =================================================================== --- src/main/kotlin/platform/forge/ForgeModuleType.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/forge/ForgeModuleType.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -26,12 +26,12 @@ ForgeConstants.MOD_ANNOTATION, ForgeConstants.EVENT_HANDLER_ANNOTATION, ForgeConstants.SUBSCRIBE_EVENT_ANNOTATION, - ForgeConstants.EVENTBUS_SUBSCRIBE_EVENT_ANNOTATION + ForgeConstants.EVENTBUS_SUBSCRIBE_EVENT_ANNOTATION, ) private val LISTENER_ANNOTATIONS = listOf( ForgeConstants.EVENT_HANDLER_ANNOTATION, ForgeConstants.SUBSCRIBE_EVENT_ANNOTATION, - ForgeConstants.EVENTBUS_SUBSCRIBE_EVENT_ANNOTATION + ForgeConstants.EVENTBUS_SUBSCRIBE_EVENT_ANNOTATION, ) override val platformType = PlatformType.FORGE Index: src/main/kotlin/platform/forge/creator/asset-steps.kt =================================================================== --- src/main/kotlin/platform/forge/creator/asset-steps.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/forge/creator/asset-steps.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -133,7 +133,7 @@ } class ForgePostBuildSystemStep( - parent: NewProjectWizardStep + parent: NewProjectWizardStep, ) : AbstractRunBuildSystemStep(parent, ForgeBuildSystemStep::class.java) { override val step = BuildSystemSupport.POST_STEP } Index: src/main/kotlin/platform/forge/creator/gradle-steps.kt =================================================================== --- src/main/kotlin/platform/forge/creator/gradle-steps.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/forge/creator/gradle-steps.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -123,7 +123,7 @@ WriteAction.runAndWait { val dir = VfsUtil.createDirectoryIfMissing( LocalFileSystem.getInstance(), - "${assets.outputDirectory}/.gradle" + "${assets.outputDirectory}/.gradle", ) ?: throw IllegalStateException("Unable to create .gradle directory") val file = dir.findOrCreateChildData(this, MAGIC_RUN_CONFIGS_FILE) Index: src/main/kotlin/platform/forge/creator/ui-steps.kt =================================================================== --- src/main/kotlin/platform/forge/creator/ui-steps.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/forge/creator/ui-steps.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -64,7 +64,7 @@ class ForgeVersionChainStep( parent: NewProjectWizardStep, - private val forgeVersionData: ForgeVersion + private val forgeVersionData: ForgeVersion, ) : AbstractMcVersionChainStep(parent, "Forge Version:") { companion object { private const val FORGE_VERSION = 1 @@ -94,6 +94,6 @@ override fun createStep() = DescriptionStep(this).chain( ::AuthorsStep, ::WebsiteStep, - ::UpdateUrlStep + ::UpdateUrlStep, ) } Index: src/main/kotlin/platform/forge/gradle/ForgeRunConfigDataService.kt =================================================================== --- src/main/kotlin/platform/forge/gradle/ForgeRunConfigDataService.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/forge/gradle/ForgeRunConfigDataService.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -49,7 +49,7 @@ toImport: Collection>, projectData: ProjectData?, project: Project, - modelsProvider: IdeModifiableModelsProvider + modelsProvider: IdeModifiableModelsProvider, ) { if (projectData == null || projectData.owner != GradleConstants.SYSTEM_ID) { return @@ -88,7 +88,7 @@ private fun manualCreate( project: Project, moduleMap: Map, - module: Module + module: Module, ) { invokeLater { val mainModule = findMainModule(moduleMap, module) @@ -137,7 +137,7 @@ moduleMap: Map, module: Module, task: String, - hasData: Boolean + hasData: Boolean, ) { val mainModule = findMainModule(moduleMap, module) @@ -155,7 +155,7 @@ cleanupGeneratedRuns(project, mainModule, hasData) } - } + }, ) } Index: src/main/kotlin/platform/forge/inspections/sideonly/FieldDeclarationSideOnlyInspection.kt =================================================================== --- src/main/kotlin/platform/forge/inspections/sideonly/FieldDeclarationSideOnlyInspection.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/forge/inspections/sideonly/FieldDeclarationSideOnlyInspection.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -68,7 +68,7 @@ Error.CLASS_CROSS_ANNOTATED, fieldAnnotation.renderSide(fieldSide), classAnnotation.renderSide(classSide), - field.getAnnotation(fieldAnnotation.annotationName) + field.getAnnotation(fieldAnnotation.annotationName), ) } else if (classSide !== Side.NONE) { registerFieldError(field, Error.CLASS_UNANNOTATED, fieldAnnotation, null, field) @@ -98,7 +98,7 @@ Error.FIELD_CROSS_ANNOTATED, fieldClassAnnotation.renderSide(fieldClassSide), fieldAnnotation.renderSide(fieldSide), - field.getAnnotation(fieldAnnotation.annotationName) + field.getAnnotation(fieldAnnotation.annotationName), ) } } @@ -120,7 +120,7 @@ override fun getErrorString(vararg infos: Any): String { return "Field with type annotation ${infos[0]} cannot be declared as ${infos[1]}." } - }; + }, ; abstract fun getErrorString(vararg infos: Any): String } Index: src/main/kotlin/platform/forge/inspections/sideonly/LocalVariableDeclarationSideOnlyInspection.kt =================================================================== --- src/main/kotlin/platform/forge/inspections/sideonly/LocalVariableDeclarationSideOnlyInspection.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/forge/inspections/sideonly/LocalVariableDeclarationSideOnlyInspection.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -39,7 +39,7 @@ return if (annotation.isWritable) { RemoveAnnotationInspectionGadgetsFix( annotation, - "Remove @SideOnly annotation from variable class declaration" + "Remove @SideOnly annotation from variable class declaration", ) } else { null @@ -78,7 +78,7 @@ Error.VAR_CROSS_ANNOTATED_CLASS, variableAnnotation.renderSide(variableSide), containingClassAnnotation.renderSide(containingClassSide), - variableClass.getAnnotation(variableAnnotation.annotationName) + variableClass.getAnnotation(variableAnnotation.annotationName), ) } classAnnotated = true @@ -96,7 +96,7 @@ Error.VAR_UNANNOTATED_METHOD, variableAnnotation.renderSide(variableSide), methodAnnotation.renderSide(methodSide), - variableClass.getAnnotation(variableAnnotation.annotationName) + variableClass.getAnnotation(variableAnnotation.annotationName), ) } } else { @@ -105,7 +105,7 @@ Error.VAR_CROSS_ANNOTATED_METHOD, variableAnnotation.renderSide(variableSide), methodAnnotation.renderSide(methodSide), - variableClass.getAnnotation(variableAnnotation.annotationName) + variableClass.getAnnotation(variableAnnotation.annotationName), ) } } @@ -131,7 +131,7 @@ return "A local variable whose class is annotated with ${infos[0]} " + "cannot be used in an un-annotated method." } - }; + }, ; abstract fun getErrorString(vararg infos: Any): String } Index: src/main/kotlin/platform/forge/inspections/sideonly/MethodCallSideOnlyInspection.kt =================================================================== --- src/main/kotlin/platform/forge/inspections/sideonly/MethodCallSideOnlyInspection.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/forge/inspections/sideonly/MethodCallSideOnlyInspection.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -114,7 +114,7 @@ Error.ANNOTATED_CLASS_METHOD_IN_CROSS_ANNOTATED_CLASS_METHOD, elementAnnotation.renderSide(elementSide), classAnnotation.renderSide(classSide), - declaration.getAnnotation(elementAnnotation.annotationName) + declaration.getAnnotation(elementAnnotation.annotationName), ) } else { registerError( @@ -122,7 +122,7 @@ Error.ANNOTATED_METHOD_IN_CROSS_ANNOTATED_CLASS_METHOD, elementAnnotation.renderSide(elementSide), classAnnotation.renderSide(classSide), - declaration.getAnnotation(elementAnnotation.annotationName) + declaration.getAnnotation(elementAnnotation.annotationName), ) } } @@ -143,7 +143,7 @@ Error.ANNOTATED_CLASS_METHOD_IN_UNANNOTATED_METHOD, elementAnnotation.renderSide(elementSide), null, - declaration.getAnnotation(elementAnnotation.annotationName) + declaration.getAnnotation(elementAnnotation.annotationName), ) } else { registerError( @@ -151,7 +151,7 @@ Error.ANNOTATED_METHOD_IN_UNANNOTATED_METHOD, elementAnnotation.renderSide(elementSide), null, - declaration.getAnnotation(elementAnnotation.annotationName) + declaration.getAnnotation(elementAnnotation.annotationName), ) } } @@ -162,7 +162,7 @@ Error.ANNOTATED_CLASS_METHOD_IN_CROSS_ANNOTATED_METHOD, elementAnnotation.renderSide(elementSide), methodAnnotation.renderSide(methodSide), - declaration.getAnnotation(elementAnnotation.annotationName) + declaration.getAnnotation(elementAnnotation.annotationName), ) } else { registerError( @@ -170,7 +170,7 @@ Error.ANNOTATED_METHOD_IN_CROSS_ANNOTATED_METHOD, elementAnnotation.renderSide(elementSide), methodAnnotation.renderSide(methodSide), - declaration.getAnnotation(elementAnnotation.annotationName) + declaration.getAnnotation(elementAnnotation.annotationName), ) } } @@ -214,7 +214,7 @@ return "Method declared in a class annotated with " + infos[0] + " cannot be referenced in a class annotated with " + infos[1] + "." } - }; + }, ; abstract fun getErrorString(vararg infos: Any): String } Index: src/main/kotlin/platform/forge/inspections/sideonly/MethodSideOnlyInspection.kt =================================================================== --- src/main/kotlin/platform/forge/inspections/sideonly/MethodSideOnlyInspection.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/forge/inspections/sideonly/MethodSideOnlyInspection.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -72,7 +72,7 @@ Error.RETURN_TYPE_ON_WRONG_METHOD, methodAnnotation.renderSide(methodSide), returnAnnotation.renderSide(returnSide), - method.getAnnotation(methodAnnotation.annotationName) + method.getAnnotation(methodAnnotation.annotationName), ) } @@ -88,7 +88,7 @@ Error.METHOD_IN_WRONG_CLASS, methodAnnotation.renderSide(methodSide), classAnnotation.renderSide(classSide), - method.getAnnotation(methodAnnotation.annotationName) + method.getAnnotation(methodAnnotation.annotationName), ) } if (returnAnnotation != null && returnSide !== Side.NONE && returnSide !== Side.INVALID) { @@ -98,7 +98,7 @@ Error.RETURN_TYPE_IN_WRONG_CLASS, classAnnotation.renderSide(classSide), returnAnnotation.renderSide(returnSide), - method.getAnnotation(methodAnnotation.annotationName) + method.getAnnotation(methodAnnotation.annotationName), ) } } @@ -127,7 +127,7 @@ return "Method in a class annotated with " + infos[0] + " cannot return a type annotated with " + infos[1] + "." } - }; + }, ; abstract fun getErrorString(vararg infos: Any): String } Index: src/main/kotlin/platform/forge/inspections/sideonly/Side.kt =================================================================== --- src/main/kotlin/platform/forge/inspections/sideonly/Side.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/forge/inspections/sideonly/Side.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -17,7 +17,8 @@ CLIENT, SERVER, NONE, - INVALID; + INVALID, + ; companion object { val KEY = Key("MC_DEV_SIDE") Index: src/main/kotlin/platform/forge/inspections/sideonly/SideAnnotation.kt =================================================================== --- src/main/kotlin/platform/forge/inspections/sideonly/SideAnnotation.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/forge/inspections/sideonly/SideAnnotation.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -36,25 +36,25 @@ "net.minecraftforge.fml.relauncher.SideOnly", "net.minecraftforge.fml.relauncher.Side", "CLIENT", - "SERVER" + "SERVER", ), SideAnnotation( "cpw.mods.fml.relauncher.SideOnly", "cpw.mods.fml.relauncher.Side", "CLIENT", - "SERVER" + "SERVER", ), SideAnnotation( "net.minecraftforge.api.distmarker.OnlyIn", "net.minecraftforge.api.distmarker.Dist", "CLIENT", - "DEDICATED_SERVER" + "DEDICATED_SERVER", ), SideAnnotation( "net.fabricmc.api.Environment", "net.fabricmc.api.EnvType", "CLIENT", - "SERVER" + "SERVER", ), ) } Index: src/main/kotlin/platform/forge/inspections/sideonly/SidedProxyAnnotator.kt =================================================================== --- src/main/kotlin/platform/forge/inspections/sideonly/SidedProxyAnnotator.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/forge/inspections/sideonly/SidedProxyAnnotator.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -75,7 +75,7 @@ text = JavaConstantExpressionEvaluator.computeConstantExpression( resolve.initializer, null, - false + false, ) as? String ?: return } else { return Index: src/main/kotlin/platform/forge/inspections/sideonly/VariableUseSideOnlyInspection.kt =================================================================== --- src/main/kotlin/platform/forge/inspections/sideonly/VariableUseSideOnlyInspection.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/forge/inspections/sideonly/VariableUseSideOnlyInspection.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -75,7 +75,7 @@ Error.ANNOTATED_CLASS_VAR_IN_CROSS_ANNOTATED_CLASS_METHOD, elementAnnotation.renderSide(elementSide), classAnnotation.renderSide(classSide), - declaration.getAnnotation(elementAnnotation.annotationName) + declaration.getAnnotation(elementAnnotation.annotationName), ) } else { registerError( @@ -83,7 +83,7 @@ Error.ANNOTATED_VAR_IN_CROSS_ANNOTATED_CLASS_METHOD, elementAnnotation.renderSide(elementSide), classAnnotation.renderSide(classSide), - declaration.getAnnotation(elementAnnotation.annotationName) + declaration.getAnnotation(elementAnnotation.annotationName), ) } } @@ -104,7 +104,7 @@ Error.ANNOTATED_CLASS_VAR_IN_UNANNOTATED_METHOD, elementAnnotation.renderSide(elementSide), null, - declaration.getAnnotation(elementAnnotation.annotationName) + declaration.getAnnotation(elementAnnotation.annotationName), ) } else { registerError( @@ -112,7 +112,7 @@ Error.ANNOTATED_VAR_IN_UNANNOTATED_METHOD, elementAnnotation.renderSide(elementSide), null, - declaration.getAnnotation(elementAnnotation.annotationName) + declaration.getAnnotation(elementAnnotation.annotationName), ) } } @@ -123,7 +123,7 @@ Error.ANNOTATED_CLASS_VAR_IN_CROSS_ANNOTATED_METHOD, elementAnnotation.renderSide(elementSide), methodAnnotation.renderSide(methodSide), - declaration.getAnnotation(elementAnnotation.annotationName) + declaration.getAnnotation(elementAnnotation.annotationName), ) } else { registerError( @@ -131,7 +131,7 @@ Error.ANNOTATED_VAR_IN_CROSS_ANNOTATED_METHOD, elementAnnotation.renderSide(elementSide), methodAnnotation.renderSide(methodSide), - declaration.getAnnotation(elementAnnotation.annotationName) + declaration.getAnnotation(elementAnnotation.annotationName), ) } } @@ -175,7 +175,7 @@ return "Variable declared in a class annotated with ${infos[0]}" + " cannot be referenced in a class annotated with ${infos[1]}." } - }; + }, ; abstract fun getErrorString(vararg infos: Any): String } Index: src/main/kotlin/platform/forge/reflection/reference/ReflectedFieldReference.kt =================================================================== --- src/main/kotlin/platform/forge/reflection/reference/ReflectedFieldReference.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/forge/reflection/reference/ReflectedFieldReference.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -21,17 +21,11 @@ import com.intellij.openapi.application.runWriteAction import com.intellij.openapi.command.CommandProcessor import com.intellij.psi.JavaPsiFacade -import com.intellij.psi.PsiClass -import com.intellij.psi.PsiClassObjectAccessExpression -import com.intellij.psi.PsiClassType import com.intellij.psi.PsiElement -import com.intellij.psi.PsiElementResolveResult import com.intellij.psi.PsiExpressionList import com.intellij.psi.PsiLiteral import com.intellij.psi.PsiReference -import com.intellij.psi.PsiReferenceBase import com.intellij.psi.PsiReferenceProvider -import com.intellij.psi.ResolveResult import com.intellij.psi.codeStyle.CodeStyleManager import com.intellij.util.ProcessingContext @@ -44,10 +38,13 @@ return arrayOf(Reference(element as PsiLiteral)) } - class Reference(element: PsiLiteral) : PsiReferenceBase.Poly(element) { + class Reference(element: PsiLiteral) : ReflectedMemberReferenceBasePoly(element) { val fieldName get() = element.constantStringValue ?: "" + override val memberName: String + get() = fieldName + override fun getVariants(): Array { val typeClass = findReferencedClass() ?: return arrayOf() @@ -76,7 +73,7 @@ val elementFactory = JavaPsiFacade.getElementFactory(context.project) val srgLiteral = elementFactory.createExpressionFromText( "\"${srgField.name}\"", - literal.parent + literal.parent, ) literal.replace(srgLiteral) @@ -90,27 +87,5 @@ } .toTypedArray() } - - override fun multiResolve(incompleteCode: Boolean): Array { - val typeClass = findReferencedClass() ?: return arrayOf() - - val name = fieldName - val srgManager = element.findModule()?.let { MinecraftFacet.getInstance(it) } - ?.getModuleOfType(McpModuleType)?.srgManager - val srgMap = srgManager?.srgMapNow - val mcpName = srgMap?.mapMcpToSrgName(name) ?: name - - return typeClass.allFields.asSequence() - .filter { it.name == mcpName } - .map(::PsiElementResolveResult) - .toTypedArray() - } + } - - private fun findReferencedClass(): PsiClass? { - val callParams = element.parent as? PsiExpressionList - val classRef = callParams?.expressions?.first() as? PsiClassObjectAccessExpression - val type = classRef?.operand?.type as? PsiClassType - return type?.resolve() - } +} - } -} Index: src/main/kotlin/platform/forge/reflection/reference/ReflectedMemberReferenceBasePoly.kt =================================================================== --- src/main/kotlin/platform/forge/reflection/reference/ReflectedMemberReferenceBasePoly.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) +++ src/main/kotlin/platform/forge/reflection/reference/ReflectedMemberReferenceBasePoly.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -0,0 +1,51 @@ +/* + * Minecraft Dev for IntelliJ + * + * https://minecraftdev.org + * + * Copyright (c) 2023 minecraft-dev + * + * MIT License + */ + +package com.demonwav.mcdev.platform.forge.reflection.reference + +import com.demonwav.mcdev.facet.MinecraftFacet +import com.demonwav.mcdev.platform.mcp.McpModuleType +import com.demonwav.mcdev.util.findModule +import com.demonwav.mcdev.util.toTypedArray +import com.intellij.psi.PsiClass +import com.intellij.psi.PsiClassObjectAccessExpression +import com.intellij.psi.PsiClassType +import com.intellij.psi.PsiElementResolveResult +import com.intellij.psi.PsiExpressionList +import com.intellij.psi.PsiLiteral +import com.intellij.psi.PsiReferenceBase +import com.intellij.psi.ResolveResult + +abstract class ReflectedMemberReferenceBasePoly(element: PsiLiteral) : PsiReferenceBase.Poly(element) { + + abstract val memberName: String + + protected fun findReferencedClass(): PsiClass? { + val callParams = element.parent as? PsiExpressionList + val classRef = callParams?.expressions?.first() as? PsiClassObjectAccessExpression + val type = classRef?.operand?.type as? PsiClassType + return type?.resolve() + } + + override fun multiResolve(incompleteCode: Boolean): Array { + val typeClass = findReferencedClass() ?: return arrayOf() + + val name = memberName + val srgManager = element.findModule()?.let { MinecraftFacet.getInstance(it) } + ?.getModuleOfType(McpModuleType)?.srgManager + val srgMap = srgManager?.srgMapNow + val mcpName = srgMap?.mapMcpToSrgName(name) ?: name + + return typeClass.allFields.asSequence() + .filter { it.name == mcpName } + .map(::PsiElementResolveResult) + .toTypedArray() + } +} Index: src/main/kotlin/platform/forge/reflection/reference/ReflectedMethodReference.kt =================================================================== --- src/main/kotlin/platform/forge/reflection/reference/ReflectedMethodReference.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/forge/reflection/reference/ReflectedMethodReference.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -21,18 +21,12 @@ import com.intellij.openapi.application.runWriteAction import com.intellij.openapi.command.CommandProcessor import com.intellij.psi.JavaPsiFacade -import com.intellij.psi.PsiClass -import com.intellij.psi.PsiClassObjectAccessExpression -import com.intellij.psi.PsiClassType import com.intellij.psi.PsiElement -import com.intellij.psi.PsiElementResolveResult import com.intellij.psi.PsiExpressionList import com.intellij.psi.PsiLiteral import com.intellij.psi.PsiReference -import com.intellij.psi.PsiReferenceBase import com.intellij.psi.PsiReferenceProvider import com.intellij.psi.PsiSubstitutor -import com.intellij.psi.ResolveResult import com.intellij.psi.codeStyle.CodeStyleManager import com.intellij.psi.codeStyle.JavaCodeStyleManager import com.intellij.psi.util.MethodSignatureUtil @@ -48,10 +42,13 @@ return arrayOf(Reference(element as PsiLiteral)) } - class Reference(element: PsiLiteral) : PsiReferenceBase.Poly(element) { + class Reference(element: PsiLiteral) : ReflectedMemberReferenceBasePoly(element) { val methodName get() = element.constantStringValue ?: "" + override val memberName: String + get() = methodName + val expressionList get() = element.parent as PsiExpressionList @@ -89,7 +86,7 @@ val elementFactory = JavaPsiFacade.getElementFactory(context.project) val srgLiteral = elementFactory.createExpressionFromText( "\"${srgMethod.name}\"", - params + params, ) if (params.expressionCount > 1) { @@ -103,14 +100,14 @@ } val returnTypeRef = elementFactory.createExpressionFromText( "$returnType.class", - params + params, ) params.add(returnTypeRef) for (paramType in paramTypes) { val paramTypeRef = elementFactory.createExpressionFromText( "$paramType.class", - params + params, ) params.add(paramTypeRef) } @@ -126,27 +123,5 @@ } .toTypedArray() } - - override fun multiResolve(incompleteCode: Boolean): Array { - val typeClass = findReferencedClass() ?: return arrayOf() - - val name = methodName - val srgManager = element.findModule()?.let { MinecraftFacet.getInstance(it) } - ?.getModuleOfType(McpModuleType)?.srgManager - val srgMap = srgManager?.srgMapNow - val mcpName = srgMap?.mapMcpToSrgName(name) ?: name - - return typeClass.allMethods.asSequence() - .filter { it.name == mcpName } - .map(::PsiElementResolveResult) - .toTypedArray() - } + } - - private fun findReferencedClass(): PsiClass? { - val callParams = element.parent as? PsiExpressionList - val classRef = callParams?.expressions?.first() as? PsiClassObjectAccessExpression - val type = classRef?.operand?.type as? PsiClassType - return type?.resolve() - } +} - } -} Index: src/main/kotlin/platform/forge/reflection/reference/ReflectionReferenceContributor.kt =================================================================== --- src/main/kotlin/platform/forge/reflection/reference/ReflectionReferenceContributor.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/forge/reflection/reference/ReflectionReferenceContributor.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -21,17 +21,17 @@ PsiJavaPatterns.psiLiteral(StandardPatterns.string()) .and( PsiJavaPatterns.psiElement() - .methodCallParameter(PsiJavaPatterns.psiMethod().withName("findField")) + .methodCallParameter(PsiJavaPatterns.psiMethod().withName("findField")), ), - ReflectedFieldReference + ReflectedFieldReference, ) registrar.registerReferenceProvider( PsiJavaPatterns.psiLiteral(StandardPatterns.string()) .and( PsiJavaPatterns.psiElement() - .methodCallParameter(PsiJavaPatterns.psiMethod().withName("findMethod")) + .methodCallParameter(PsiJavaPatterns.psiMethod().withName("findMethod")), ), - ReflectedMethodReference + ReflectedMethodReference, ) } } Index: src/main/kotlin/platform/forge/util/ForgePackDescriptor.kt =================================================================== --- src/main/kotlin/platform/forge/util/ForgePackDescriptor.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/forge/util/ForgePackDescriptor.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -21,21 +21,21 @@ "A pack_format of 3 should be used starting with Minecraft 1.11." + " All resources, including language files, should be lowercase (eg: en_us.lang)." + " A pack_format of 2 will load your mod resources with LegacyV2Adapter," + - " which requires language files to have uppercase letters (eg: en_US.lang)." + " which requires language files to have uppercase letters (eg: en_US.lang).", ) val FORMAT_4 = ForgePackDescriptor( 4, - "A pack_format of 4 requires json lang files. Note: we require v4 pack meta for all mods." + "A pack_format of 4 requires json lang files. Note: we require v4 pack meta for all mods.", ) val FORMAT_5 = ForgePackDescriptor( 5, "A pack_format of 5 requires json lang files and some texture changes from 1.15." + - " Note: we require v5 pack meta for all mods." + " Note: we require v5 pack meta for all mods.", ) val FORMAT_6 = ForgePackDescriptor( 6, "A pack_format of 6 requires json lang files and some texture changes from 1.16.2." + - " Note: we require v6 pack meta for all mods." + " Note: we require v6 pack meta for all mods.", ) val FORMAT_7 = ForgePackDescriptor(7, "") val FORMAT_8 = ForgePackDescriptor(8, "") Index: src/main/kotlin/platform/forge/version/ForgeVersion.kt =================================================================== --- src/main/kotlin/platform/forge/version/ForgeVersion.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/forge/version/ForgeVersion.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -32,7 +32,7 @@ return null } return version.substring(0, index) - } + }, ).distinct() .toList() return@lazy sortVersions(unsortedVersions) Index: src/main/kotlin/platform/mcp/McpModuleSettings.kt =================================================================== --- src/main/kotlin/platform/mcp/McpModuleSettings.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mcp/McpModuleSettings.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -26,7 +26,7 @@ var mcpVersion: String? = null, var mappingFile: String? = null, var srgType: SrgType? = null, - var platformVersion: String? = null + var platformVersion: String? = null, ) private var state: State = State(srgType = SrgType.SRG) Index: src/main/kotlin/platform/mcp/actions/CopyAtAction.kt =================================================================== --- src/main/kotlin/platform/mcp/actions/CopyAtAction.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mcp/actions/CopyAtAction.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -31,7 +31,7 @@ copyToClipboard( data.editor, data.element, - classSrg + " " + srg.name + " # " + parent.name + classSrg + " " + srg.name + " # " + parent.name, ) } is PsiMethod -> { @@ -41,7 +41,7 @@ copyToClipboard( data.editor, data.element, - classSrg + " " + srg.name + srg.descriptor + " # " + parent.name + classSrg + " " + srg.name + srg.descriptor + " # " + parent.name, ) } is PsiClass -> { Index: src/main/kotlin/platform/mcp/actions/CopyCoremodTargetAction.kt =================================================================== --- src/main/kotlin/platform/mcp/actions/CopyCoremodTargetAction.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mcp/actions/CopyCoremodTargetAction.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -35,7 +35,7 @@ data.element, Pair("target", "FIELD"), Pair("class", classSrg), - Pair("fieldName", srg.name) + Pair("fieldName", srg.name), ) } is PsiMethod -> { @@ -49,7 +49,7 @@ Pair("target", "METHOD"), Pair("class", classSrg), Pair("methodName", srg.name), - Pair("methodDesc", srgDescriptor) + Pair("methodDesc", srgDescriptor), ) } is PsiClass -> { Index: src/main/kotlin/platform/mcp/actions/GotoAtEntryAction.kt =================================================================== --- src/main/kotlin/platform/mcp/actions/GotoAtEntryAction.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mcp/actions/GotoAtEntryAction.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -95,7 +95,7 @@ LocalSearchScope(file), text, UsageSearchContext.ANY, - true + true, ) if (found) { Index: src/main/kotlin/platform/mcp/actions/SrgActionBase.kt =================================================================== --- src/main/kotlin/platform/mcp/actions/SrgActionBase.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mcp/actions/SrgActionBase.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -84,9 +84,11 @@ val pos = editor.offsetToVisualPosition(element.textRange.endOffset - element.textLength / 2) RelativePoint( editor.contentComponent, - editor.visualPositionToXY(VisualPosition(pos.line + 1, pos.column)) + editor.visualPositionToXY(VisualPosition(pos.line + 1, pos.column)), ) - } else RelativePoint.getCenterOf(statusBar.component) + } else { + RelativePoint.getCenterOf(statusBar.component) + } balloon.show(at, Balloon.Position.below) } } @@ -104,7 +106,7 @@ val pos = editor.offsetToVisualPosition(element.textRange.endOffset - element.textLength / 2) val at = RelativePoint( editor.contentComponent, - editor.visualPositionToXY(VisualPosition(pos.line + 1, pos.column)) + editor.visualPositionToXY(VisualPosition(pos.line + 1, pos.column)), ) balloon.show(at, Balloon.Position.below) Index: src/main/kotlin/platform/mcp/at/AtAnnotator.kt =================================================================== --- src/main/kotlin/platform/mcp/at/AtAnnotator.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mcp/at/AtAnnotator.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -73,9 +73,9 @@ null, AtSyntaxHighlighter.ELEMENT_NAME.defaultAttributes.foregroundColor, EffectType.BOLD_LINE_UNDERSCORE, - Font.PLAIN + Font.PLAIN, + ), - ) + ) - ) .create() } } Index: src/main/kotlin/platform/mcp/at/AtColorSettingsPage.kt =================================================================== --- src/main/kotlin/platform/mcp/at/AtColorSettingsPage.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mcp/at/AtColorSettingsPage.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -46,7 +46,7 @@ AttributesDescriptor("Primitive Value", AtSyntaxHighlighter.PRIMITIVE), AttributesDescriptor("Element Name", AtSyntaxHighlighter.ELEMENT_NAME), AttributesDescriptor("Asterisk", AtSyntaxHighlighter.ASTERISK), - AttributesDescriptor("Comment", AtSyntaxHighlighter.COMMENT) + AttributesDescriptor("Comment", AtSyntaxHighlighter.COMMENT), ) } } Index: src/main/kotlin/platform/mcp/at/AtElementFactory.kt =================================================================== --- src/main/kotlin/platform/mcp/at/AtElementFactory.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mcp/at/AtElementFactory.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -116,7 +116,8 @@ PUBLIC_PLUS_F("public+f"), DEFAULT("default"), DEFAULT_MINUS_F("default-f"), - DEFAULT_PLUS_F("default+f"); + DEFAULT_PLUS_F("default+f"), + ; companion object { fun match(s: String) = values().firstOrNull { it.text == s } Index: src/main/kotlin/platform/mcp/at/AtGotoDeclarationHandler.kt =================================================================== --- src/main/kotlin/platform/mcp/at/AtGotoDeclarationHandler.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mcp/at/AtGotoDeclarationHandler.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -33,7 +33,7 @@ override fun getGotoDeclarationTargets( sourceElement: PsiElement?, offset: Int, - editor: Editor + editor: Editor, ): Array? { if (sourceElement?.language !== AtLanguage) { return null @@ -88,7 +88,7 @@ val psiClass = JavaPsiFacade.getInstance(sourceElement.project).findClass( boxedType, - GlobalSearchScope.allScope(sourceElement.project) + GlobalSearchScope.allScope(sourceElement.project), ) ?: return null arrayOf(psiClass) } Index: src/main/kotlin/platform/mcp/at/AtParserDefinition.kt =================================================================== --- src/main/kotlin/platform/mcp/at/AtParserDefinition.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mcp/at/AtParserDefinition.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -53,7 +53,7 @@ (AtTypes.ASTERISK to AtTypes.COMMENT) to ParserDefinition.SpaceRequirements.MUST, (AtTypes.COMMENT to AtTypes.KEYWORD) to ParserDefinition.SpaceRequirements.MUST_LINE_BREAK, (AtTypes.COMMENT to AtTypes.COMMENT) to ParserDefinition.SpaceRequirements.MUST_LINE_BREAK, - (AtTypes.FUNCTION to AtTypes.COMMENT) to ParserDefinition.SpaceRequirements.MUST + (AtTypes.FUNCTION to AtTypes.COMMENT) to ParserDefinition.SpaceRequirements.MUST, ) } } Index: src/main/kotlin/platform/mcp/at/AtUsageInspection.kt =================================================================== --- src/main/kotlin/platform/mcp/at/AtUsageInspection.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mcp/at/AtUsageInspection.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -48,7 +48,7 @@ val psi = when (member) { is AtFunction -> reference.resolveMember(element.project) ?: srgMap.getMcpMethod(reference)?.resolveMember( - element.project + element.project, ) ?: return is AtFieldName -> reference.resolveMember(element.project) @@ -62,7 +62,7 @@ ?: holder.registerProblem( element, "Access Transformer entry is never used", - ProblemHighlightType.LIKE_UNUSED_SYMBOL + ProblemHighlightType.LIKE_UNUSED_SYMBOL, ) } } Index: src/main/kotlin/platform/mcp/at/completion/AtCompletionContributor.kt =================================================================== --- src/main/kotlin/platform/mcp/at/completion/AtCompletionContributor.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mcp/at/completion/AtCompletionContributor.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -110,9 +110,9 @@ kindResult.addElement( PrioritizedLookupElement.withPriority( LookupElementBuilder.create(name).withIcon(PlatformIcons.CLASS_ICON), - 1.0 + name.getValue(beginning) + 1.0 + name.getValue(beginning), + ), - ) + ) - ) } } } @@ -131,9 +131,9 @@ result.addElement( PrioritizedLookupElement.withPriority( LookupElementBuilder.create(name).withIcon(PlatformIcons.CLASS_ICON), - 1.0 + 1.0, + ), - ) + ) - ) } for (anonymousElement in currentClass.anonymousElements) { @@ -143,9 +143,9 @@ result.addElement( PrioritizedLookupElement.withPriority( LookupElementBuilder.create(name).withIcon(PlatformIcons.CLASS_ICON), - 1.0 + 1.0, + ), - ) + ) - ) } return } @@ -171,9 +171,9 @@ result.addElement( PrioritizedLookupElement.withPriority( LookupElementBuilder.create(name).withIcon(PlatformIcons.CLASS_ICON), - 1.0 + 1.0, + ), - ) + ) - ) } used.clear() // help GC @@ -191,9 +191,9 @@ result.addElement( PrioritizedLookupElement.withPriority( LookupElementBuilder.create(name).withIcon(PlatformIcons.PACKAGE_ICON), - 0.0 + 0.0, + ), - ) + ) - ) } } @@ -232,9 +232,9 @@ currentElement.replace( AtElementFactory.createFieldName( context.project, - memberReference.name + memberReference.name, + ), - ) + ) - ) // TODO: Fix visibility decrease PsiDocumentManager.getInstance(context.project) @@ -243,9 +243,9 @@ context.document.insertString(context.editor.caretModel.offset, comment) context.editor.caretModel.moveCaretRelatively(comment.length, 0, false, false, false) }, - 1.0 + 1.0, + ), - ) + ) - ) } for (method in entryClass.methods) { @@ -287,9 +287,9 @@ currentElement.replace( AtElementFactory.createFunction( project, - memberReference.name + memberReference.descriptor + memberReference.name + memberReference.descriptor, + ), - ) + ) - ) // TODO: Fix visibility decreases PsiDocumentManager.getInstance(context.project) @@ -298,9 +298,9 @@ context.document.insertString(context.editor.caretModel.offset, comment) context.editor.caretModel.moveCaretRelatively(comment.length, 0, false, false, false) }, - 0.0 + 0.0, + ), - ) + ) - ) } } Index: src/main/kotlin/platform/mcp/aw/AwCompletionContributor.kt =================================================================== --- src/main/kotlin/platform/mcp/aw/AwCompletionContributor.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mcp/aw/AwCompletionContributor.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -60,7 +60,7 @@ override fun addCompletions( parameters: CompletionParameters, context: ProcessingContext, - result: CompletionResultSet + result: CompletionResultSet, ) { if (parameters.position.prevLeaf(true) == null) { result.addElement(LookupElementBuilder.create("accessWidener v1 named")) @@ -74,7 +74,7 @@ override fun addCompletions( parameters: CompletionParameters, context: ProcessingContext, - result: CompletionResultSet + result: CompletionResultSet, ) = result.addAllElements(listOf("named", "intermediary").map(LookupElementBuilder::create)) } @@ -83,7 +83,7 @@ override fun addCompletions( parameters: CompletionParameters, context: ProcessingContext, - result: CompletionResultSet + result: CompletionResultSet, ) { val elements = listOf( "accessible", @@ -91,7 +91,7 @@ "extendable", "transitive-extendable", "mutable", - "transitive-mutable" + "transitive-mutable", ).map { LookupElementBuilder.create(it).withInsertHandler { ctx, _ -> insertWhitespace(ctx) } } result.addAllElements(elements) } @@ -102,7 +102,7 @@ override fun addCompletions( parameters: CompletionParameters, context: ProcessingContext, - result: CompletionResultSet + result: CompletionResultSet, ) { val text = parameters.position .prevLeaf { it.elementType == AwTypes.ACCESS_ELEMENT || it.elementType == AwTypes.CRLF }?.text Index: src/main/kotlin/platform/mcp/aw/inspections/DuplicateAwEntryInspection.kt =================================================================== --- src/main/kotlin/platform/mcp/aw/inspections/DuplicateAwEntryInspection.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mcp/aw/inspections/DuplicateAwEntryInspection.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -27,28 +27,32 @@ class DuplicateAwEntryInspection : LocalInspectionTool() { override fun checkFile(file: PsiFile, manager: InspectionManager, isOnTheFly: Boolean): Array? { - if (file !is AwFile) + if (file !is AwFile) { return null + } val collected = HashMap, MutableList>() file.entries.forEach { val target = it.childOfType()?.resolve() val accessKind = it.accessKind - if (target != null && accessKind != null) + if (target != null && accessKind != null) { (collected.getOrCreate(Pair(target, accessKind)) { ArrayList() }) += it - } + } + } val problems = ArrayList() collected.forEach { (sort, matches) -> - if (sort.first is PsiNamedElement) - if (matches.size > 1) + if (sort.first is PsiNamedElement) { + if (matches.size > 1) { for (match in matches) problems += manager.createProblemDescriptor( match, "Duplicate entry for \"${sort.second} ${(sort.first as PsiNamedElement).name}\"", RemoveElementQuickFix("Remove duplicate"), ProblemHighlightType.WARNING, - isOnTheFly + isOnTheFly, ) - } + } + } + } return problems.toTypedArray() } Index: src/main/kotlin/platform/mcp/aw/psi/mixins/impl/AwDescElementImplMixin.kt =================================================================== --- src/main/kotlin/platform/mcp/aw/psi/mixins/impl/AwDescElementImplMixin.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mcp/aw/psi/mixins/impl/AwDescElementImplMixin.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -50,9 +50,11 @@ } private fun asQualifiedName(): String? = - if (text.length > 1) + if (text.length > 1) { text.substring(1, text.length - 1).replace('/', '.') - else null + } else { + null + } override fun isSoft(): Boolean = false } Index: src/main/kotlin/platform/mcp/debug/UngrabMouseDebugSessionListener.kt =================================================================== --- src/main/kotlin/platform/mcp/debug/UngrabMouseDebugSessionListener.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mcp/debug/UngrabMouseDebugSessionListener.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -47,7 +47,7 @@ mouseClass: ClassType, virtualMachine: VirtualMachineProxyImpl, debugProcess: DebugProcessImpl, - evaluationContext: EvaluationContextImpl + evaluationContext: EvaluationContextImpl, ) { val isGrabbed = mouseClass.methodsByName("isGrabbed", "()Z")?.singleOrNull() ?: return val setGrabbed = mouseClass.methodsByName("setGrabbed", "(Z)V")?.singleOrNull() ?: return @@ -62,7 +62,7 @@ private fun ungrab3( virtualMachine: VirtualMachineProxyImpl, debugProcess: DebugProcessImpl, - evaluationContext: EvaluationContextImpl + evaluationContext: EvaluationContextImpl, ) { fun findClass(vararg names: String): ClassType? { for (name in names) { @@ -87,17 +87,17 @@ val minecraftClass = findClass( "net.minecraft.client.Minecraft", - "net.minecraft.client.MinecraftClient" + "net.minecraft.client.MinecraftClient", ) ?: return val minecraftGetter = minecraftClass.methodByName( "getInstance" to "()Lnet/minecraft/client/Minecraft;", - "getInstance" to "()Lnet/minecraft/client/MinecraftClient;" + "getInstance" to "()Lnet/minecraft/client/MinecraftClient;", ) ?: return val minecraft = debugProcess.invokeMethod( evaluationContext, minecraftClass, minecraftGetter, - emptyList() + emptyList(), ) as? ObjectReference ?: return val mouseHelperField = minecraftClass.fieldByName("mouseHandler", "mouse", "mouseHelper") ?: return @@ -106,7 +106,7 @@ val ungrabMouse = mouseHelper.referenceType().methodByName( "releaseMouse" to "()V", "unlockCursor" to "()V", - "ungrabMouse" to "()V" + "ungrabMouse" to "()V", ) ?: return debugProcess.invokeMethod(evaluationContext, mouseHelper, ungrabMouse, emptyList()) Index: src/main/kotlin/platform/mcp/fabricloom/FabricLoomData.kt =================================================================== --- src/main/kotlin/platform/mcp/fabricloom/FabricLoomData.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mcp/fabricloom/FabricLoomData.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -20,7 +20,7 @@ val module: ModuleData, val tinyMappings: File?, val decompileTasks: Map>, - val splitMinecraftJar: Boolean + val splitMinecraftJar: Boolean, ) : AbstractExternalEntityData(module.owner) { data class Decompiler(val name: String, val taskName: String, val sourcesPath: String) Index: src/main/kotlin/platform/mcp/fabricloom/FabricLoomDataService.kt =================================================================== --- src/main/kotlin/platform/mcp/fabricloom/FabricLoomDataService.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mcp/fabricloom/FabricLoomDataService.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -26,7 +26,7 @@ toImport: Collection>, projectData: ProjectData?, project: Project, - modelsProvider: IdeModifiableModelsProvider + modelsProvider: IdeModifiableModelsProvider, ) { // Dummy service to enable platform-side DataNodes cache } Index: src/main/kotlin/platform/mcp/fabricloom/FabricLoomDecompileSourceProvider.kt =================================================================== --- src/main/kotlin/platform/mcp/fabricloom/FabricLoomDecompileSourceProvider.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mcp/fabricloom/FabricLoomDecompileSourceProvider.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -28,7 +28,7 @@ class FabricLoomDecompileSourceProvider : AttachSourcesProvider { override fun getActions( orderEntries: List, - psiFile: PsiFile + psiFile: PsiFile, ): Collection { if (psiFile !is PsiJavaFile || !psiFile.packageName.startsWith("net.minecraft")) { return emptyList() @@ -82,7 +82,7 @@ project, Paths.get(projectPath), { settings -> settings.taskNames = listOf(decompiler.taskName) }, - taskCallback + taskCallback, ) return callback } Index: src/main/kotlin/platform/mcp/fabricloom/TinyUnscrambler.kt =================================================================== --- src/main/kotlin/platform/mcp/fabricloom/TinyUnscrambler.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mcp/fabricloom/TinyUnscrambler.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -61,8 +61,8 @@ Dimension(-1, -1), Dimension(-1, -1), Dimension(-1, -1), + ), - ) + ) - ) add( mappingsBox, GridConstraints( @@ -77,8 +77,8 @@ Dimension(-1, -1), Dimension(-1, -1), Dimension(-1, -1), + ), - ) + ) - ) } } Index: src/main/kotlin/platform/mcp/gradle/McpDataService.kt =================================================================== --- src/main/kotlin/platform/mcp/gradle/McpDataService.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mcp/gradle/McpDataService.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -28,7 +28,7 @@ toImport: Collection>, projectData: ProjectData?, project: Project, - modelsProvider: IdeModifiableModelsProvider + modelsProvider: IdeModifiableModelsProvider, ) { if (projectData == null || toImport.isEmpty()) { return Index: src/main/kotlin/platform/mcp/gradle/McpModelData.kt =================================================================== --- src/main/kotlin/platform/mcp/gradle/McpModelData.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mcp/gradle/McpModelData.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -21,7 +21,7 @@ val module: ModuleData, val settings: McpModuleSettings.State, val taskName: String?, - val accessTransformers: List? + val accessTransformers: List?, ) : AbstractExternalEntityData(module.owner) { companion object { // Process McpModelData after builtin services (e.g. dependency or module data) Index: src/main/kotlin/platform/mcp/gradle/datahandler/McpModelFG2Handler.kt =================================================================== --- src/main/kotlin/platform/mcp/gradle/datahandler/McpModelFG2Handler.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mcp/gradle/datahandler/McpModelFG2Handler.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -25,7 +25,7 @@ override fun build( gradleModule: IdeaModule, node: DataNode, - resolverCtx: ProjectResolverContext + resolverCtx: ProjectResolverContext, ) { val data = resolverCtx.getExtraProject(gradleModule, McpModelFG2::class.java) ?: return @@ -33,14 +33,14 @@ data.minecraftVersion, data.mcpVersion, data.mappingFiles.find { it.endsWith("mcp-srg.srg") }, - SrgType.SRG + SrgType.SRG, ) val modelData = McpModelData( node.data, state, null, - null + null, ) node.createChild( @@ -51,12 +51,12 @@ data.minecraftVersion, data.mcpVersion, data.mappingFiles.find { it.endsWith("mcp-srg.srg") }, - SrgType.SRG + SrgType.SRG, ), null, - null + null, + ), - ) + ) - ) for (child in node.children) { val childData = child.data Index: src/main/kotlin/platform/mcp/gradle/datahandler/McpModelFG3Handler.kt =================================================================== --- src/main/kotlin/platform/mcp/gradle/datahandler/McpModelFG3Handler.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mcp/gradle/datahandler/McpModelFG3Handler.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -30,7 +30,7 @@ override fun build( gradleModule: IdeaModule, node: DataNode, - resolverCtx: ProjectResolverContext + resolverCtx: ProjectResolverContext, ) { val data = resolverCtx.getExtraProject(gradleModule, McpModelFG3::class.java) ?: return @@ -55,7 +55,7 @@ data.mcpVersion, data.taskOutputLocation.absolutePath, SrgType.TSRG, - forgeVersion + forgeVersion, ) val gradleProjectPath = gradleModule.gradleProject.projectIdentifier.projectPath Index: src/main/kotlin/platform/mcp/navigation/SrgMemberChooseByNameContributor.kt =================================================================== --- src/main/kotlin/platform/mcp/navigation/SrgMemberChooseByNameContributor.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mcp/navigation/SrgMemberChooseByNameContributor.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -54,7 +54,7 @@ name: String, pattern: String, project: Project, - includeNonProjectItems: Boolean + includeNonProjectItems: Boolean, ): Array { if (!includeNonProjectItems || srgMap == null || module == null) { return emptyArray() Index: src/main/kotlin/platform/mcp/srg/McpSrgMap.kt =================================================================== --- src/main/kotlin/platform/mcp/srg/McpSrgMap.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mcp/srg/McpSrgMap.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -23,7 +23,7 @@ val classMap: ImmutableBiMap, val fieldMap: ImmutableBiMap, val methodMap: ImmutableBiMap, - private val srgNames: HashMap + private val srgNames: HashMap, ) { fun getSrgClass(fullQualifiedName: String) = classMap[fullQualifiedName] fun getSrgClass(psiClass: PsiClass): String? { Index: src/main/kotlin/platform/mcp/srg/SrgType.kt =================================================================== --- src/main/kotlin/platform/mcp/srg/SrgType.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mcp/srg/SrgType.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -12,5 +12,6 @@ enum class SrgType(val srgParser: SrgParser) { SRG(StandardSrgParser), - TSRG(TinySrgParser); + TSRG(TinySrgParser), + ; } Index: src/main/kotlin/platform/mcp/srg/TinySrgParser.kt =================================================================== --- src/main/kotlin/platform/mcp/srg/TinySrgParser.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mcp/srg/TinySrgParser.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -38,7 +38,7 @@ classMapBuilder.build(), fieldMapBuilder.build(), methodMapBuilder.build(), - srgNames + srgNames, ) } @@ -47,7 +47,7 @@ classMapBuilder: ImmutableBiMap.Builder, fieldMapBuilder: ImmutableBiMap.Builder, methodMapBuilder: ImmutableBiMap.Builder, - srgNames: HashMap + srgNames: HashMap, ) { var classRef: Pair? = null @@ -93,7 +93,7 @@ classMapBuilder: ImmutableBiMap.Builder, fieldMapBuilder: ImmutableBiMap.Builder, methodMapBuilder: ImmutableBiMap.Builder, - srgNames: HashMap + srgNames: HashMap, ) { val visitor = object : MappingVisitor { var namedNsIndex = -1 Index: src/main/kotlin/platform/mcp/vanillagradle/VanillaGradleData.kt =================================================================== --- src/main/kotlin/platform/mcp/vanillagradle/VanillaGradleData.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mcp/vanillagradle/VanillaGradleData.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -17,7 +17,7 @@ data class VanillaGradleData( val module: ModuleData, - val decompileTaskName: String + val decompileTaskName: String, ) : AbstractExternalEntityData(module.owner) { companion object { val KEY = Key.create(VanillaGradleData::class.java, ProjectKeys.TASK.processingWeight + 1) Index: src/main/kotlin/platform/mcp/vanillagradle/VanillaGradleDataService.kt =================================================================== --- src/main/kotlin/platform/mcp/vanillagradle/VanillaGradleDataService.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mcp/vanillagradle/VanillaGradleDataService.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -26,7 +26,7 @@ toImport: Collection>, projectData: ProjectData?, project: Project, - modelsProvider: IdeModifiableModelsProvider + modelsProvider: IdeModifiableModelsProvider, ) { // Dummy service to enable platform-side DataNodes cache } Index: src/main/kotlin/platform/mcp/vanillagradle/VanillaGradleDecompileSourceProvider.kt =================================================================== --- src/main/kotlin/platform/mcp/vanillagradle/VanillaGradleDecompileSourceProvider.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mcp/vanillagradle/VanillaGradleDecompileSourceProvider.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -30,7 +30,7 @@ class VanillaGradleDecompileSourceProvider : AttachSourcesProvider { override fun getActions( orderEntries: List, - psiFile: PsiFile + psiFile: PsiFile, ): Collection { if (psiFile !is PsiJavaFile || !psiFile.packageName.startsWith("net.minecraft")) { return emptyList() @@ -64,10 +64,10 @@ override fun onFailure(errorMessage: String, errorDetails: String?) { callback.reject( - if (errorDetails == null) errorMessage else "$errorMessage: $errorDetails" + if (errorDetails == null) errorMessage else "$errorMessage: $errorDetails", ) } - } + }, ) ExternalSystemUtil.refreshProject(projectPath, importSpec) } @@ -78,7 +78,7 @@ project, Paths.get(projectPath), { settings -> settings.taskNames = listOf(decompileTaskName) }, - taskCallback + taskCallback, ) return callback } Index: src/main/kotlin/platform/mixin/MixinCustomJavaDocTagProvider.kt =================================================================== --- src/main/kotlin/platform/mixin/MixinCustomJavaDocTagProvider.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/MixinCustomJavaDocTagProvider.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -10,9 +10,8 @@ package com.demonwav.mcdev.platform.mixin -import com.demonwav.mcdev.platform.mixin.handlers.MixinAnnotationHandler +import com.demonwav.mcdev.platform.mixin.util.isMixinEntryPoint import com.intellij.psi.PsiElement -import com.intellij.psi.PsiMethod import com.intellij.psi.PsiReference import com.intellij.psi.javadoc.CustomJavadocTagProvider import com.intellij.psi.javadoc.JavadocTagInfo @@ -26,20 +25,7 @@ override fun isInline() = false - override fun isValidInContext(element: PsiElement?): Boolean { - if (element !is PsiMethod) { - return false - } - val project = element.project - for (annotation in element.annotations) { - val qName = annotation.qualifiedName ?: continue - val handler = MixinAnnotationHandler.forMixinAnnotation(qName, project) - if (handler != null && handler.isEntryPoint) { - return true - } - } - return false - } + override fun isValidInContext(element: PsiElement?) = isMixinEntryPoint(element) override fun checkTagValue(value: PsiDocTagValue?): String? = null override fun getReference(value: PsiDocTagValue?): PsiReference? = null Index: src/main/kotlin/platform/mixin/MixinModule.kt =================================================================== --- src/main/kotlin/platform/mixin/MixinModule.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/MixinModule.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -50,7 +50,7 @@ fun getMixinConfigs( project: Project, - scope: GlobalSearchScope + scope: GlobalSearchScope, ): Collection { return FileTypeIndex.getFiles(mixinFileType, scope) .mapNotNull { @@ -61,7 +61,7 @@ fun getAllMixinClasses( project: Project, - scope: GlobalSearchScope + scope: GlobalSearchScope, ): Collection { return getMixinConfigs(project, scope).asSequence() .flatMap { (it.qualifiedMixins + it.qualifiedClient + it.qualifiedServer).asSequence() } @@ -75,7 +75,7 @@ fun getBestWritableConfigForMixinClass( project: Project, scope: GlobalSearchScope, - mixinClassName: String + mixinClassName: String, ): MixinConfig? { return getMixinConfigs(project, scope) .filter { it.isWritable && mixinClassName.startsWith("${it.pkg}.") } Index: src/main/kotlin/platform/mixin/action/FindMixinsAction.kt =================================================================== --- src/main/kotlin/platform/mixin/action/FindMixinsAction.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/action/FindMixinsAction.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -45,7 +45,7 @@ fun findMixins( clazz: PsiClass, project: Project, - indicator: ProgressIndicator? = null + indicator: ProgressIndicator? = null, ): List? { return clazz.cached(PsiModificationTracker.MODIFICATION_COUNT) { val targetInternalName = clazz.fullQualifiedName?.replace('.', '/') @@ -53,13 +53,13 @@ val mixinAnnotation = JavaPsiFacade.getInstance(project).findClass( MixinConstants.Annotations.MIXIN, - GlobalSearchScope.allScope(project) + GlobalSearchScope.allScope(project), ) ?: return@cached null // Check all classes with the Mixin annotation val classes = AnnotatedElementsSearch.searchPsiClasses( mixinAnnotation, - GlobalSearchScope.projectScope(project) + GlobalSearchScope.projectScope(project), ) .filter { indicator?.text = "Checking ${it.name}..." Index: src/main/kotlin/platform/mixin/action/GenerateAccessorAction.kt =================================================================== --- src/main/kotlin/platform/mixin/action/GenerateAccessorAction.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/action/GenerateAccessorAction.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -60,7 +60,7 @@ }, commandName, DocCommandGroupId.noneGroupId(editor.document), - editor.document + editor.document, ) } Index: src/main/kotlin/platform/mixin/action/GenerateAccessorHandler.kt =================================================================== --- src/main/kotlin/platform/mixin/action/GenerateAccessorHandler.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/action/GenerateAccessorHandler.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -79,7 +79,7 @@ fun customInvoke( project: Project, editor: Editor, - file: PsiFile + file: PsiFile, ) { val aClass = OverrideImplementUtil.getContextClass(project, editor, file, false) if (aClass == null || aClass.isInterface) { @@ -111,15 +111,15 @@ Project::class.java, Editor::class.java, PsiClass::class.java, - Array::class.java + Array::class.java, ), args = arrayOf( project, mixinEditor, mixinClass, - members + members, ), - owner = GenerateMembersHandlerBase::class.java + owner = GenerateMembersHandlerBase::class.java, ) } catch (e: GenerateCodeException) { val message = e.message ?: "Unknown error" @@ -130,12 +130,12 @@ HintManager.getInstance().showErrorHint(editor, message) } }, - project.disposed + project.disposed, ) } }, null, - null + null, ) } finally { cleanup() @@ -162,12 +162,12 @@ members.addAll( aClass.fields .filter { canHaveAccessor(it) } - .map { PsiFieldMember(it) } + .map { PsiFieldMember(it) }, ) members.addAll( aClass.methods .filter { canHaveInvoker(it) } - .map { PsiMethodMember(it) } + .map { PsiMethodMember(it) }, ) return members.toTypedArray() } @@ -189,7 +189,7 @@ } val range = candidate.element.textRange return@filter range != null && range.contains(offset) - }.toTypedArray() + }.toTypedArray(), ) if (!chooser.showAndGet()) { @@ -261,7 +261,7 @@ defaultPkg, CreateClassKind.CLASS, true, - defaultModule + defaultModule, ) if (!dialog.showAndGet()) { return null @@ -281,12 +281,12 @@ val message = MCDevBundle.message( "intention.error.cannot.create.class.message", name, - e.localizedMessage + e.localizedMessage, ) Messages.showErrorDialog( project, message, - MCDevBundle.message("intention.error.cannot.create.class.title") + MCDevBundle.message("intention.error.cannot.create.class.title"), ) } return@compute null @@ -307,7 +307,7 @@ val configToWrite = MixinModule.getBestWritableConfigForMixinClass( project, GlobalSearchScope.moduleScope(module), - clazz.fullQualifiedName ?: "" + clazz.fullQualifiedName ?: "", ) configToWrite?.qualifiedMixins?.add(clazz.fullQualifiedName) @@ -367,7 +367,7 @@ originalMember.element, aClass, generateGetters, - generateSetters + generateSetters, ) OverrideImplementUtil.convert2GenerationInfos(accessors).toTypedArray() } @@ -375,7 +375,7 @@ val invoker = generateInvoker( aClass.project, originalMember.element, - aClass + aClass, ) ?: return GenerationInfo.EMPTY_ARRAY arrayOf(OverrideImplementUtil.createGenerationInfo(invoker)) } @@ -388,7 +388,7 @@ target: PsiField, mixin: PsiClass, generateGetter: Boolean, - generateSetter: Boolean + generateSetter: Boolean, ): List { val factory = JavaPsiFacade.getElementFactory(project) @@ -403,7 +403,7 @@ @${MixinConstants.Annotations.ACCESSOR} ${staticPrefix(isStatic)}ReturnType $prefix${target.name.capitalize()}()${methodBody(isStatic)} """.trimIndent(), - mixin + mixin, ) target.typeElement?.let { method.returnTypeElement?.replace(it) } accessors.add(method) @@ -413,7 +413,7 @@ "@${MixinConstants.Annotations.ACCESSOR}\n" + staticPrefix(isStatic) + "void set${target.name.capitalize()}" + "(ParamType ${target.name})" + methodBody(isStatic), - mixin + mixin, ) target.typeElement?.let { method.parameterList.parameters[0].typeElement?.replace(it) } if (target.modifierList?.hasExplicitModifier(PsiModifier.FINAL) == true) { @@ -445,7 +445,7 @@ @${MixinConstants.Annotations.INVOKER}$invokerParams ${staticPrefix(isStatic)}ReturnType $name()${methodBody(isStatic)} """.trimIndent(), - mixin + mixin, ) if (target.isConstructor) { val targetClass = target.containingClass ?: return null Index: src/main/kotlin/platform/mixin/action/GenerateOverwriteAction.kt =================================================================== --- src/main/kotlin/platform/mixin/action/GenerateOverwriteAction.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/action/GenerateOverwriteAction.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -15,12 +15,11 @@ import com.demonwav.mcdev.platform.mixin.util.findOrConstructSourceMethod import com.demonwav.mcdev.util.MinecraftTemplates.Companion.MIXIN_OVERWRITE_FALLBACK import com.demonwav.mcdev.util.findContainingClass +import com.demonwav.mcdev.util.generationInfoFromMethod import com.demonwav.mcdev.util.ifEmpty -import com.demonwav.mcdev.util.realName import com.demonwav.mcdev.util.toTypedArray import com.intellij.codeInsight.generation.GenerateMembersUtil import com.intellij.codeInsight.generation.OverrideImplementUtil -import com.intellij.codeInsight.generation.PsiGenerationInfo import com.intellij.codeInsight.generation.PsiMethodMember import com.intellij.codeInsight.hint.HintManager import com.intellij.ide.fileTemplates.FileTemplateManager @@ -28,7 +27,6 @@ import com.intellij.openapi.application.runWriteAction import com.intellij.openapi.editor.Editor import com.intellij.openapi.project.Project -import com.intellij.openapi.util.text.StringUtil import com.intellij.psi.JavaPsiFacade import com.intellij.psi.PsiFile import com.intellij.psi.PsiMember @@ -46,9 +44,9 @@ classAndMethodNode.method.findOrConstructSourceMethod( classAndMethodNode.clazz, project, - canDecompile = true + canDecompile = true, + ), - ) + ) - ) }?.toTypedArray() ?: return if (methods.isEmpty()) { @@ -98,7 +96,7 @@ newMethod, method, psiClass, - FileTemplateManager.getInstance(project).getCodeTemplate(MIXIN_OVERWRITE_FALLBACK) + FileTemplateManager.getInstance(project).getCodeTemplate(MIXIN_OVERWRITE_FALLBACK), ) } @@ -106,17 +104,8 @@ // Add @Overwrite annotation val annotation = newMethod.modifierList.addAnnotation(MixinConstants.Annotations.OVERWRITE) - val realName = method.realName - if (realName != null && realName != method.name) { - val elementFactory = JavaPsiFacade.getElementFactory(project) - val value = elementFactory.createExpressionFromText( - "\"${StringUtil.escapeStringCharacters(realName)}\"", - annotation - ) - annotation.setDeclaredAttributeValue("aliases", value) + generationInfoFromMethod(method, annotation, newMethod) - } + } - PsiGenerationInfo(newMethod) - } // Insert new methods GenerateMembersUtil.insertMembersAtOffset(file, offset, newMethods) Index: src/main/kotlin/platform/mixin/action/GenerateShadowAction.kt =================================================================== --- src/main/kotlin/platform/mixin/action/GenerateShadowAction.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/action/GenerateShadowAction.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -19,8 +19,8 @@ import com.demonwav.mcdev.util.findFirstMember import com.demonwav.mcdev.util.findLastChild import com.demonwav.mcdev.util.findNextMember +import com.demonwav.mcdev.util.generationInfoFromMethod import com.demonwav.mcdev.util.ifEmpty -import com.demonwav.mcdev.util.realName import com.demonwav.mcdev.util.toTypedArray import com.intellij.application.options.CodeStyle import com.intellij.codeInsight.generation.GenerateMembersUtil @@ -37,7 +37,6 @@ import com.intellij.openapi.application.runWriteAction import com.intellij.openapi.editor.Editor import com.intellij.openapi.project.Project -import com.intellij.openapi.util.text.StringUtil import com.intellij.psi.CommonClassNames import com.intellij.psi.JavaPsiFacade import com.intellij.psi.PsiClass @@ -61,14 +60,14 @@ fieldNode.findOrConstructSourceField( classNode, project, - canDecompile = false + canDecompile = false, ).let(::PsiFieldMember) } ?: emptySequence() val methods = findMethods(psiClass, allowClinit = false)?.map { (classNode, fieldNode) -> fieldNode.findOrConstructSourceMethod( classNode, project, - canDecompile = false + canDecompile = false, ).let(::PsiMethodMember) } ?: emptySequence() @@ -92,8 +91,8 @@ createShadowMembers( project, psiClass, - elements.asSequence().map(PsiElementClassMember<*>::getElement) - ) + elements.asSequence().map(PsiElementClassMember<*>::getElement), + ), // Select first element in editor ).firstOrNull()?.positionCaret(editor, false) } @@ -120,7 +119,7 @@ fun createShadowMembers( project: Project, psiClass: PsiClass, - members: Sequence + members: Sequence, ): List> { var methodAdded = false @@ -136,17 +135,7 @@ // Add @Shadow annotation val annotation = shadowMember.modifierList!!.addAnnotation(MixinConstants.Annotations.SHADOW) - val realName = m.realName - if (realName != null && realName != m.name) { - val elementFactory = JavaPsiFacade.getElementFactory(project) - val value = elementFactory.createExpressionFromText( - "\"${StringUtil.escapeStringCharacters(realName)}\"", - annotation - ) - annotation.setDeclaredAttributeValue("aliases", value) - } - - PsiGenerationInfo(shadowMember) + generationInfoFromMethod(m, annotation, shadowMember) }.toList() // Make the class abstract (if not already) Index: src/main/kotlin/platform/mixin/action/GenerateSoftImplementsAction.kt =================================================================== --- src/main/kotlin/platform/mixin/action/GenerateSoftImplementsAction.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/action/GenerateSoftImplementsAction.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -83,14 +83,14 @@ method, it.substitutor, chooser.isCopyJavadoc, - false + false, ) .map { m -> // Apply prefix m.name = prefix + m.name OverrideImplementUtil.createGenerationInfo(m) } - } + }, ).firstOrNull()?.positionCaret(editor, true) } } Index: src/main/kotlin/platform/mixin/completion/MixinCompletionConfidence.kt =================================================================== --- src/main/kotlin/platform/mixin/completion/MixinCompletionConfidence.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/completion/MixinCompletionConfidence.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -26,7 +26,7 @@ .inside( false, PsiJavaPatterns.psiAnnotation().qName(StandardPatterns.string().startsWith(MixinConstants.PACKAGE)), - PlatformPatterns.psiFile() + PlatformPatterns.psiFile(), )!! override fun shouldSkipAutopopup(element: PsiElement, psiFile: PsiFile, offset: Int): ThreeState { Index: src/main/kotlin/platform/mixin/completion/MixinCompletionWeigher.kt =================================================================== --- src/main/kotlin/platform/mixin/completion/MixinCompletionWeigher.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/completion/MixinCompletionWeigher.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -25,7 +25,7 @@ .inside( false, PsiJavaPatterns.psiAnnotation().qName(MixinConstants.Annotations.MIXIN), - PlatformPatterns.psiFile() + PlatformPatterns.psiFile(), )!! override fun weigh(element: LookupElement, location: CompletionLocation): Int { Index: src/main/kotlin/platform/mixin/completion/MixinLookupItem.kt =================================================================== --- src/main/kotlin/platform/mixin/completion/MixinLookupItem.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/completion/MixinLookupItem.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -51,7 +51,7 @@ val psiMethod = shadow.classAndMethod.method.findOrConstructSourceMethod( shadow.classAndMethod.clazz, project, - canDecompile = false + canDecompile = false, ) return MixinMethodLookupItem(shadow, psiMethod) } @@ -60,7 +60,7 @@ private class MixinFieldLookupItem( private val shadow: FieldTargetMember, - private val field: PsiField + private val field: PsiField, ) : VariableLookupItem(field) { override fun handleInsert(context: InsertionContext) { @@ -78,7 +78,7 @@ val psiField = shadow.classAndField.field.findOrConstructSourceField( shadow.classAndField.clazz, project, - canDecompile = false + canDecompile = false, ) return MixinFieldLookupItem(shadow, psiField) } @@ -100,7 +100,7 @@ context.setLaterRunnable { HintManager.getInstance().showInformationHint( context.editor, - "Added @Shadow for '${element.name}' to super Mixin ${mixinClass.shortName}" + "Added @Shadow for '${element.name}' to super Mixin ${mixinClass.shortName}", ) } } Index: src/main/kotlin/platform/mixin/config/MixinConfig.kt =================================================================== --- src/main/kotlin/platform/mixin/config/MixinConfig.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/config/MixinConfig.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -112,32 +112,29 @@ get() = FullyQualifiedMixinList(MixinList("server")) private fun deleteCommaAround(element: PsiElement) { - // Delete the comma before, if it exists - var elem = element.prevSibling + fun deleteComma(element: PsiElement?): Boolean { + var elem = element - while (elem != null) { - if (elem.node.elementType === JsonElementTypes.COMMA || (elem is PsiErrorElement && elem.text == ",")) { - elem.delete() + while (elem != null) { + if (elem.node.elementType === JsonElementTypes.COMMA || (elem is PsiErrorElement && elem.text == ",")) { + elem.delete() - return + return true - } else if (elem is PsiComment || elem is PsiWhiteSpace) { - elem = elem.prevSibling - } else { + } else if (elem is PsiComment || elem is PsiWhiteSpace) { + elem = elem.prevSibling + } else { - break + return false - } - } + } + } + return false + } - // If it didn't exist, delete the comma after if it exists - elem = element.nextSibling - while (elem != null) { - if (elem.node.elementType === JsonElementTypes.COMMA || (elem is PsiErrorElement && elem.text == ",")) { - elem.delete() + // Delete the comma before, if it exists + if (deleteComma(element.prevSibling)) { - return + return - } else if (elem is PsiComment || elem is PsiWhiteSpace) { - elem = elem.nextSibling - } else { - break - } + } + + // If it didn't exist, delete the comma after if it exists + deleteComma(element.nextSibling) - } + } - } private fun reformat() { json = CodeStyleManager.getInstance(project).reformat(json) as JsonObject Index: src/main/kotlin/platform/mixin/config/MixinConfigImportOptimizer.kt =================================================================== --- src/main/kotlin/platform/mixin/config/MixinConfigImportOptimizer.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/config/MixinConfigImportOptimizer.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -106,7 +106,7 @@ private val file: JsonFile, private val mixins: JsonArray?, private val server: JsonArray?, - private val client: JsonArray? + private val client: JsonArray?, ) : Runnable { override fun run() { Index: src/main/kotlin/platform/mixin/config/inspection/ConfigValueInspection.kt =================================================================== --- src/main/kotlin/platform/mixin/config/inspection/ConfigValueInspection.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/config/inspection/ConfigValueInspection.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -112,7 +112,7 @@ JAVA_LANG_FLOAT, JAVA_LANG_INTEGER, JAVA_LANG_LONG, - JAVA_LANG_SHORT + JAVA_LANG_SHORT, ) } } Index: src/main/kotlin/platform/mixin/config/inspection/UnresolvedReferenceInspection.kt =================================================================== --- src/main/kotlin/platform/mixin/config/inspection/UnresolvedReferenceInspection.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/config/inspection/UnresolvedReferenceInspection.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -36,7 +36,7 @@ literal, "Cannot resolve ${reference.description}".format(reference.canonicalText), ProblemHighlightType.LIKE_UNKNOWN_SYMBOL, - reference.rangeInElement + reference.rangeInElement, ) } } Index: src/main/kotlin/platform/mixin/debug/MixinDebuggerClassFilterProvider.kt =================================================================== --- src/main/kotlin/platform/mixin/debug/MixinDebuggerClassFilterProvider.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/debug/MixinDebuggerClassFilterProvider.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -19,7 +19,7 @@ class MixinDebuggerClassFilterProvider : DebuggerClassFilterProvider { private val filters = listOf( - ClassFilter("org.spongepowered.asm.mixin.injection.callback.*") + ClassFilter("org.spongepowered.asm.mixin.injection.callback.*"), ) override fun getFilters(): List { Index: src/main/kotlin/platform/mixin/debug/MixinPositionManager.kt =================================================================== --- src/main/kotlin/platform/mixin/debug/MixinPositionManager.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/debug/MixinPositionManager.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -61,7 +61,7 @@ ?: DebuggerUtils.findClass( className, debugProcess.project, - debugProcess.searchScope + debugProcess.searchScope, )?.navigationElement?.containingFile if (psiFile != null) { @@ -104,13 +104,13 @@ override fun createPrepareRequest(requestor: ClassPrepareRequestor, position: SourcePosition): ClassPrepareRequest { throw UnsupportedOperationException( "This class implements MultiRequestPositionManager, " + - "corresponding createPrepareRequests version should be used" + "corresponding createPrepareRequests version should be used", ) } override fun createPrepareRequests( requestor: ClassPrepareRequestor, - position: SourcePosition + position: SourcePosition, ): List { return runReadAction { findMatchingClasses(position) Index: src/main/kotlin/platform/mixin/folding/AccessorMixinFoldingBuilder.kt =================================================================== --- src/main/kotlin/platform/mixin/folding/AccessorMixinFoldingBuilder.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/folding/AccessorMixinFoldingBuilder.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -102,7 +102,7 @@ descriptors: MutableList, root: PsiElement, document: Document, - quick: Boolean + quick: Boolean, ) { if (root !is PsiJavaFile || !MixinModuleType.isInModule(root)) { return @@ -146,9 +146,9 @@ descriptors.add( FoldingDescriptor( identifier.node, - identifier.textRange + identifier.textRange, + ), - ) + ) - ) } if (accessor && settings.foldAccessorMethodCalls) { @@ -174,15 +174,15 @@ descriptors.add( FoldingDescriptor( parenthetical.node, - parenthetical.textRange + parenthetical.textRange, + ), - ) + ) - ) } } private fun foldAccessorMethodCall( expression: PsiMethodCallExpression, - identifier: PsiIdentifier + identifier: PsiIdentifier, ) { val argumentList = expression.argumentList val openParen = argumentList.firstChild @@ -202,24 +202,24 @@ FoldingDescriptor( openParen.node, openParen.textRange, - group + group, + ), - ) + ) - ) descriptors.add( FoldingDescriptor( closeParen.node, closeParen.textRange, - group + group, + ), - ) + ) - ) descriptors.add( FoldingDescriptor( identifier.node, identifier.textRange, - group + group, + ), - ) + ) - ) } } } Index: src/main/kotlin/platform/mixin/folding/MixinFoldingOptionsProvider.kt =================================================================== --- src/main/kotlin/platform/mixin/folding/MixinFoldingOptionsProvider.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/folding/MixinFoldingOptionsProvider.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -23,28 +23,28 @@ checkBox( "Target descriptors", { settings.state.foldTargetDescriptors }, - { b -> settings.state.foldTargetDescriptors = b } + { b -> settings.state.foldTargetDescriptors = b }, ) checkBox("Object casts", { settings.state.foldObjectCasts }, { b -> settings.state.foldObjectCasts = b }) checkBox( "Invoker casts", { settings.state.foldInvokerCasts }, - { b -> settings.state.foldInvokerCasts = b } + { b -> settings.state.foldInvokerCasts = b }, ) checkBox( "Invoker method calls", { settings.state.foldInvokerMethodCalls }, - { b -> settings.state.foldInvokerMethodCalls = b } + { b -> settings.state.foldInvokerMethodCalls = b }, ) checkBox( "Accessor casts", { settings.state.foldAccessorCasts }, - { b -> settings.state.foldAccessorCasts = b } + { b -> settings.state.foldAccessorCasts = b }, ) checkBox( "Accessor method calls", { settings.state.foldAccessorMethodCalls }, - { b -> settings.state.foldAccessorMethodCalls = b } + { b -> settings.state.foldAccessorMethodCalls = b }, ) } } Index: src/main/kotlin/platform/mixin/folding/MixinObjectCastFoldingBuilder.kt =================================================================== --- src/main/kotlin/platform/mixin/folding/MixinObjectCastFoldingBuilder.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/folding/MixinObjectCastFoldingBuilder.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -42,7 +42,7 @@ descriptors: MutableList, root: PsiElement, document: Document, - quick: Boolean + quick: Boolean, ) { if (root !is PsiJavaFile || !MixinModuleType.isInModule(root)) { return @@ -73,9 +73,9 @@ descriptors.add( FoldingDescriptor( expression.node, - TextRange(start.startOffset, end.startOffset + end.textLength) + TextRange(start.startOffset, end.startOffset + end.textLength), + ), - ) + ) - ) } } } Index: src/main/kotlin/platform/mixin/folding/MixinTargetDescriptorFoldingBuilder.kt =================================================================== --- src/main/kotlin/platform/mixin/folding/MixinTargetDescriptorFoldingBuilder.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/folding/MixinTargetDescriptorFoldingBuilder.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -63,7 +63,7 @@ descriptors: MutableList, root: PsiElement, document: Document, - quick: Boolean + quick: Boolean, ) { if (root !is PsiJavaFile || !MixinModuleType.isInModule(root)) { return Index: src/main/kotlin/platform/mixin/handlers/AccessorHandler.kt =================================================================== --- src/main/kotlin/platform/mixin/handlers/AccessorHandler.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/handlers/AccessorHandler.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -92,7 +92,7 @@ targetMember.classAndField.clazz, method.project, method.resolveScope, - canDecompile = false + canDecompile = false, ).createSmartPointer() } @@ -103,6 +103,7 @@ enum class AccessorType(val allowGetters: Boolean, val allowSetters: Boolean) { GETTER(true, false), SETTER(false, true), - UNKNOWN(true, true); + UNKNOWN(true, true), + ; } } Index: src/main/kotlin/platform/mixin/handlers/InjectAnnotationHandler.kt =================================================================== --- src/main/kotlin/platform/mixin/handlers/InjectAnnotationHandler.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/handlers/InjectAnnotationHandler.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -36,7 +36,7 @@ override fun expectedMethodSignature( annotation: PsiAnnotation, targetClass: ClassNode, - targetMethod: MethodNode + targetMethod: MethodNode, ): List { val returnType = targetMethod.getGenericReturnType(targetClass, annotation.project) @@ -47,9 +47,9 @@ ParameterGroup( collectTargetMethodParameters(annotation.project, targetClass, targetMethod), required = ParameterGroup.RequiredLevel.OPTIONAL, - default = true + default = true, + ), - ) + ) - ) // Callback info (required) result.add( @@ -60,12 +60,12 @@ } else { Parameter( "cir", - callbackInfoReturnableType(annotation.project, annotation, returnType)!! + callbackInfoReturnableType(annotation.project, annotation, returnType)!!, ) - } + }, + ), + ), - ) + ) - ) - ) // Captured locals (only if local capture is enabled) val localCapture = (annotation.findDeclaredAttributeValue("locals") as? PsiQualifiedReference) @@ -78,7 +78,7 @@ val locals = LocalVariables.getLocals(module, targetClass, targetMethod, insn.insn) ?.drop( Type.getArgumentTypes(targetMethod.desc).size + - if (targetMethod.hasAccess(Opcodes.ACC_STATIC)) 0 else 1 + if (targetMethod.hasAccess(Opcodes.ACC_STATIC)) 0 else 1, ) ?.filterNotNull() ?.filter { it.desc != null } @@ -110,9 +110,9 @@ localParams, default = true, required = requiredLevel, - isVarargs = true + isVarargs = true, + ), - ) + ) - ) } } } Index: src/main/kotlin/platform/mixin/handlers/InjectorAnnotationHandler.kt =================================================================== --- src/main/kotlin/platform/mixin/handlers/InjectorAnnotationHandler.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/handlers/InjectorAnnotationHandler.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -74,7 +74,7 @@ protected open fun isUnresolved( annotation: PsiAnnotation, targetClass: ClassNode, - targetMethod: MethodNode + targetMethod: MethodNode, ): InsnResolutionInfo.Failure? { return annotation.findAttributeValue("at")?.findAnnotations() .ifNullOrEmpty { return InsnResolutionInfo.Failure() }!! @@ -92,7 +92,7 @@ protected open fun resolveForNavigation( annotation: PsiAnnotation, targetClass: ClassNode, - targetMethod: MethodNode + targetMethod: MethodNode, ): List { return annotation.findAttributeValue("at")?.findAnnotations() .ifNullOrEmpty { return emptyList() }!! @@ -118,7 +118,7 @@ annotation: PsiAnnotation, targetClass: ClassNode, targetMethod: MethodNode, - mode: CollectVisitor.Mode = CollectVisitor.Mode.MATCH_ALL + mode: CollectVisitor.Mode = CollectVisitor.Mode.MATCH_ALL, ): List> { return annotation.findAttributeValue("at")?.findAnnotations() .ifNullOrEmpty { return emptyList() }!! @@ -133,7 +133,7 @@ abstract fun expectedMethodSignature( annotation: PsiAnnotation, targetClass: ClassNode, - targetMethod: MethodNode + targetMethod: MethodNode, ): List? open fun isInsnAllowed(insn: AbstractInsnNode): Boolean { @@ -155,7 +155,7 @@ protected fun collectTargetMethodParameters( project: Project, clazz: ClassNode, - targetMethod: MethodNode + targetMethod: MethodNode, ): List { val numLocalsToDrop = if (targetMethod.hasAccess(Opcodes.ACC_STATIC)) 0 else 1 val localVariables = targetMethod.localVariables?.sortedBy { it.index } @@ -188,7 +188,7 @@ override fun expectedMethodSignature( annotation: PsiAnnotation, targetClass: ClassNode, - targetMethod: MethodNode + targetMethod: MethodNode, ) = null override val isSoft = true Index: src/main/kotlin/platform/mixin/handlers/InvokerHandler.kt =================================================================== --- src/main/kotlin/platform/mixin/handlers/InvokerHandler.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/handlers/InvokerHandler.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -89,7 +89,7 @@ invokerTarget.classAndMethod.clazz, member.project, member.resolveScope, - canDecompile = false + canDecompile = false, ).createSmartPointer() } Index: src/main/kotlin/platform/mixin/handlers/MixinAnnotationHandler.kt =================================================================== --- src/main/kotlin/platform/mixin/handlers/MixinAnnotationHandler.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/handlers/MixinAnnotationHandler.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -74,7 +74,7 @@ companion object { private val EP_NAME = ExtensionPointName>( - "com.demonwav.minecraft-dev.mixinAnnotationHandler" + "com.demonwav.minecraft-dev.mixinAnnotationHandler", ) private val COLLECTOR = KeyedExtensionCollector(EP_NAME) @@ -94,7 +94,7 @@ ?.let { annotationType -> AnnotatedElementsSearch.searchPsiClasses( annotationType, - GlobalSearchScope.allScope(project) + GlobalSearchScope.allScope(project), ).mapNotNull { injectionInfoClass -> injectionInfoClass.findAnnotation(MixinConstants.Annotations.ANNOTATION_TYPE) ?.findAttributeValue("value") Index: src/main/kotlin/platform/mixin/handlers/MixinMemberAnnotationHandler.kt =================================================================== --- src/main/kotlin/platform/mixin/handlers/MixinMemberAnnotationHandler.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/handlers/MixinMemberAnnotationHandler.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -37,14 +37,14 @@ it.classAndField.clazz, annotation.project, annotation.resolveScope, - canDecompile = true + canDecompile = true, ) is MethodTargetMember -> it.classAndMethod.method.findSourceElement( it.classAndMethod.clazz, annotation.project, annotation.resolveScope, - canDecompile = true + canDecompile = true, ) } } Index: src/main/kotlin/platform/mixin/handlers/ModifyArgHandler.kt =================================================================== --- src/main/kotlin/platform/mixin/handlers/ModifyArgHandler.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/handlers/ModifyArgHandler.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -34,7 +34,7 @@ override fun expectedMethodSignature( annotation: PsiAnnotation, targetClass: ClassNode, - targetMethod: MethodNode + targetMethod: MethodNode, ): List? { val index = annotation.findDeclaredAttributeValue("index")?.constantValue as? Int val validSingleArgTypes = mutableSetOf() @@ -100,11 +100,11 @@ listOf( ParameterGroup( listOf( - sanitizedParameter(psiType, psiParameter?.name) - ) - ) + sanitizedParameter(psiType, psiParameter?.name), - ), + ), - psiType + ), + ), + psiType, ) if (validFullSignature != null) { val fullParamGroup = ParameterGroup( @@ -112,13 +112,13 @@ val psiParam = paramList?.let { bytecodeMethod.getParameter(bytecodeClass, index, it) } sanitizedParameter( psiParam?.type ?: argType.toPsiType(elementFactory), - psiParam?.name + psiParam?.name, ) - } + }, ) listOf( singleSignature, - MethodSignature(listOf(fullParamGroup), psiType) + MethodSignature(listOf(fullParamGroup), psiType), ) } else { listOf(singleSignature) Index: src/main/kotlin/platform/mixin/handlers/ModifyArgsHandler.kt =================================================================== --- src/main/kotlin/platform/mixin/handlers/ModifyArgsHandler.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/handlers/ModifyArgsHandler.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -30,7 +30,7 @@ override fun expectedMethodSignature( annotation: PsiAnnotation, targetClass: ClassNode, - targetMethod: MethodNode + targetMethod: MethodNode, ): List { val argsType = JavaPsiFacade.getElementFactory(annotation.project) .createTypeByFQClassName(ARGS, annotation.resolveScope) @@ -41,11 +41,11 @@ ParameterGroup( collectTargetMethodParameters(annotation.project, targetClass, targetMethod), required = ParameterGroup.RequiredLevel.OPTIONAL, - isVarargs = true - ) + isVarargs = true, - ), + ), - PsiType.VOID + ), + PsiType.VOID, + ), - ) + ) - ) } } Index: src/main/kotlin/platform/mixin/handlers/ModifyConstantHandler.kt =================================================================== --- src/main/kotlin/platform/mixin/handlers/ModifyConstantHandler.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/handlers/ModifyConstantHandler.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -59,12 +59,12 @@ Opcodes.IFLT, Opcodes.IFGE, Opcodes.IFGT, - Opcodes.IFLE + Opcodes.IFLE, ) private class ModifyConstantInfo( val constantInfo: ConstantInjectionPoint.ConstantInfo, - val constantAnnotation: PsiAnnotation + val constantAnnotation: PsiAnnotation, ) private fun getConstantInfos(modifyConstant: PsiAnnotation): List? { @@ -81,7 +81,7 @@ val stringValue = constant.findDeclaredAttributeValue("stringValue")?.constantValue as? String val classValue = constant.findDeclaredAttributeValue("classValue")?.resolveClass()?.descriptor?.let { Type.getType( - it + it, ) } @@ -129,7 +129,7 @@ override fun expectedMethodSignature( annotation: PsiAnnotation, targetClass: ClassNode, - targetMethod: MethodNode + targetMethod: MethodNode, ): List? { val constantInfos = getConstantInfos(annotation) ?: return null val psiManager = PsiManager.getInstance(annotation.project) @@ -151,10 +151,10 @@ ParameterGroup( collectTargetMethodParameters(annotation.project, targetClass, targetMethod), isVarargs = true, - required = ParameterGroup.RequiredLevel.OPTIONAL - ) + required = ParameterGroup.RequiredLevel.OPTIONAL, - ), + ), - type + ), + type, ) }.toList() } @@ -162,7 +162,7 @@ override fun resolveForNavigation( annotation: PsiAnnotation, targetClass: ClassNode, - targetMethod: MethodNode + targetMethod: MethodNode, ): List { val constantInfos = getConstantInfos(annotation) ?: return emptyList() @@ -170,7 +170,7 @@ targetClass, annotation.project, GlobalSearchScope.allScope(annotation.project), - canDecompile = true + canDecompile = true, ) ?: return emptyList() val constantInjectionPoint = InjectionPoint.byAtCode("CONSTANT") as? ConstantInjectionPoint @@ -180,12 +180,12 @@ val collectVisitor = ConstantInjectionPoint.MyCollectVisitor( annotation.project, CollectVisitor.Mode.MATCH_ALL, - modifyConstantInfo.constantInfo + modifyConstantInfo.constantInfo, ) constantInjectionPoint.addStandardFilters( modifyConstantInfo.constantAnnotation, targetClass, - collectVisitor + collectVisitor, ) collectVisitor.visit(targetMethod) val bytecodeResults = collectVisitor.result @@ -203,7 +203,7 @@ annotation: PsiAnnotation, targetClass: ClassNode, targetMethod: MethodNode, - mode: CollectVisitor.Mode + mode: CollectVisitor.Mode, ): List> { val constantInfos = getConstantInfos(annotation) ?: return emptyList() val constantInjectionPoint = InjectionPoint.byAtCode("CONSTANT") as? ConstantInjectionPoint @@ -212,12 +212,12 @@ val collectVisitor = ConstantInjectionPoint.MyCollectVisitor( annotation.project, mode, - modifyConstantInfo.constantInfo + modifyConstantInfo.constantInfo, ) constantInjectionPoint.addStandardFilters( modifyConstantInfo.constantAnnotation, targetClass, - collectVisitor + collectVisitor, ) collectVisitor.visit(targetMethod) collectVisitor.result.asSequence() @@ -227,7 +227,7 @@ override fun isUnresolved( annotation: PsiAnnotation, targetClass: ClassNode, - targetMethod: MethodNode + targetMethod: MethodNode, ): InsnResolutionInfo.Failure? { val constantInfos = getConstantInfos(annotation) ?: return InsnResolutionInfo.Failure() val constantInjectionPoint = InjectionPoint.byAtCode("CONSTANT") as? ConstantInjectionPoint @@ -236,12 +236,12 @@ val collectVisitor = ConstantInjectionPoint.MyCollectVisitor( annotation.project, CollectVisitor.Mode.MATCH_FIRST, - modifyConstantInfo.constantInfo + modifyConstantInfo.constantInfo, ) constantInjectionPoint.addStandardFilters( modifyConstantInfo.constantAnnotation, targetClass, - collectVisitor + collectVisitor, ) collectVisitor.visit(targetMethod) if (collectVisitor.result.isEmpty()) { Index: src/main/kotlin/platform/mixin/handlers/ModifyVariableHandler.kt =================================================================== --- src/main/kotlin/platform/mixin/handlers/ModifyVariableHandler.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/handlers/ModifyVariableHandler.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -38,7 +38,7 @@ override fun expectedMethodSignature( annotation: PsiAnnotation, targetClass: ClassNode, - targetMethod: MethodNode + targetMethod: MethodNode, ): List? { val module = annotation.findModule() ?: return null @@ -51,7 +51,7 @@ val targetParamsGroup = ParameterGroup( collectTargetMethodParameters(annotation.project, targetClass, targetMethod), required = ParameterGroup.RequiredLevel.OPTIONAL, - isVarargs = true + isVarargs = true, ) val info = ModifyVariableInfo.getModifyVariableInfo(annotation, CollectVisitor.Mode.COMPLETION) @@ -74,9 +74,9 @@ result += MethodSignature( listOf( ParameterGroup(listOf(sanitizedParameter(psiType, "value"))), - targetParamsGroup + targetParamsGroup, ), - psiType + psiType, ) } @@ -89,13 +89,13 @@ val argsOnly: Boolean, val index: Int?, val ordinal: Int?, - val names: Set + val names: Set, ) { fun getLocals( module: Module, targetClass: ClassNode, methodNode: MethodNode, - insn: AbstractInsnNode + insn: AbstractInsnNode, ): Array? { return if (argsOnly) { val args = mutableListOf() @@ -105,7 +105,7 @@ } for (argType in Type.getArgumentTypes(methodNode.desc)) { args.add( - LocalVariables.LocalVariable("arg${args.size}", argType.descriptor, null, null, null, args.size) + LocalVariables.LocalVariable("arg${args.size}", argType.descriptor, null, null, null, args.size), ) if (argType.size == 2) { args.add(null) @@ -120,7 +120,7 @@ fun matchLocals( locals: Array, mode: CollectVisitor.Mode, - matchType: Boolean = true + matchType: Boolean = true, ): List { val typeDesc = type?.descriptor if (ordinal != null) { Index: src/main/kotlin/platform/mixin/handlers/RedirectInjectorHandler.kt =================================================================== --- src/main/kotlin/platform/mixin/handlers/RedirectInjectorHandler.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/handlers/RedirectInjectorHandler.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -25,6 +25,7 @@ import com.intellij.psi.JavaPsiFacade import com.intellij.psi.PsiAnnotation import com.intellij.psi.PsiArrayType +import com.intellij.psi.PsiElementFactory import com.intellij.psi.PsiManager import com.intellij.psi.PsiType import org.objectweb.asm.Opcodes @@ -72,20 +73,20 @@ override fun expectedMethodSignature( annotation: PsiAnnotation, targetClass: ClassNode, - targetMethod: MethodNode + targetMethod: MethodNode, ): List? { val insns = resolveInstructions(annotation, targetClass, targetMethod).ifEmpty { return emptyList() } return getRedirectType(insns[0].insn)?.expectedMethodSignature( annotation, targetClass, targetMethod, - insns.map { it.insn } + insns.map { it.insn }, )?.map { (paramGroups, returnType) -> // add a parameter group for capturing the target method parameters val extraGroup = ParameterGroup( collectTargetMethodParameters(annotation.project, targetClass, targetMethod), required = ParameterGroup.RequiredLevel.OPTIONAL, - isVarargs = true + isVarargs = true, ) MethodSignature(paramGroups + extraGroup, returnType) } @@ -100,16 +101,34 @@ annotation: PsiAnnotation, targetClass: ClassNode, targetMethod: MethodNode, - insns: List + insns: List, ): List? } - private object FieldGet : RedirectType { + private abstract class FieldAccess : RedirectType { + protected fun determineFieldType( + firstMatch: FieldInsnNode, + annotation: PsiAnnotation, + ): Pair { + val elementFactory = JavaPsiFacade.getElementFactory(annotation.project) + + val sourceClassAndField = ( + MemberReference(firstMatch.name, firstMatch.desc, firstMatch.owner.replace('/', '.')) + .resolveAsm(annotation.project) as? FieldTargetMember + )?.classAndField + val fieldType = sourceClassAndField?.field?.getGenericType(sourceClassAndField.clazz, annotation.project) + ?: Type.getType(firstMatch.desc).toPsiType(elementFactory) + + return elementFactory to fieldType + } + } + + private object FieldGet : FieldAccess() { override fun expectedMethodSignature( annotation: PsiAnnotation, targetClass: ClassNode, targetMethod: MethodNode, - insns: List + insns: List, ): List { val firstMatch = insns.first() as FieldInsnNode val isValid = insns.all { @@ -122,16 +141,9 @@ return emptyList() } - val elementFactory = JavaPsiFacade.getElementFactory(annotation.project) - - val sourceClassAndField = ( - MemberReference(firstMatch.name, firstMatch.desc, firstMatch.owner.replace('/', '.')) - .resolveAsm(annotation.project) as? FieldTargetMember - )?.classAndField - val fieldType = sourceClassAndField?.field?.getGenericType(sourceClassAndField.clazz, annotation.project) - ?: Type.getType(firstMatch.desc).toPsiType(elementFactory) - + val (elementFactory, fieldType) = determineFieldType(firstMatch, annotation) val parameters = mutableListOf() + if (firstMatch.opcode == Opcodes.GETFIELD) { parameters += Parameter("instance", Type.getObjectType(firstMatch.owner).toPsiType(elementFactory)) } @@ -139,18 +151,18 @@ return listOf( MethodSignature( listOf(ParameterGroup(parameters)), - fieldType + fieldType, + ), - ) + ) - ) } } - private object FieldSet : RedirectType { + private object FieldSet : FieldAccess() { override fun expectedMethodSignature( annotation: PsiAnnotation, targetClass: ClassNode, targetMethod: MethodNode, - insns: List + insns: List, ): List { val firstMatch = insns.first() as FieldInsnNode val isValid = insns.all { @@ -163,16 +175,9 @@ return emptyList() } - val elementFactory = JavaPsiFacade.getElementFactory(annotation.project) - - val sourceClassAndField = ( - MemberReference(firstMatch.name, firstMatch.desc, firstMatch.owner.replace('/', '.')) - .resolveAsm(annotation.project) as? FieldTargetMember - )?.classAndField - val fieldType = sourceClassAndField?.field?.getGenericType(sourceClassAndField.clazz, annotation.project) - ?: Type.getType(firstMatch.desc).toPsiType(elementFactory) - + val (elementFactory, fieldType) = determineFieldType(firstMatch, annotation) val parameters = mutableListOf() + if (firstMatch.opcode == Opcodes.PUTFIELD) { parameters += Parameter("instance", Type.getObjectType(firstMatch.owner).toPsiType(elementFactory)) } @@ -181,9 +186,9 @@ return listOf( MethodSignature( listOf(ParameterGroup(parameters)), - PsiType.VOID + PsiType.VOID, + ), - ) + ) - ) } } @@ -196,7 +201,7 @@ annotation: PsiAnnotation, targetClass: ClassNode, targetMethod: MethodNode, - insns: List + insns: List, ): List { val firstMatch = insns.first() as MethodInsnNode val isValid = insns.all { @@ -219,7 +224,7 @@ )?.classAndMethod val signature = sourceClassAndMethod?.method?.getGenericSignature( sourceClassAndMethod.clazz, - annotation.project + annotation.project, ) val parameters = mutableListOf() @@ -252,7 +257,7 @@ annotation: PsiAnnotation, targetClass: ClassNode, targetMethod: MethodNode, - insns: List + insns: List, ): List? { val firstMatch = insns.first() val isValid = insns.all { it.opcode == firstMatch.opcode } @@ -271,13 +276,13 @@ listOf( ParameterGroup( listOf( - Parameter("array", arrayType.toPsiType(elementFactory)) - ) - ) + Parameter("array", arrayType.toPsiType(elementFactory)), - ), + ), - PsiType.INT + ), + ), + PsiType.INT, + ), - ) + ) - ) } } @@ -286,7 +291,7 @@ annotation: PsiAnnotation, targetClass: ClassNode, targetMethod: MethodNode, - insns: List + insns: List, ): List? { val firstMatch = insns.first() val isValid = insns.all { it.opcode == firstMatch.opcode } @@ -307,13 +312,13 @@ ParameterGroup( listOf( Parameter("array", psiArrayType), - Parameter("index", PsiType.INT) - ) - ) + Parameter("index", PsiType.INT), - ), + ), - psiArrayType.componentType + ), + ), + psiArrayType.componentType, + ), - ) + ) - ) } } @@ -322,7 +327,7 @@ annotation: PsiAnnotation, targetClass: ClassNode, targetMethod: MethodNode, - insns: List + insns: List, ): List? { val firstMatch = insns.first() val isValid = insns.all { it.opcode == firstMatch.opcode } @@ -344,13 +349,13 @@ listOf( Parameter("array", psiArrayType), Parameter("index", PsiType.INT), - Parameter("value", psiArrayType.componentType) - ) - ) + Parameter("value", psiArrayType.componentType), - ), + ), - PsiType.VOID + ), + ), + PsiType.VOID, + ), - ) + ) - ) } } @@ -363,7 +368,7 @@ annotation: PsiAnnotation, targetClass: ClassNode, targetMethod: MethodNode, - insns: List + insns: List, ): List { val firstMatch = insns.first() as TypeInsnNode val isValid = insns.all { @@ -383,7 +388,7 @@ targetMethod, insns.mapNotNull { NewInsnInjectionPoint.findInitCall(it as TypeInsnNode) - } + }, ).map { (paramGroups, _) -> // drop the instance parameter, return the constructed type MethodSignature(listOf(ParameterGroup(paramGroups[0].parameters.drop(1))), constructedType) @@ -396,7 +401,7 @@ annotation: PsiAnnotation, targetClass: ClassNode, targetMethod: MethodNode, - insns: List + insns: List, ): List { val firstMatch = insns.first() val isValid = insns.all { it.opcode == firstMatch.opcode } @@ -409,12 +414,12 @@ val parameters = ParameterGroup( listOf( Parameter("instance", objectType), - Parameter("type", classType) + Parameter("type", classType), + ), - ) + ) - ) return listOf( MethodSignature(listOf(parameters), PsiType.BOOLEAN), - MethodSignature(listOf(parameters), classType) + MethodSignature(listOf(parameters), classType), ) } } Index: src/main/kotlin/platform/mixin/handlers/ShadowHandler.kt =================================================================== --- src/main/kotlin/platform/mixin/handlers/ShadowHandler.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/handlers/ShadowHandler.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -45,10 +45,10 @@ return when (member) { is PsiMethod -> listOfNotNull( targetClass.findMethod(MemberReference(name, member.descriptor)) - ?.let { MethodTargetMember(targetClass, it) } + ?.let { MethodTargetMember(targetClass, it) }, ) is PsiField -> listOfNotNull( - targetClass.findFieldByName(name)?.let { FieldTargetMember(targetClass, it) } + targetClass.findFieldByName(name)?.let { FieldTargetMember(targetClass, it) }, ) else -> emptyList() } @@ -79,13 +79,13 @@ shadowTarget.classAndField.clazz, member.project, member.resolveScope, - canDecompile = false + canDecompile = false, ) is MethodTargetMember -> shadowTarget.classAndMethod.method.findSourceElement( shadowTarget.classAndMethod.clazz, member.project, member.resolveScope, - canDecompile = false + canDecompile = false, ) }?.createSmartPointer() } @@ -98,13 +98,13 @@ shadowTarget.classAndField.clazz, member.project, member.resolveScope, - canDecompile = false + canDecompile = false, ) is MethodTargetMember -> shadowTarget.classAndMethod.method.findOrConstructSourceMethod( shadowTarget.classAndMethod.clazz, member.project, member.resolveScope, - canDecompile = false + canDecompile = false, ) }.createSmartPointer() } Index: src/main/kotlin/platform/mixin/handlers/injectionPoint/AtResolver.kt =================================================================== --- src/main/kotlin/platform/mixin/handlers/injectionPoint/AtResolver.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/handlers/injectionPoint/AtResolver.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -55,7 +55,7 @@ class AtResolver( private val at: PsiAnnotation, private val targetClass: ClassNode, - private val targetMethod: MethodNode + private val targetMethod: MethodNode, ) { companion object { private fun getInjectionPoint(at: PsiAnnotation): InjectionPoint<*>? { @@ -102,7 +102,7 @@ at, target, targetClass, - CollectVisitor.Mode.MATCH_FIRST + CollectVisitor.Mode.MATCH_FIRST, ) if (collectVisitor == null) { // syntax error in target @@ -153,7 +153,7 @@ targetClass, at.project, GlobalSearchScope.allScope(at.project), - canDecompile = true + canDecompile = true, ) ?: return emptyList() val targetPsiClass = targetElement.parentOfType() ?: return emptyList() Index: src/main/kotlin/platform/mixin/handlers/injectionPoint/ConstantInjectionPoint.kt =================================================================== --- src/main/kotlin/platform/mixin/handlers/injectionPoint/ConstantInjectionPoint.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/handlers/injectionPoint/ConstantInjectionPoint.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -29,7 +29,6 @@ import com.intellij.psi.PsiLiteralExpression import com.intellij.psi.PsiSwitchLabelStatementBase import com.intellij.psi.util.PsiUtil -import java.lang.IllegalArgumentException import java.util.Locale import org.objectweb.asm.Opcodes import org.objectweb.asm.Type @@ -92,7 +91,7 @@ override fun createNavigationVisitor( at: PsiAnnotation, target: MixinSelector?, - targetClass: PsiClass + targetClass: PsiClass, ): NavigationVisitor? { val constantInfo = getConstantInfo(at) ?: return null return MyNavigationVisitor(constantInfo) @@ -102,7 +101,7 @@ at: PsiAnnotation, target: MixinSelector?, targetClass: ClassNode, - mode: CollectVisitor.Mode + mode: CollectVisitor.Mode, ): CollectVisitor? { val constantInfo = getConstantInfo(at) ?: return null return MyCollectVisitor(at.project, mode, constantInfo) @@ -110,7 +109,7 @@ override fun createLookup( targetClass: ClassNode, - result: CollectVisitor.Result + result: CollectVisitor.Result, ): LookupElementBuilder? { return null } @@ -125,7 +124,7 @@ } class MyNavigationVisitor( - private val constantInfo: ConstantInfo + private val constantInfo: ConstantInfo, ) : NavigationVisitor() { override fun visitForeachStatement(statement: PsiForeachStatement) { if (statement.iteratedValue?.type is PsiArrayType) { @@ -197,7 +196,7 @@ class MyCollectVisitor( private val project: Project, mode: Mode, - private val constantInfo: ConstantInfo + private val constantInfo: ConstantInfo, ) : CollectVisitor(mode) { override fun accept(methodNode: MethodNode) { val elementFactory = JavaPsiFacade.getElementFactory(project) Index: src/main/kotlin/platform/mixin/handlers/injectionPoint/ConstantStringMethodInjectionPoint.kt =================================================================== --- src/main/kotlin/platform/mixin/handlers/injectionPoint/ConstantStringMethodInjectionPoint.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/handlers/injectionPoint/ConstantStringMethodInjectionPoint.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -30,7 +30,7 @@ override fun createNavigationVisitor( at: PsiAnnotation, target: MixinSelector?, - targetClass: PsiClass + targetClass: PsiClass, ): NavigationVisitor? { return target?.let { MyNavigationVisitor(targetClass, it, AtResolver.getArgs(at)["ldc"]) } } @@ -39,7 +39,7 @@ at: PsiAnnotation, target: MixinSelector?, targetClass: ClassNode, - mode: CollectVisitor.Mode + mode: CollectVisitor.Mode, ): CollectVisitor? { if (mode == CollectVisitor.Mode.COMPLETION) { return MyCollectVisitor(mode, at.project, MemberReference(""), null) @@ -50,7 +50,7 @@ private class MyNavigationVisitor( private val targetClass: PsiClass, private val selector: MixinSelector, - private val ldc: String? + private val ldc: String?, ) : NavigationVisitor() { private fun isConstantStringMethodCall(expression: PsiMethodCallExpression): Boolean { // Must return void @@ -62,7 +62,7 @@ val argumentTypes = arguments.expressionTypes val javaStringType = PsiType.getJavaLangString( expression.manager, - expression.resolveScope + expression.resolveScope, ) if (argumentTypes.size != 1 || argumentTypes[0] != javaStringType) { @@ -80,7 +80,7 @@ expression.resolveMethod()?.let { method -> val matches = selector.matchMethod( method, - QualifiedMember.resolveQualifier(expression.methodExpression) ?: targetClass + QualifiedMember.resolveQualifier(expression.methodExpression) ?: targetClass, ) if (matches) { addResult(expression) @@ -96,7 +96,7 @@ mode: Mode, private val project: Project, private val selector: MixinSelector, - private val ldc: String? + private val ldc: String?, ) : CollectVisitor(mode) { override fun accept(methodNode: MethodNode) { val insns = methodNode.instructions ?: return @@ -136,9 +136,9 @@ fakeMethod.method.findOrConstructSourceMethod( fakeMethod.clazz, project, - canDecompile = false + canDecompile = false, ), - qualifier = insn.owner.replace('/', '.') + qualifier = insn.owner.replace('/', '.'), ) } } Index: src/main/kotlin/platform/mixin/handlers/injectionPoint/FieldInjectionPoint.kt =================================================================== --- src/main/kotlin/platform/mixin/handlers/injectionPoint/FieldInjectionPoint.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/handlers/injectionPoint/FieldInjectionPoint.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -52,7 +52,7 @@ override fun createNavigationVisitor( at: PsiAnnotation, target: MixinSelector?, - targetClass: PsiClass + targetClass: PsiClass, ): NavigationVisitor? { val opcode = (at.findDeclaredAttributeValue("opcode")?.constantValue as? Int) ?.takeIf { it in VALID_OPCODES } ?: -1 @@ -65,7 +65,7 @@ at: PsiAnnotation, target: MixinSelector?, targetClass: ClassNode, - mode: CollectVisitor.Mode + mode: CollectVisitor.Mode, ): CollectVisitor? { if (mode == CollectVisitor.Mode.COMPLETION) { return MyCollectVisitor(mode, at.project, MemberReference(""), -1, null, 8) @@ -82,7 +82,7 @@ return JavaLookupElementBuilder.forField( m, m.getQualifiedMemberReference(owner).toMixinString(), - null + null, ) .setBoldIfInClass(m, targetClass) .withPresentableText(m.name) @@ -93,7 +93,7 @@ private val targetClass: PsiClass, private val selector: MixinSelector, private val opcode: Int, - private val arrayAccess: ArrayAccessType? + private val arrayAccess: ArrayAccessType?, ) : NavigationVisitor() { override fun visitReferenceExpression(expression: PsiReferenceExpression) { if (expression !is PsiMethodReferenceExpression) { @@ -103,7 +103,7 @@ (expression.resolve() as? PsiField)?.let { resolved -> var matches = selector.matchField( resolved, - QualifiedMember.resolveQualifier(expression) ?: targetClass + QualifiedMember.resolveQualifier(expression) ?: targetClass, ) if (matches && opcode != -1) { // check if we match the opcode @@ -157,7 +157,7 @@ private val selector: MixinSelector, private val opcode: Int, private val arrayAccess: ArrayAccessType?, - private val fuzz: Int + private val fuzz: Int, ) : CollectVisitor(mode) { override fun accept(methodNode: MethodNode) { val insns = methodNode.instructions ?: return @@ -180,7 +180,7 @@ val psiField = fieldNode.field.findOrConstructSourceField( fieldNode.clazz, project, - canDecompile = false + canDecompile = false, ) addResult(actualInsn, psiField, qualifier = insn.owner.replace('/', '.')) } Index: src/main/kotlin/platform/mixin/handlers/injectionPoint/HeadInjectionPoint.kt =================================================================== --- src/main/kotlin/platform/mixin/handlers/injectionPoint/HeadInjectionPoint.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/handlers/injectionPoint/HeadInjectionPoint.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -27,7 +27,7 @@ at: PsiAnnotation, target: MixinSelector?, targetClass: ClassNode, - mode: CollectVisitor.Mode + mode: CollectVisitor.Mode, ): CollectVisitor { return MyCollectVisitor(at.project, targetClass, mode) } @@ -35,14 +35,14 @@ override fun createNavigationVisitor( at: PsiAnnotation, target: MixinSelector?, - targetClass: PsiClass + targetClass: PsiClass, ): NavigationVisitor { return MyNavigationVisitor() } override fun createLookup( targetClass: ClassNode, - result: CollectVisitor.Result + result: CollectVisitor.Result, ): LookupElementBuilder? { return null } @@ -50,7 +50,7 @@ private class MyCollectVisitor( private val project: Project, private val clazz: ClassNode, - mode: Mode + mode: Mode, ) : CollectVisitor(mode) { override fun accept(methodNode: MethodNode) { val insns = methodNode.instructions ?: return Index: src/main/kotlin/platform/mixin/handlers/injectionPoint/InjectionPoint.kt =================================================================== --- src/main/kotlin/platform/mixin/handlers/injectionPoint/InjectionPoint.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/handlers/injectionPoint/InjectionPoint.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -13,6 +13,8 @@ import com.demonwav.mcdev.platform.mixin.reference.MixinSelector import com.demonwav.mcdev.platform.mixin.reference.toMixinString import com.demonwav.mcdev.platform.mixin.util.MixinConstants.Classes.SHIFT +import com.demonwav.mcdev.platform.mixin.util.fakeResolve +import com.demonwav.mcdev.platform.mixin.util.findOrConstructSourceMethod import com.demonwav.mcdev.util.constantStringValue import com.demonwav.mcdev.util.constantValue import com.demonwav.mcdev.util.equivalentTo @@ -25,6 +27,7 @@ import com.intellij.codeInsight.completion.JavaLookupElementBuilder import com.intellij.codeInsight.lookup.LookupElementBuilder import com.intellij.openapi.extensions.RequiredElement +import com.intellij.openapi.project.Project import com.intellij.openapi.util.KeyedExtensionCollector import com.intellij.psi.JavaPsiFacade import com.intellij.psi.JavaRecursiveElementVisitor @@ -48,6 +51,7 @@ import org.objectweb.asm.tree.AbstractInsnNode import org.objectweb.asm.tree.ClassNode import org.objectweb.asm.tree.InsnList +import org.objectweb.asm.tree.MethodInsnNode import org.objectweb.asm.tree.MethodNode abstract class InjectionPoint { @@ -65,21 +69,21 @@ abstract fun createNavigationVisitor( at: PsiAnnotation, target: MixinSelector?, - targetClass: PsiClass + targetClass: PsiClass, ): NavigationVisitor? abstract fun doCreateCollectVisitor( at: PsiAnnotation, target: MixinSelector?, targetClass: ClassNode, - mode: CollectVisitor.Mode + mode: CollectVisitor.Mode, ): CollectVisitor? fun createCollectVisitor( at: PsiAnnotation, target: MixinSelector?, targetClass: ClassNode, - mode: CollectVisitor.Mode + mode: CollectVisitor.Mode, ): CollectVisitor? { return doCreateCollectVisitor(at, target, targetClass, mode)?.also { addFilters(at, targetClass, it) @@ -146,7 +150,7 @@ sliceAt: PsiAnnotation?, selector: SliceSelector, insns: InsnList, - method: MethodNode + method: MethodNode, ): Int? { return sliceAt?.let { val results = AtResolver(sliceAt, targetClass, method).resolveInstructions() @@ -224,19 +228,19 @@ final override fun createLookup( targetClass: ClassNode, - result: CollectVisitor.Result + result: CollectVisitor.Result, ): LookupElementBuilder { return qualifyLookup( createLookup(targetClass, result.target, result.qualifier ?: targetClass.name), targetClass, - result.target + result.target, ) } private fun qualifyLookup( builder: LookupElementBuilder, targetClass: ClassNode, - m: T + m: T, ): LookupElementBuilder { val owner = m.containingClass ?: return builder return if (targetClass.name == owner.fullQualifiedName?.replace('.', '/')) { @@ -255,7 +259,7 @@ m, m.getQualifiedMemberReference(owner).toMixinString(), PsiSubstitutor.EMPTY, - null + null, ) .setBoldIfInClass(m, targetClass) .withPresentableText(m.internalName) // Display internal name (e.g. for constructors) @@ -350,7 +354,7 @@ protected fun addResult( insn: AbstractInsnNode, element: T, - qualifier: String? = null + qualifier: String? = null, ) { // apply shift. // being able to break out of the shift loops is important to prevent IDE freezes in case of large shift bys. @@ -390,6 +394,7 @@ } } + @Suppress("MemberVisibilityCanBePrivate") protected fun stopWalking() { throw StopWalkingException() } @@ -405,10 +410,31 @@ val originalInsn: AbstractInsnNode, val insn: AbstractInsnNode, val target: T, - val qualifier: String? = null + val qualifier: String? = null, ) enum class Mode { MATCH_ALL, MATCH_FIRST, COMPLETION } } +fun nodeMatchesSelector( + insn: MethodInsnNode, + mode: CollectVisitor.Mode, + selector: MixinSelector, + project: Project, +): PsiMethod? { + if (mode != CollectVisitor.Mode.COMPLETION) { + if (!selector.matchMethod(insn.owner, insn.name, insn.desc)) { + return null + } + } + + val fakeMethod = insn.fakeResolve() + + return fakeMethod.method.findOrConstructSourceMethod( + fakeMethod.clazz, + project, + canDecompile = false, + ) +} + typealias CollectResultFilter = (CollectVisitor.Result, MethodNode) -> Boolean Index: src/main/kotlin/platform/mixin/handlers/injectionPoint/LoadInjectionPoint.kt =================================================================== --- src/main/kotlin/platform/mixin/handlers/injectionPoint/LoadInjectionPoint.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/handlers/injectionPoint/LoadInjectionPoint.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -54,7 +54,7 @@ override fun createNavigationVisitor( at: PsiAnnotation, target: MixinSelector?, - targetClass: PsiClass + targetClass: PsiClass, ): NavigationVisitor? { val info = getModifyVariableInfo(at, null) ?: return null return MyNavigationVisitor(info, store) @@ -64,7 +64,7 @@ at: PsiAnnotation, target: MixinSelector?, targetClass: ClassNode, - mode: CollectVisitor.Mode + mode: CollectVisitor.Mode, ): CollectVisitor? { val module = at.findModule() ?: return null val info = getModifyVariableInfo(at, mode) ?: return null @@ -73,7 +73,7 @@ override fun createLookup( targetClass: ClassNode, - result: CollectVisitor.Result + result: CollectVisitor.Result, ): LookupElementBuilder? { return null } @@ -95,7 +95,7 @@ targetClass, method, localInsn, - result.originalInsn.`var` + result.originalInsn.`var`, ) ?: return@addResultFilter true val desc = localType.descriptor val ord = ordinals[desc] ?: 0 @@ -106,7 +106,7 @@ private class MyNavigationVisitor( private val info: ModifyVariableInfo, - private val store: Boolean + private val store: Boolean, ) : NavigationVisitor() { override fun visitThisExpression(expression: PsiThisExpression) { super.visitThisExpression(expression) @@ -187,25 +187,15 @@ } private fun checkImplicitLocalsPre(location: PsiElement) { - val localsHere = LocalVariables.guessLocalsAt(location, info.argsOnly, true) - val localIndex = LocalVariables.guessLocalVariableIndex(location) ?: return - val localCount = LocalVariables.getLocalVariableSize(location) - for (i in localIndex until (localIndex + localCount)) { - val local = localsHere.firstOrNull { it.index == i } ?: continue - if (store) { - repeat(local.implicitStoreCountBefore) { - addLocalUsage(location, local.name, localsHere) + checkImplicitLocals(location, true) - } + } - } else { - repeat(local.implicitLoadCountBefore) { - addLocalUsage(location, local.name, localsHere) - } - } - } - } private fun checkImplicitLocalsPost(location: PsiElement) { - val localsHere = LocalVariables.guessLocalsAt(location, info.argsOnly, false) + checkImplicitLocals(location, false) + } + + private fun checkImplicitLocals(location: PsiElement, isPre: Boolean) { + val localsHere = LocalVariables.guessLocalsAt(location, info.argsOnly, isPre) val localIndex = LocalVariables.guessLocalVariableIndex(location) ?: return val localCount = LocalVariables.getLocalVariableSize(location) for (i in localIndex until (localIndex + localCount)) { @@ -230,7 +220,7 @@ private fun addLocalUsage( location: PsiElement, name: String, - localsHere: List + localsHere: List, ) { if (info.ordinal != null) { val local = localsHere.asSequence().filter { @@ -277,7 +267,7 @@ private val targetClass: ClassNode, mode: Mode, private val info: ModifyVariableInfo, - private val store: Boolean + private val store: Boolean, ) : CollectVisitor(mode) { override fun accept(methodNode: MethodNode) { var opcode = when (info.type) { Index: src/main/kotlin/platform/mixin/handlers/injectionPoint/MethodInjectionPoint.kt =================================================================== --- src/main/kotlin/platform/mixin/handlers/injectionPoint/MethodInjectionPoint.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/handlers/injectionPoint/MethodInjectionPoint.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -11,8 +11,6 @@ package com.demonwav.mcdev.platform.mixin.handlers.injectionPoint import com.demonwav.mcdev.platform.mixin.reference.MixinSelector -import com.demonwav.mcdev.platform.mixin.util.fakeResolve -import com.demonwav.mcdev.platform.mixin.util.findOrConstructSourceMethod import com.demonwav.mcdev.util.MemberReference import com.intellij.openapi.project.Project import com.intellij.psi.CommonClassNames @@ -33,7 +31,7 @@ override fun createNavigationVisitor( at: PsiAnnotation, target: MixinSelector?, - targetClass: PsiClass + targetClass: PsiClass, ): NavigationVisitor? { return target?.let { MyNavigationVisitor(targetClass, it) } } @@ -42,7 +40,7 @@ at: PsiAnnotation, target: MixinSelector?, targetClass: ClassNode, - mode: CollectVisitor.Mode + mode: CollectVisitor.Mode, ): CollectVisitor? { if (mode == CollectVisitor.Mode.COMPLETION) { return MyCollectVisitor(mode, at.project, MemberReference("")) @@ -52,7 +50,7 @@ private class MyNavigationVisitor( private val targetClass: PsiClass, - private val selector: MixinSelector + private val selector: MixinSelector, ) : NavigationVisitor() { private fun visitMethodUsage(method: PsiMethod, qualifier: PsiClass?, expression: PsiElement) { @@ -132,28 +130,20 @@ private class MyCollectVisitor( mode: Mode, private val project: Project, - private val selector: MixinSelector + private val selector: MixinSelector, ) : CollectVisitor(mode) { override fun accept(methodNode: MethodNode) { val insns = methodNode.instructions ?: return insns.iterator().forEachRemaining { insn -> - if (insn !is MethodInsnNode) return@forEachRemaining - - if (mode != Mode.COMPLETION) { - if (!selector.matchMethod(insn.owner, insn.name, insn.desc)) { + if (insn !is MethodInsnNode) { - return@forEachRemaining - } + return@forEachRemaining + } - } - val fakeMethod = insn.fakeResolve() + val sourceMethod = nodeMatchesSelector(insn, mode, selector, project) ?: return@forEachRemaining addResult( insn, - fakeMethod.method.findOrConstructSourceMethod( - fakeMethod.clazz, - project, - canDecompile = false - ), - qualifier = insn.owner.replace('/', '.') + sourceMethod, + qualifier = insn.owner.replace('/', '.'), ) } } Index: src/main/kotlin/platform/mixin/handlers/injectionPoint/NewInsnInjectionPoint.kt =================================================================== --- src/main/kotlin/platform/mixin/handlers/injectionPoint/NewInsnInjectionPoint.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/handlers/injectionPoint/NewInsnInjectionPoint.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -14,8 +14,6 @@ import com.demonwav.mcdev.platform.mixin.reference.MixinSelectorParser import com.demonwav.mcdev.platform.mixin.reference.toMixinString import com.demonwav.mcdev.platform.mixin.util.MixinConstants.Annotations.AT -import com.demonwav.mcdev.platform.mixin.util.fakeResolve -import com.demonwav.mcdev.platform.mixin.util.findOrConstructSourceMethod import com.demonwav.mcdev.platform.mixin.util.shortName import com.demonwav.mcdev.util.MemberReference import com.demonwav.mcdev.util.constantStringValue @@ -58,7 +56,7 @@ override fun createNavigationVisitor( at: PsiAnnotation, target: MixinSelector?, - targetClass: PsiClass + targetClass: PsiClass, ): NavigationVisitor? { return getTarget(at, target)?.let { MyNavigationVisitor(it) } } @@ -67,7 +65,7 @@ at: PsiAnnotation, target: MixinSelector?, targetClass: ClassNode, - mode: CollectVisitor.Mode + mode: CollectVisitor.Mode, ): CollectVisitor? { if (mode == CollectVisitor.Mode.COMPLETION) { return MyCollectVisitor(mode, at.project, MemberReference("")) @@ -87,7 +85,7 @@ target, target.getQualifiedMemberReference(result.qualifier).toMixinString(), PsiSubstitutor.EMPTY, - null + null, ) .setBoldIfInClass(target, targetClass) .withPresentableText(ownerName + "." + target.internalName) @@ -98,7 +96,7 @@ } private class MyNavigationVisitor( - private val selector: MixinSelector + private val selector: MixinSelector, ) : NavigationVisitor() { override fun visitNewExpression(expression: PsiNewExpression) { val anonymousName = expression.anonymousClass?.fullQualifiedName?.replace('.', '/') @@ -110,7 +108,7 @@ val bytecodeArgTypes = if (thisType != null) listOf(thisType) + argTypes else argTypes val methodDesc = Type.getMethodDescriptor( Type.VOID_TYPE, - *bytecodeArgTypes.mapToArray { Type.getType(it) } + *bytecodeArgTypes.mapToArray { Type.getType(it) }, ) if (selector.matchMethod(anonymousName, "", methodDesc)) { addResult(expression) @@ -131,7 +129,7 @@ private class MyCollectVisitor( mode: Mode, private val project: Project, - private val selector: MixinSelector + private val selector: MixinSelector, ) : CollectVisitor(mode) { override fun accept(methodNode: MethodNode) { val insns = methodNode.instructions ?: return @@ -139,21 +137,12 @@ if (insn !is TypeInsnNode) return@forEachRemaining if (insn.opcode != Opcodes.NEW) return@forEachRemaining val initCall = findInitCall(insn) ?: return@forEachRemaining - if (mode != Mode.COMPLETION) { - if (!selector.matchMethod(initCall.owner, initCall.name, initCall.desc)) { - return@forEachRemaining - } - } - val targetMethod = initCall.fakeResolve() + val sourceMethod = nodeMatchesSelector(initCall, mode, selector, project) ?: return@forEachRemaining addResult( insn, - targetMethod.method.findOrConstructSourceMethod( - targetMethod.clazz, - project, - canDecompile = false - ), - qualifier = insn.desc.replace('/', '.') + sourceMethod, + qualifier = initCall.owner.replace('/', '.'), ) } } Index: src/main/kotlin/platform/mixin/handlers/injectionPoint/ReturnInjectionPoint.kt =================================================================== --- src/main/kotlin/platform/mixin/handlers/injectionPoint/ReturnInjectionPoint.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/handlers/injectionPoint/ReturnInjectionPoint.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -36,7 +36,7 @@ override fun createNavigationVisitor( at: PsiAnnotation, target: MixinSelector?, - targetClass: PsiClass + targetClass: PsiClass, ): NavigationVisitor { return MyNavigationVisitor(tailOnly) } @@ -45,14 +45,14 @@ at: PsiAnnotation, target: MixinSelector?, targetClass: ClassNode, - mode: CollectVisitor.Mode + mode: CollectVisitor.Mode, ): CollectVisitor { return MyCollectVisitor(at.project, mode, tailOnly) } override fun createLookup( targetClass: ClassNode, - result: CollectVisitor.Result + result: CollectVisitor.Result, ): LookupElementBuilder? { return null } @@ -116,7 +116,7 @@ private class MyCollectVisitor( private val project: Project, mode: Mode, - private val tailOnly: Boolean + private val tailOnly: Boolean, ) : CollectVisitor(mode) { override fun accept(methodNode: MethodNode) { val insns = methodNode.instructions ?: return Index: src/main/kotlin/platform/mixin/insight/MixinEntryPoint.kt =================================================================== --- src/main/kotlin/platform/mixin/insight/MixinEntryPoint.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/insight/MixinEntryPoint.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -12,6 +12,7 @@ import com.demonwav.mcdev.platform.mixin.handlers.InjectorAnnotationHandler import com.demonwav.mcdev.platform.mixin.handlers.MixinAnnotationHandler +import com.demonwav.mcdev.platform.mixin.util.isMixinEntryPoint import com.demonwav.mcdev.util.toTypedArray import com.intellij.codeInspection.reference.RefElement import com.intellij.codeInspection.visibility.EntryPointWithVisibilityLevel @@ -25,7 +26,7 @@ class MixinEntryPoint : EntryPointWithVisibilityLevel() { @JvmField - var MIXIN_ENTRY_POINT = true + var mixinEntryPoint = true override fun getId() = "mixin" override fun getDisplayName() = "Mixin injectors" @@ -39,20 +40,7 @@ .map { (name, _) -> name } .toTypedArray() - override fun isEntryPoint(element: PsiElement): Boolean { - if (element !is PsiMethod) { - return false - } - val project = element.project - for (annotation in element.annotations) { - val qName = annotation.qualifiedName ?: continue - val handler = MixinAnnotationHandler.forMixinAnnotation(qName, project) - if (handler != null && handler.isEntryPoint) { - return true - } - } - return false - } + override fun isEntryPoint(element: PsiElement) = isMixinEntryPoint(element) override fun isEntryPoint(refElement: RefElement, psiElement: PsiElement) = isEntryPoint(psiElement) @@ -71,9 +59,9 @@ return -1 } - override fun isSelected() = MIXIN_ENTRY_POINT + override fun isSelected() = mixinEntryPoint override fun setSelected(selected: Boolean) { - MIXIN_ENTRY_POINT = selected + mixinEntryPoint = selected } override fun readExternal(element: Element) = XmlSerializer.serializeInto(this, element) Index: src/main/kotlin/platform/mixin/insight/MixinLineMarkerProvider.kt =================================================================== --- src/main/kotlin/platform/mixin/insight/MixinLineMarkerProvider.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/insight/MixinLineMarkerProvider.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -47,7 +47,7 @@ { "Go to target class" }, this, GutterIconRenderer.Alignment.LEFT, - { "mixin target class indicator" } + { "mixin target class indicator" }, ) } @@ -62,7 +62,7 @@ targets.toTypedArray(), "Choose target class of $name", null, - PsiClassListCellRenderer() + PsiClassListCellRenderer(), ) } } Index: src/main/kotlin/platform/mixin/insight/MixinTargetLineMarkerProvider.kt =================================================================== --- src/main/kotlin/platform/mixin/insight/MixinTargetLineMarkerProvider.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/insight/MixinTargetLineMarkerProvider.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -70,14 +70,14 @@ { "Go to the $simpleName target" }, MixinGutterIconNavigationHandler(identifier.createSmartPointer(), annotation.createSmartPointer(), handler), GutterIconRenderer.Alignment.LEFT, - { "mixin $simpleName target indicator" } + { "mixin $simpleName target indicator" }, ) } private class MixinGutterIconNavigationHandler( private val identifierPointer: SmartPsiElementPointer, private val annotationPointer: SmartPsiElementPointer, - private val handler: MixinAnnotationHandler + private val handler: MixinAnnotationHandler, ) : GutterIconNavigationHandler { override fun navigate(e: MouseEvent, elt: PsiIdentifier) { val element = identifierPointer.element ?: return @@ -92,7 +92,7 @@ if (editor != null) { HintManager.getInstance().showErrorHint( editor, - "Cannot find corresponding element in source code" + "Cannot find corresponding element in source code", ) } } Index: src/main/kotlin/platform/mixin/inspection/MixinAnnotationAttributeInspection.kt =================================================================== --- src/main/kotlin/platform/mixin/inspection/MixinAnnotationAttributeInspection.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/inspection/MixinAnnotationAttributeInspection.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -20,7 +20,7 @@ abstract class MixinAnnotationAttributeInspection( private val annotation: String?, - private val attribute: String? + private val attribute: String?, ) : MixinInspection() { constructor(attribute: String?) : this(null, attribute) @@ -28,7 +28,7 @@ protected abstract fun visitAnnotationAttribute( annotation: PsiAnnotation, value: PsiAnnotationMemberValue, - holder: ProblemsHolder + holder: ProblemsHolder, ) final override fun buildVisitor(holder: ProblemsHolder): PsiElementVisitor = Visitor(holder) Index: src/main/kotlin/platform/mixin/inspection/MixinAnnotationsInspection.kt =================================================================== --- src/main/kotlin/platform/mixin/inspection/MixinAnnotationsInspection.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/inspection/MixinAnnotationsInspection.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -43,7 +43,7 @@ holder.registerProblem( annotation, "@${annotation.nameReferenceElement?.text} can be only used in a @Mixin class", - RemoveAnnotationQuickFix(annotation, null) + RemoveAnnotationQuickFix(annotation, null), ) } } Index: src/main/kotlin/platform/mixin/inspection/MixinCancellableInspection.kt =================================================================== --- src/main/kotlin/platform/mixin/inspection/MixinCancellableInspection.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/inspection/MixinCancellableInspection.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -77,14 +77,14 @@ method.nameIdentifier ?: method, "@Inject must be marked as cancellable in order to be cancelled", ProblemHighlightType.GENERIC_ERROR_OR_WARNING, - MakeInjectCancellableFix(injectAnnotation) + MakeInjectCancellableFix(injectAnnotation), ) } else if (!definitelyUsesCancel && !mayUseCancel && isCancellable) { holder.registerProblem( cancellableAttribute.parent, "@Inject is cancellable but is never cancelled", ProblemHighlightType.GENERIC_ERROR_OR_WARNING, - RemoveInjectCancellableFix(injectAnnotation) + RemoveInjectCancellableFix(injectAnnotation), ) } } @@ -102,7 +102,7 @@ file: PsiFile, editor: Editor?, startElement: PsiElement, - endElement: PsiElement + endElement: PsiElement, ) { val annotation = startElement as PsiAnnotation val value = PsiElementFactory.getInstance(project).createExpressionFromText("true", annotation) @@ -122,7 +122,7 @@ file: PsiFile, editor: Editor?, startElement: PsiElement, - endElement: PsiElement + endElement: PsiElement, ) { val annotation = startElement as PsiAnnotation annotation.setDeclaredAttributeValue("cancellable", null) Index: src/main/kotlin/platform/mixin/inspection/MixinInnerClassInspection.kt =================================================================== --- src/main/kotlin/platform/mixin/inspection/MixinInnerClassInspection.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/inspection/MixinInnerClassInspection.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -35,7 +35,7 @@ if (outerClass is PsiAnonymousClass && outerClass.parentOfType()?.isMixin == true) { holder.registerProblem( psiClass, - "Inner class not allowed inside anonymous classes inside mixins" + "Inner class not allowed inside anonymous classes inside mixins", ) } @@ -49,7 +49,7 @@ holder.registerProblem( psiClass.modifierList!!, "@Mixin inner class must be static", - QuickFixFactory.getInstance().createModifierListFix(psiClass, PsiModifier.STATIC, true, false) + QuickFixFactory.getInstance().createModifierListFix(psiClass, PsiModifier.STATIC, true, false), ) } } else { Index: src/main/kotlin/platform/mixin/inspection/MixinSuperClassInspection.kt =================================================================== --- src/main/kotlin/platform/mixin/inspection/MixinSuperClassInspection.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/inspection/MixinSuperClassInspection.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -55,7 +55,7 @@ reportSuperClass( psiClass, "Cannot find '${superClass.shortName}' " + - "in the hierarchy of target class '${targetClass.shortName}'" + "in the hierarchy of target class '${targetClass.shortName}'", ) } } @@ -69,7 +69,7 @@ ) { reportSuperClass( psiClass, - "Cannot find '${targetClass.shortName}' in the hierarchy of the super mixin" + "Cannot find '${targetClass.shortName}' in the hierarchy of the super mixin", ) } } Index: src/main/kotlin/platform/mixin/inspection/StaticMemberInspection.kt =================================================================== --- src/main/kotlin/platform/mixin/inspection/StaticMemberInspection.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/inspection/StaticMemberInspection.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -47,7 +47,7 @@ holder.registerProblem( member, "Public static members are not allowed in Mixin classes", - QuickFixFactory.getInstance().createModifierListFix(member, PsiModifier.PRIVATE, true, false) + QuickFixFactory.getInstance().createModifierListFix(member, PsiModifier.PRIVATE, true, false), ) } } Index: src/main/kotlin/platform/mixin/inspection/UnusedMixinInspection.kt =================================================================== --- src/main/kotlin/platform/mixin/inspection/UnusedMixinInspection.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/inspection/UnusedMixinInspection.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -57,7 +57,7 @@ val bestQuickFixConfig = MixinModule.getBestWritableConfigForMixinClass( module.project, GlobalSearchScope.moduleScope(module), - clazz.fullQualifiedName ?: "" + clazz.fullQualifiedName ?: "", ) val problematicElement = clazz.nameIdentifier if (problematicElement != null) { @@ -84,7 +84,7 @@ private class QuickFix( private val quickFixFile: VirtualFile, private val qualifiedName: String, - private val side: Side + private val side: Side, ) : LocalQuickFix { private val sideDisplayName = when (side) { Index: src/main/kotlin/platform/mixin/inspection/implements/DuplicateInterfaceInspection.kt =================================================================== --- src/main/kotlin/platform/mixin/inspection/implements/DuplicateInterfaceInspection.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/inspection/implements/DuplicateInterfaceInspection.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -29,7 +29,7 @@ override fun visitAnnotationAttribute( annotation: PsiAnnotation, value: PsiAnnotationMemberValue, - holder: ProblemsHolder + holder: ProblemsHolder, ) { val interfaces = value.findAnnotations().ifEmpty { return } Index: src/main/kotlin/platform/mixin/inspection/implements/DuplicateInterfacePrefixInspection.kt =================================================================== --- src/main/kotlin/platform/mixin/inspection/implements/DuplicateInterfacePrefixInspection.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/inspection/implements/DuplicateInterfacePrefixInspection.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -26,7 +26,7 @@ override fun visitAnnotationAttribute( annotation: PsiAnnotation, value: PsiAnnotationMemberValue, - holder: ProblemsHolder + holder: ProblemsHolder, ) { val interfaces = value.findAnnotations().ifEmpty { return } Index: src/main/kotlin/platform/mixin/inspection/implements/EmptyImplementsInspection.kt =================================================================== --- src/main/kotlin/platform/mixin/inspection/implements/EmptyImplementsInspection.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/inspection/implements/EmptyImplementsInspection.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -37,7 +37,7 @@ holder.registerProblem( annotation, "@Implements is redundant", - RemoveAnnotationQuickFix(annotation, null) + RemoveAnnotationQuickFix(annotation, null), ) } } Index: src/main/kotlin/platform/mixin/inspection/implements/InterfaceIsInterfaceInspection.kt =================================================================== --- src/main/kotlin/platform/mixin/inspection/implements/InterfaceIsInterfaceInspection.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/inspection/implements/InterfaceIsInterfaceInspection.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -24,7 +24,7 @@ override fun visitAnnotationAttribute( annotation: PsiAnnotation, value: PsiAnnotationMemberValue, - holder: ProblemsHolder + holder: ProblemsHolder, ) { val psiClass = value.resolveClass() ?: return if (!psiClass.isInterface) { Index: src/main/kotlin/platform/mixin/inspection/implements/InterfacePrefixInspection.kt =================================================================== --- src/main/kotlin/platform/mixin/inspection/implements/InterfacePrefixInspection.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/inspection/implements/InterfacePrefixInspection.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -25,7 +25,7 @@ override fun visitAnnotationAttribute( annotation: PsiAnnotation, value: PsiAnnotationMemberValue, - holder: ProblemsHolder + holder: ProblemsHolder, ) { val prefix = value.constantStringValue ?: return if (!prefix.endsWith('$')) { Index: src/main/kotlin/platform/mixin/inspection/implements/SoftImplementOverridesInspection.kt =================================================================== --- src/main/kotlin/platform/mixin/inspection/implements/SoftImplementOverridesInspection.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/inspection/implements/SoftImplementOverridesInspection.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -30,7 +30,7 @@ if (method.isSoftImplementMissingParent()) { holder.registerProblem( method.nameIdentifier ?: method, - "Method does not soft-implement a method from its interfaces" + "Method does not soft-implement a method from its interfaces", ) } } Index: src/main/kotlin/platform/mixin/inspection/injector/ImplicitConstructorInvokerInspection.kt =================================================================== --- src/main/kotlin/platform/mixin/inspection/injector/ImplicitConstructorInvokerInspection.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/inspection/injector/ImplicitConstructorInvokerInspection.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -36,7 +36,7 @@ holder.registerProblem( invokerAnnotation.nameReferenceElement ?: return, "Implicit constructor invokers should be explicit (fails outside of dev)", - ImplicitConstructorInvokerQuickFix(invokerAnnotation) + ImplicitConstructorInvokerQuickFix(invokerAnnotation), ) } } @@ -47,7 +47,7 @@ override fun getStaticDescription() = "Implicit constructor invoker (fails outside of dev)" private class ImplicitConstructorInvokerQuickFix( - annotation: PsiAnnotation + annotation: PsiAnnotation, ) : LocalQuickFixOnPsiElement(annotation) { override fun getFamilyName() = "Make constructor invoker explicit" override fun getText() = "Make constructor invoker explicit" Index: src/main/kotlin/platform/mixin/inspection/injector/InjectIntoConstructorInspection.kt =================================================================== --- src/main/kotlin/platform/mixin/inspection/injector/InjectIntoConstructorInspection.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/inspection/injector/InjectIntoConstructorInspection.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -67,7 +67,7 @@ if (instructions.any { it.insn.opcode != Opcodes.RETURN }) { holder.registerProblem( problemElement, - "Cannot inject into constructors at non-return instructions" + "Cannot inject into constructors at non-return instructions", ) return } Index: src/main/kotlin/platform/mixin/inspection/injector/InvalidInjectorMethodSignatureInspection.kt =================================================================== --- src/main/kotlin/platform/mixin/inspection/injector/InvalidInjectorMethodSignatureInspection.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/inspection/injector/InvalidInjectorMethodSignatureInspection.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -80,7 +80,7 @@ val insns = handler.resolveInstructions( annotation, targetMethod.clazz, - targetMethod.method + targetMethod.method, ) shouldBeStatic = insns.any { methodInsns.indexOf(it.insn) <= methodInsns.indexOf(superCtorCall) @@ -97,9 +97,9 @@ modifiers, PsiModifier.STATIC, true, - false + false, + ), - ) + ) - ) } } @@ -109,7 +109,7 @@ val possibleSignatures = handler.expectedMethodSignature( annotation, targetMethod.clazz, - targetMethod.method + targetMethod.method, ) ?: continue val annotationName = annotation.nameReferenceElement?.referenceName @@ -118,7 +118,7 @@ reportedSignature = true holder.registerProblem( parameters, - "There are no possible signatures for this injector" + "There are no possible signatures for this injector", ) continue } @@ -149,7 +149,7 @@ "Method parameters do not match expected parameters for $annotationName" val quickFix = ParametersQuickFix( expectedParameters, - handler is InjectAnnotationHandler + handler is InjectAnnotationHandler, ) if (checkResult == CheckResult.ERROR) { holder.registerProblem(parameters, description, quickFix) @@ -158,7 +158,7 @@ parameters, description, ProblemHighlightType.WARNING, - quickFix + quickFix, ) } } @@ -176,9 +176,9 @@ QuickFixFactory.getInstance().createMethodReturnFix( method, expectedReturnType, - false + false, + ), - ) + ) - ) } } } @@ -211,7 +211,7 @@ expectedReturnType: PsiType, methodReturnType: PsiType, method: PsiMethod, - allowCoerce: Boolean + allowCoerce: Boolean, ): Boolean { val expectedErasure = TypeConversionUtil.erasure(expectedReturnType) val returnErasure = TypeConversionUtil.erasure(methodReturnType) @@ -230,7 +230,7 @@ private fun checkParameters( parameterList: PsiParameterList, expected: List, - allowCoerce: Boolean + allowCoerce: Boolean, ): CheckResult { val parameters = parameterList.parameters val parametersWithoutSugar = parameters.dropLastWhile { it.isMixinExtrasSugar }.toTypedArray() @@ -280,7 +280,7 @@ private class ParametersQuickFix( private val expected: List, - isInject: Boolean + isInject: Boolean, ) : LocalQuickFix { private val fixName = if (isInject) { @@ -311,7 +311,7 @@ p.name ?: JavaCodeStyleManager.getInstance(project) .suggestVariableName(VariableKind.PARAMETER, null, null, p.type).names .firstOrNull() ?: "var$i", - p.type + p.type, ) } } else { Index: src/main/kotlin/platform/mixin/inspection/injector/ParameterGroup.kt =================================================================== --- src/main/kotlin/platform/mixin/inspection/injector/ParameterGroup.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/inspection/injector/ParameterGroup.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -22,7 +22,7 @@ val parameters: List, val required: RequiredLevel = RequiredLevel.ERROR_IF_ABSENT, val default: Boolean = required != RequiredLevel.OPTIONAL, - val isVarargs: Boolean = false + val isVarargs: Boolean = false, ) { val size Index: src/main/kotlin/platform/mixin/inspection/overwrite/OverwriteAuthorInspection.kt =================================================================== --- src/main/kotlin/platform/mixin/inspection/overwrite/OverwriteAuthorInspection.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/inspection/overwrite/OverwriteAuthorInspection.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -47,7 +47,7 @@ holder.registerProblem( element, "@Overwrite methods must have an associated JavaDoc with a filled in @$tag tag", - QuickFix(tag) + QuickFix(tag), ) } @@ -55,7 +55,7 @@ holder.registerProblem( element, "@Overwrite methods must have an associated JavaDoc with filled in @author and @reason tags", - QuickFix() + QuickFix(), ) } @@ -75,7 +75,7 @@ method.addBefore( JavaPsiFacade.getElementFactory(project) .createDocCommentFromText("/**\n * @author \n * @reason \n */"), - method.modifierList + method.modifierList, ) return } Index: src/main/kotlin/platform/mixin/inspection/overwrite/OverwriteModifiersInspection.kt =================================================================== --- src/main/kotlin/platform/mixin/inspection/overwrite/OverwriteModifiersInspection.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/inspection/overwrite/OverwriteModifiersInspection.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -53,7 +53,7 @@ modifierList.findKeyword(currentModifier) ?: nameIdentifier, "$currentModifier @Overwrite cannot reduce visibility of " + "${PsiUtil.getAccessModifier(targetAccessLevel)} target method", - QuickFixFactory.getInstance().createModifierListFix(modifierList, targetModifier, true, false) + QuickFixFactory.getInstance().createModifierListFix(modifierList, targetModifier, true, false), ) } @@ -82,7 +82,7 @@ holder.registerProblem( marker, message, - QuickFixFactory.getInstance().createModifierListFix(modifierList, modifier, targetModifier, false) + QuickFixFactory.getInstance().createModifierListFix(modifierList, modifier, targetModifier, false), ) } } @@ -101,13 +101,13 @@ nameIdentifier, "Missing @${internalNameToShortName(internalName)} annotation", ProblemHighlightType.WARNING, - AddAnnotationFix(qualifiedName, method, targetAnnPsi.parameterList.attributes) + AddAnnotationFix(qualifiedName, method, targetAnnPsi.parameterList.attributes), ) } else { holder.registerProblem( nameIdentifier, "Missing @${internalNameToShortName(internalName)} annotation", - ProblemHighlightType.WARNING + ProblemHighlightType.WARNING, ) } } Index: src/main/kotlin/platform/mixin/inspection/reference/AmbiguousReferenceInspection.kt =================================================================== --- src/main/kotlin/platform/mixin/inspection/reference/AmbiguousReferenceInspection.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/inspection/reference/AmbiguousReferenceInspection.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -34,7 +34,7 @@ override fun visitAnnotationAttribute( annotation: PsiAnnotation, value: PsiAnnotationMemberValue, - holder: ProblemsHolder + holder: ProblemsHolder, ) { val qName = annotation.qualifiedName ?: return val handler = MixinAnnotationHandler.forMixinAnnotation(qName, annotation.project) @@ -57,7 +57,7 @@ holder.registerProblem( value, "Ambiguous reference to method '${ambiguousReference.name}' in target class", - QuickFix + QuickFix, ) } Index: src/main/kotlin/platform/mixin/inspection/reference/InvalidMemberReferenceInspection.kt =================================================================== --- src/main/kotlin/platform/mixin/inspection/reference/InvalidMemberReferenceInspection.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/inspection/reference/InvalidMemberReferenceInspection.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -33,7 +33,7 @@ |Reports invalid usages of member references in Mixin annotations. Two different formats are supported by Mixin: | - Lcom/example/ExampleClass;execute(II)V | - com.example.ExampleClass.execute(II)V - """.trimMargin() + """.trimMargin() override fun buildVisitor(holder: ProblemsHolder): PsiElementVisitor = Visitor(holder) Index: src/main/kotlin/platform/mixin/inspection/reference/UnnecessaryQualifiedMemberReferenceInspection.kt =================================================================== --- src/main/kotlin/platform/mixin/inspection/reference/UnnecessaryQualifiedMemberReferenceInspection.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/inspection/reference/UnnecessaryQualifiedMemberReferenceInspection.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -33,7 +33,7 @@ override fun visitAnnotationAttribute( annotation: PsiAnnotation, value: PsiAnnotationMemberValue, - holder: ProblemsHolder + holder: ProblemsHolder, ) { val qName = annotation.qualifiedName ?: return if (MixinAnnotationHandler.forMixinAnnotation(qName, annotation.project) !is InjectorAnnotationHandler) { @@ -52,7 +52,7 @@ holder.registerProblem( value, "Unnecessary qualified reference to '${selector.displayName}' in target class", - QuickFix(selector) + QuickFix(selector), ) } } @@ -65,7 +65,7 @@ val element = descriptor.psiElement element.replace( JavaPsiFacade.getElementFactory(project) - .createExpressionFromText("\"${reference.withoutOwner.toMixinString()}\"", element) + .createExpressionFromText("\"${reference.withoutOwner.toMixinString()}\"", element), ) } } Index: src/main/kotlin/platform/mixin/inspection/reference/UnqualifiedMemberReferenceInspection.kt =================================================================== --- src/main/kotlin/platform/mixin/inspection/reference/UnqualifiedMemberReferenceInspection.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/inspection/reference/UnqualifiedMemberReferenceInspection.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -25,7 +25,7 @@ override fun visitAnnotationAttribute( annotation: PsiAnnotation, value: PsiAnnotationMemberValue, - holder: ProblemsHolder + holder: ProblemsHolder, ) { // Check if the specified target reference uses member descriptors if (!AtResolver.usesMemberReference(annotation)) { Index: src/main/kotlin/platform/mixin/inspection/reference/UnresolvedReferenceInspection.kt =================================================================== --- src/main/kotlin/platform/mixin/inspection/reference/UnresolvedReferenceInspection.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/inspection/reference/UnresolvedReferenceInspection.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -63,7 +63,7 @@ holder.registerProblem( value, "Cannot resolve ${resolver.description}".format(value.constantStringValue), - ProblemHighlightType.LIKE_UNKNOWN_SYMBOL + ProblemHighlightType.LIKE_UNKNOWN_SYMBOL, ) } } Index: src/main/kotlin/platform/mixin/inspection/shadow/ShadowFieldPrefixInspection.kt =================================================================== --- src/main/kotlin/platform/mixin/inspection/shadow/ShadowFieldPrefixInspection.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/inspection/shadow/ShadowFieldPrefixInspection.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -52,9 +52,9 @@ "Cannot use prefix for @Shadow fields", QuickFixFactory.getInstance().createRenameElementFix( field, - fieldName.removePrefix(DEFAULT_SHADOW_PREFIX) + fieldName.removePrefix(DEFAULT_SHADOW_PREFIX), + ), - ) + ) - ) } } } Index: src/main/kotlin/platform/mixin/inspection/shadow/ShadowFinalInspection.kt =================================================================== --- src/main/kotlin/platform/mixin/inspection/shadow/ShadowFinalInspection.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/inspection/shadow/ShadowFinalInspection.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -40,7 +40,7 @@ holder.registerProblem( expression, "@Final fields cannot be modified", - AddAnnotationFix(MUTABLE, resolved) + AddAnnotationFix(MUTABLE, resolved), ) } } Index: src/main/kotlin/platform/mixin/inspection/shadow/ShadowModifiersInspection.kt =================================================================== --- src/main/kotlin/platform/mixin/inspection/shadow/ShadowModifiersInspection.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/inspection/shadow/ShadowModifiersInspection.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -70,9 +70,9 @@ shadowModifierList, PsiModifier.STATIC, targetStatic, - false + false, + ), - ) + ) - ) } // Check access level @@ -85,7 +85,8 @@ shadowModifierList.findKeyword(shadowModifier) ?: annotation, "Invalid access modifiers, has: $shadowModifier, but target member has: " + PsiUtil.getAccessModifier(targetAccessLevel), - QuickFixFactory.getInstance().createModifierListFix(shadowModifierList, targetModifier, true, false) + QuickFixFactory.getInstance() + .createModifierListFix(shadowModifierList, targetModifier, true, false) ) } @@ -102,13 +103,13 @@ holder.registerProblem( annotation, "@Shadow for final member should be annotated as @Final", - AddAnnotationFix(FINAL, member) + AddAnnotationFix(FINAL, member), ) } else { holder.registerProblem( shadowFinal!!, "Target method is not final", - RemoveAnnotationQuickFix(shadowFinal, member) + RemoveAnnotationQuickFix(shadowFinal, member), ) } } Index: src/main/kotlin/platform/mixin/inspection/shadow/UnusedShadowMethodPrefixInspection.kt =================================================================== --- src/main/kotlin/platform/mixin/inspection/shadow/UnusedShadowMethodPrefixInspection.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/inspection/shadow/UnusedShadowMethodPrefixInspection.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -37,7 +37,7 @@ holder.registerProblem( prefixValue, "Unused @Shadow prefix", - RemoveAnnotationAttributeQuickFix("@Shadow", "prefix") + RemoveAnnotationAttributeQuickFix("@Shadow", "prefix"), ) } } Index: src/main/kotlin/platform/mixin/inspection/suppress/DefaultAnnotationParamInspectionSuppressor.kt =================================================================== --- src/main/kotlin/platform/mixin/inspection/suppress/DefaultAnnotationParamInspectionSuppressor.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/inspection/suppress/DefaultAnnotationParamInspectionSuppressor.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -82,7 +82,7 @@ REDIRECT, ACCESSOR, INVOKER, - MIXIN + MIXIN, ) private val CONSTANT_SUPPRESSED = setOf( "intValue", @@ -90,7 +90,7 @@ "longValue", "doubleValue", "stringValue", - "classValue" + "classValue", ) } } Index: src/main/kotlin/platform/mixin/inspection/suppress/DynamicInspectionSuppressor.kt =================================================================== --- src/main/kotlin/platform/mixin/inspection/suppress/DynamicInspectionSuppressor.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/inspection/suppress/DynamicInspectionSuppressor.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -27,7 +27,7 @@ "ShadowModifiers", "UnqualifiedMemberReference", "UnnecessaryQualifiedMemberReference", - "UnresolvedMixinReference" + "UnresolvedMixinReference", ) override fun isSuppressedFor(element: PsiElement, toolId: String): Boolean { Index: src/main/kotlin/platform/mixin/inspection/suppress/ShadowOverwriteInspectionSuppressor.kt =================================================================== --- src/main/kotlin/platform/mixin/inspection/suppress/ShadowOverwriteInspectionSuppressor.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/inspection/suppress/ShadowOverwriteInspectionSuppressor.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -26,7 +26,7 @@ "SameParameterValue", "Guava", VisibilityInspection.SHORT_NAME, - "MethodMayBeStatic" + "MethodMayBeStatic", ) override fun isSuppressedFor(element: PsiElement, toolId: String): Boolean { Index: src/main/kotlin/platform/mixin/reference/AbstractMethodReference.kt =================================================================== --- src/main/kotlin/platform/mixin/reference/AbstractMethodReference.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/reference/AbstractMethodReference.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -112,7 +112,7 @@ private fun resolve( targets: Collection, - selector: MixinSelector + selector: MixinSelector, ): Sequence { return targets.asSequence() .flatMap { target -> target.findMethods(selector).map { ClassAndMethodNode(target, it) } } @@ -135,7 +135,7 @@ val targetReference = parseSelector(method, context) ?: return@flatMap emptySequence() if (targetReference is MemberReference && targetReference.descriptor == null && isAmbiguous( targets, - targetReference + targetReference, ) ) { return@flatMap emptySequence() @@ -150,7 +150,7 @@ it.clazz, context.project, scope = context.resolveScope, - canDecompile = true + canDecompile = true, ) }?.toTypedArray() } @@ -161,7 +161,7 @@ it.clazz, context.project, scope = context.resolveScope, - canDecompile = false + canDecompile = false, ) }?.toResolveResults() ?: ResolveResult.EMPTY_ARRAY } @@ -227,7 +227,7 @@ private fun createLookup( context: PsiElement, methods: Sequence, - uniqueMethods: Set + uniqueMethods: Set, ): Array { return methods .map { m -> @@ -241,13 +241,13 @@ m.clazz, context.project, scope = context.resolveScope, - canDecompile = false + canDecompile = false, ) val builder = JavaLookupElementBuilder.forMethod( sourceMethod, targetMethodInfo.toMixinString(), PsiSubstitutor.EMPTY, - null + null, ) .withPresentableText(m.method.name) addCompletionInfo(builder, context, targetMethodInfo) @@ -259,7 +259,7 @@ open fun addCompletionInfo( builder: LookupElementBuilder, context: PsiElement, - targetMethodInfo: MemberReference + targetMethodInfo: MemberReference, ): LookupElementBuilder { return builder.completeToLiteral(context) } Index: src/main/kotlin/platform/mixin/reference/DescGTDHandler.kt =================================================================== --- src/main/kotlin/platform/mixin/reference/DescGTDHandler.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/reference/DescGTDHandler.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -20,7 +20,7 @@ override fun getGotoDeclarationTargets( sourceElement: PsiElement?, offset: Int, - editor: Editor? + editor: Editor?, ): Array? { if (sourceElement == null) return null val stringLiteral = sourceElement.parentOfType() ?: return null Index: src/main/kotlin/platform/mixin/reference/DescReference.kt =================================================================== --- src/main/kotlin/platform/mixin/reference/DescReference.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/reference/DescReference.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -38,7 +38,7 @@ object DescReference : AbstractMethodReference() { val ELEMENT_PATTERN: ElementPattern = PsiJavaPatterns.psiLiteral(StandardPatterns.string()).insideAnnotationParam( - StandardPatterns.string().equalTo(DESC) + StandardPatterns.string().equalTo(DESC), ) override val description = "method '%s'" @@ -59,7 +59,7 @@ override fun addCompletionInfo( builder: LookupElementBuilder, context: PsiElement, - targetMethodInfo: MemberReference + targetMethodInfo: MemberReference, ): LookupElementBuilder { return builder.withInsertHandler { insertionContext, _ -> insertionContext.laterRunnable = @@ -72,11 +72,11 @@ private class CompleteDescReference( private val editor: Editor, private val file: PsiFile, - private val targetMethodInfo: MemberReference + private val targetMethodInfo: MemberReference, ) : Runnable { private fun PsiElementFactory.createAnnotationMemberValueFromText( text: String, - context: PsiElement? + context: PsiElement?, ): PsiAnnotationMemberValue { val annotation = this.createAnnotationFromText("@Foo($text)", context) return annotation.findDeclaredAttributeValue("value")!! @@ -97,9 +97,9 @@ "value", elementFactory.createExpressionFromText( "\"${StringUtil.escapeStringCharacters(targetMethodInfo.name)}\"", - descAnnotation + descAnnotation, + ), - ) + ) - ) val desc = targetMethodInfo.descriptor ?: return@runWriteAction val argTypes = Type.getArgumentTypes(desc) if (argTypes.isNotEmpty()) { @@ -114,7 +114,7 @@ } descAnnotation.setDeclaredAttributeValue( "args", - elementFactory.createAnnotationMemberValueFromText(argsText, descAnnotation) + elementFactory.createAnnotationMemberValueFromText(argsText, descAnnotation), ) } else { descAnnotation.setDeclaredAttributeValue("desc", null) @@ -125,9 +125,9 @@ "ret", elementFactory.createAnnotationMemberValueFromText( "${returnType.className.replace('$', '.')}.class", - descAnnotation + descAnnotation, + ), - ) + ) - ) } else { descAnnotation.setDeclaredAttributeValue("ret", null) } Index: src/main/kotlin/platform/mixin/reference/InjectionPointReference.kt =================================================================== --- src/main/kotlin/platform/mixin/reference/InjectionPointReference.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/reference/InjectionPointReference.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -79,14 +79,14 @@ .map { PrioritizedLookupElement.withPriority( LookupElementBuilder.create(it).completeToLiteral(context), - 1.0 + 1.0, ) } + getCustomInjectionPointInheritors(context.project).asSequence() .map { PrioritizedLookupElement.withPriority( LookupElementBuilder.create(it).completeToLiteral(context), - 0.0 + 0.0, ) } ).toTypedArray() @@ -103,12 +103,12 @@ .findClass(SELECTOR, GlobalSearchScope.allScope(project)) ?: return@getCachedValue CachedValueProvider.Result( emptyList(), - PsiModificationTracker.MODIFICATION_COUNT + PsiModificationTracker.MODIFICATION_COUNT, ) val enumConstants = selectorClass.fields.mapNotNull { (it as? PsiEnumConstant)?.name } CachedValueProvider.Result(enumConstants, PsiModificationTracker.MODIFICATION_COUNT) }, - false + false, ) } @@ -123,7 +123,7 @@ .findClass(INJECTION_POINT, GlobalSearchScope.allScope(project)) ?: return@getCachedValue CachedValueProvider.Result( emptyList(), - PsiModificationTracker.MODIFICATION_COUNT + PsiModificationTracker.MODIFICATION_COUNT, ) val inheritors = ClassInheritorsSearch.search(injectionPointClass).mapNotNull { c -> if (c.qualifiedName == INJECTION_POINT) return@mapNotNull null @@ -140,7 +140,7 @@ } CachedValueProvider.Result(inheritors, PsiModificationTracker.MODIFICATION_COUNT) }, - false + false, ) } Index: src/main/kotlin/platform/mixin/reference/MethodGTDHandler.kt =================================================================== --- src/main/kotlin/platform/mixin/reference/MethodGTDHandler.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/reference/MethodGTDHandler.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -20,7 +20,7 @@ override fun getGotoDeclarationTargets( sourceElement: PsiElement?, offset: Int, - editor: Editor? + editor: Editor?, ): Array? { if (sourceElement == null) return null val stringLiteral = sourceElement.parentOfType() ?: return null Index: src/main/kotlin/platform/mixin/reference/MethodReference.kt =================================================================== --- src/main/kotlin/platform/mixin/reference/MethodReference.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/reference/MethodReference.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -35,11 +35,11 @@ val qName = t.qualifiedName ?: return false return isValidAnnotation(qName, t.project) } - } + }, ), - "method" + "method", + ), - ) + ) - ) override val description = "method '%s' in target class" Index: src/main/kotlin/platform/mixin/reference/MixinReferenceContributor.kt =================================================================== --- src/main/kotlin/platform/mixin/reference/MixinReferenceContributor.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/reference/MixinReferenceContributor.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -24,26 +24,26 @@ // Method references registrar.registerReferenceProvider( MethodReference.ELEMENT_PATTERN, - MethodReference + MethodReference, ) // Desc references registrar.registerReferenceProvider( DescReference.ELEMENT_PATTERN, - DescReference + DescReference, ) // Injection point types registrar.registerReferenceProvider( PsiJavaPatterns.psiLiteral(StandardPatterns.string()) .insideAnnotationAttribute(AT), - InjectionPointReference + InjectionPointReference, ) // Target references registrar.registerReferenceProvider( TargetReference.ELEMENT_PATTERN, - TargetReference + TargetReference, ) } } Index: src/main/kotlin/platform/mixin/reference/MixinSelectors.kt =================================================================== --- src/main/kotlin/platform/mixin/reference/MixinSelectors.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/reference/MixinSelectors.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -131,7 +131,7 @@ fun resolve( project: Project, - scope: GlobalSearchScope = GlobalSearchScope.allScope(project) + scope: GlobalSearchScope = GlobalSearchScope.allScope(project), ): Pair? { return resolve(project, scope, ::Pair) } @@ -142,7 +142,7 @@ fun resolveAsm( project: Project, - scope: GlobalSearchScope = GlobalSearchScope.allScope(project) + scope: GlobalSearchScope = GlobalSearchScope.allScope(project), ): MixinTargetMember? { val owner = this.owner ?: return null @@ -306,7 +306,7 @@ namePattern, descPattern, ownerPattern.getConstantString(), - descPattern.getConstantString() + descPattern.getConstantString(), ) } @@ -345,7 +345,7 @@ val namePattern: Regex, val descPattern: Regex, override val owner: String?, - descriptor: String? + descriptor: String?, ) : MixinSelector { override fun matchField(owner: String, name: String, desc: String): Boolean { return ownerPattern.containsMatchIn(owner) && @@ -517,7 +517,7 @@ element, PsiAnnotation::class.java, PsiMethod::class.java, - PsiClass::class.java + PsiClass::class.java, ) } } @@ -566,7 +566,7 @@ val ret = descAnnotation.findAttributeValue("ret")?.resolveType() ?: PsiType.VOID val desc = Type.getMethodDescriptor( Type.getType(ret.descriptor), - *argTypes.mapToArray { Type.getType(it.descriptor) } + *argTypes.mapToArray { Type.getType(it.descriptor) }, ) return DescSelector(owners, name, desc) @@ -577,7 +577,7 @@ data class DescSelector( val owners: Set, val name: String, - override val methodDescriptor: String + override val methodDescriptor: String, ) : MixinSelector { override fun matchField(owner: String, name: String, desc: String): Boolean { return this.owners.contains(owner) && this.name == name && this.fieldDescriptor.substringBefore("(") == desc Index: src/main/kotlin/platform/mixin/reference/target/TargetGTDHandler.kt =================================================================== --- src/main/kotlin/platform/mixin/reference/target/TargetGTDHandler.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/reference/target/TargetGTDHandler.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -20,7 +20,7 @@ override fun getGotoDeclarationTargets( sourceElement: PsiElement?, offset: Int, - editor: Editor? + editor: Editor?, ): Array? { if (sourceElement == null) return null val stringLiteral = sourceElement.parentOfType() ?: return null Index: src/main/kotlin/platform/mixin/search/MixinSoftImplementMethodSuperSearcher.kt =================================================================== --- src/main/kotlin/platform/mixin/search/MixinSoftImplementMethodSuperSearcher.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/search/MixinSoftImplementMethodSuperSearcher.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -24,7 +24,7 @@ override fun execute( queryParameters: SuperMethodsSearch.SearchParameters, - consumer: Processor + consumer: Processor, ): Boolean { if (queryParameters.psiClass != null) { return true // Not entirely sure what this is used for Index: src/main/kotlin/platform/mixin/util/AsmDfaUtil.kt =================================================================== --- src/main/kotlin/platform/mixin/util/AsmDfaUtil.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/util/AsmDfaUtil.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -39,8 +39,8 @@ Type.getObjectType(clazz.name), clazz.superName?.let { Type.getObjectType(it) }, clazz.interfaces?.map { Type.getObjectType(it) } ?: emptyList(), - clazz.hasAccess(Opcodes.ACC_INTERFACE) - ) + clazz.hasAccess(Opcodes.ACC_INTERFACE), + ), ).analyze(clazz.name, method) } catch (e: AnalyzerException) { LOGGER.warn("AsmDfaUtil.analyzeMethod failed", e) @@ -54,7 +54,7 @@ clazz: ClassNode, method: MethodNode, insn: AbstractInsnNode, - slot: Int + slot: Int, ): Type? { val insns = method.instructions ?: return null val frames = analyzeMethod(project, clazz, method) ?: return null @@ -67,7 +67,7 @@ project: Project, clazz: ClassNode, method: MethodNode, - insn: AbstractInsnNode + insn: AbstractInsnNode, ): Array? { val insns = method.instructions ?: return null val frames = analyzeMethod(project, clazz, method) ?: return null @@ -80,7 +80,7 @@ clazz: ClassNode, method: MethodNode, insn: AbstractInsnNode, - depth: Int + depth: Int, ): Type? { val insns = method.instructions ?: return null val frames = analyzeMethod(project, clazz, method) ?: return null @@ -93,7 +93,7 @@ project: Project, clazz: ClassNode, method: MethodNode, - insn: AbstractInsnNode + insn: AbstractInsnNode, ): Array? { val insns = method.instructions ?: return null val frames = analyzeMethod(project, clazz, method) ?: return null @@ -106,7 +106,7 @@ private val currentClass: Type, private val currentSuperClass: Type?, currentClassInterfaces: List, - private val isInterface: Boolean + private val isInterface: Boolean, ) : SimpleVerifier(Opcodes.ASM7, currentClass, currentSuperClass, currentClassInterfaces, isInterface) { override fun getClass(type: Type?): Class<*> { // should never be called given we have overridden the other methods Index: src/main/kotlin/platform/mixin/util/AsmUtil.kt =================================================================== --- src/main/kotlin/platform/mixin/util/AsmUtil.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/util/AsmUtil.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -269,7 +269,7 @@ val file = PsiFileFactory.getInstance(project).createFileFromText( "$outerClassSimpleName.java", JavaFileType.INSTANCE, - text + text, ) as? PsiJavaFile ?: return null var clazz = file.classes.firstOrNull() ?: return null @@ -278,7 +278,7 @@ ( JavaPsiFacade.getInstance(project).findClass( outerClassName.replace('/', '.'), - GlobalSearchScope.allScope(project) + GlobalSearchScope.allScope(project), ) as? PsiCompiledElement )?.let { originalClass -> clazz.putUserData(ClsElementImpl.COMPILED_ELEMENT, originalClass) @@ -426,7 +426,7 @@ fun FieldNode.getGenericType( clazz: ClassNode, - project: Project + project: Project, ): PsiType { if (this.signature != null) { return findOrConstructSourceField(clazz, project, canDecompile = false).type @@ -439,7 +439,7 @@ clazz: ClassNode, project: Project, vararg dependencies: Any, - crossinline compute: () -> T + crossinline compute: () -> T, ): T { return findStubField(clazz, project)?.cached(*dependencies, compute = compute) ?: compute() } @@ -457,7 +457,7 @@ clazz: ClassNode?, project: Project, scope: GlobalSearchScope = GlobalSearchScope.allScope(project), - canDecompile: Boolean = false + canDecompile: Boolean = false, ): PsiField { clazz?.let { findSourceField(it, project, scope, canDecompile = canDecompile) }?.let { return it } @@ -475,7 +475,7 @@ } val psiField = elementFactory.createField( this.name.toJavaIdentifier(), - type + type, ) psiField.realName = this.name val modifierList = psiField.modifierList!! @@ -496,7 +496,7 @@ clazz: ClassNode, project: Project, scope: GlobalSearchScope, - canDecompile: Boolean = false + canDecompile: Boolean = false, ): PsiField? { return clazz.findSourceClass(project, scope, canDecompile)?.findField(memberReference) } @@ -645,7 +645,7 @@ } } } - } + }, ) result } @@ -655,7 +655,7 @@ clazz: ClassNode, project: Project, vararg dependencies: Array, - crossinline compute: () -> T + crossinline compute: () -> T, ): T { return findStubMethod(clazz, project)?.cached(*dependencies, compute = compute) ?: compute() } @@ -691,7 +691,7 @@ clazz: ClassNode?, project: Project, scope: GlobalSearchScope = GlobalSearchScope.allScope(project), - canDecompile: Boolean = false + canDecompile: Boolean = false, ): PsiMethod { val sourceElement = clazz?.let { findSourceElement(it, project, scope, canDecompile = canDecompile) } if (sourceElement is PsiMethod) { @@ -825,9 +825,9 @@ if (exceptions != null) { psiMethod.throwsList.replace( elementFactory.createReferenceList( - exceptions.mapToArray { elementFactory.createReferenceFromText(it.replace('/', '.'), null) } + exceptions.mapToArray { elementFactory.createReferenceFromText(it.replace('/', '.'), null) }, + ), - ) + ) - ) } val modifierList = psiMethod.modifierList @@ -856,7 +856,7 @@ clazz: ClassNode, project: Project, scope: GlobalSearchScope, - canDecompile: Boolean = false + canDecompile: Boolean = false, ): PsiElement? { val psiClass = clazz.findSourceClass(project, scope, canDecompile) ?: return null if (isClinit) { Index: src/main/kotlin/platform/mixin/util/LocalVariables.kt =================================================================== --- src/main/kotlin/platform/mixin/util/LocalVariables.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/util/LocalVariables.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -122,7 +122,7 @@ val controlFlow = ControlFlowFactory.getControlFlow( body, LocalsControlFlowPolicy(body), - ControlFlowOptions.NO_CONST_EVALUATE + ControlFlowOptions.NO_CONST_EVALUATE, ) val allLocalVariables = guessAllLocalVariables(argsIndex, body, controlFlow) @@ -133,7 +133,7 @@ private fun guessAllLocalVariables( argsSize: Int, body: PsiElement, - controlFlow: ControlFlow + controlFlow: ControlFlow, ): Array> { return body.cached(PsiModificationTracker.MODIFICATION_COUNT) { guessAllLocalVariablesUncached(argsSize, body, controlFlow) @@ -143,7 +143,7 @@ private fun guessAllLocalVariablesUncached( argsSize: Int, body: PsiElement, - controlFlow: ControlFlow + controlFlow: ControlFlow, ): Array> { val method = body.parent val allLocalVariables = getAllLocalVariables(body) @@ -156,7 +156,7 @@ true }, variable, - method + method, ) // add on other implicit declarations in scope for (parent in generateSequence(variable.parent, PsiElement::getParent).takeWhile { it != method }) { @@ -185,7 +185,7 @@ override fun visitWriteVariableInstruction( instruction: WriteVariableInstruction, offset: Int, - nextOffset: Int + nextOffset: Int, ) { if (instruction.variable in allLocalVariables) { val localIndex = instruction.variable.getUserData(LOCAL_INDEX_KEY)!! @@ -289,7 +289,7 @@ override fun visitLambdaExpression(expression: PsiLambdaExpression?) { // don't recurse into lambdas } - } + }, ) return locals } @@ -319,7 +319,7 @@ type, localIndex, implicitLoadCountBefore = 1, - implicitStoreCountBefore = 1 + implicitStoreCountBefore = 1, ), // length SourceLocalVariable( @@ -327,7 +327,7 @@ PsiType.INT, localIndex + 1, implicitStoreCountBefore = 1, - implicitLoadCountAfter = 1 + implicitLoadCountAfter = 1, ), // index SourceLocalVariable( @@ -336,14 +336,14 @@ localIndex + 2, implicitStoreCountBefore = 1, implicitLoadCountBefore = 1, - implicitLoadCountAfter = 1 + implicitLoadCountAfter = 1, + ), - ) + ) - ) } else { val iteratorType = JavaPsiFacade.getElementFactory(project) .createTypeByFQClassName( CommonClassNames.JAVA_UTIL_ITERATOR, - resolveScope + resolveScope, ) return listOf( // iterator @@ -352,9 +352,9 @@ iteratorType, localIndex, implicitStoreCountBefore = 1, - implicitLoadCountBefore = 1 + implicitLoadCountBefore = 1, + ), - ) + ) - ) } } @@ -362,7 +362,7 @@ module: Module, classNode: ClassNode, method: MethodNode, - node: AbstractInsnNode + node: AbstractInsnNode, ): Array? { return getLocals(module.project, classNode, method, node, detectCurrentSettings(module)) } @@ -372,7 +372,7 @@ classNode: ClassNode, method: MethodNode, nodeArg: AbstractInsnNode, - settings: Settings + settings: Settings, ): Array? { return try { doGetLocals(project, classNode, method, nodeArg, settings) @@ -397,7 +397,7 @@ classNode: ClassNode, method: MethodNode, nodeArg: AbstractInsnNode, - settings: Settings + settings: Settings, ): Array { var node = nodeArg for (i in 0 until 3) { @@ -479,7 +479,7 @@ frameSize, frameData.type, frameData.computeFrameSize(initialFrameSize), - initialFrameSize + initialFrameSize, ) } } else { @@ -488,7 +488,7 @@ frameSize, insn.type, frameNodeSize, - initialFrameSize + initialFrameSize, ) } @@ -498,7 +498,7 @@ "Locals entered an invalid state evaluating " + "${classNode.name}::${method.name}${method.desc} at instruction " + "${method.instructions.indexOf(insn)}. Initial frame size is" + - " $initialFrameSize, calculated a frame size of $frameSize" + " $initialFrameSize, calculated a frame size of $frameSize", ) } if (( @@ -528,7 +528,7 @@ classNode, method, method.instructions.indexOf(insn), - framePos + framePos, ) } else if (localType is Int) { // Integer refers to a primitive type or other marker val isMarkerType = localType == Opcodes.UNINITIALIZED_THIS || localType == Opcodes.NULL @@ -552,7 +552,7 @@ classNode, method, method.instructions.indexOf(insn), - framePos + framePos, ) if (is64bitValue) { framePos++ @@ -561,7 +561,7 @@ } else { throw IllegalStateException( "Unrecognised locals opcode $localType in locals array at position" + - " $localPos in ${classNode.name}.${method.name}${method.desc}" + " $localPos in ${classNode.name}.${method.name}${method.desc}", ) } } else if (localType == null) { @@ -572,7 +572,7 @@ classNode, method, insn, - framePos + framePos, ) } else { frame[framePos] = ZombieLocalVariable.of(frame[framePos], ZombieLocalVariable.TRIM) @@ -583,7 +583,7 @@ } else { throw IllegalStateException( "Invalid value $localType in locals array at position" + - " $localPos in ${classNode.name}.${method.name}${method.desc}" + " $localPos in ${classNode.name}.${method.name}${method.desc}", ) } framePos++ @@ -669,7 +669,7 @@ classNode: ClassNode, method: MethodNode, pos: AbstractInsnNode, - index: Int + index: Int, ): LocalVariable? { return getLocalVariableAt(project, classNode, method, method.instructions.indexOf(pos), index) } @@ -679,7 +679,7 @@ classNode: ClassNode, method: MethodNode, pos: Int, - index: Int + index: Int, ): LocalVariable? { var localVariableNode: LocalVariable? = null var fallbackNode: LocalVariable? = null @@ -722,7 +722,7 @@ it.signature, instructions.indexOf(it.start), instructions.indexOf(it.end), - it.index + it.index, ) } } @@ -730,7 +730,7 @@ private fun getGeneratedLocalVariableTable( project: Project, classNode: ClassNode, - method: MethodNode + method: MethodNode, ): List { val frames = AsmDfaUtil.analyzeMethod(project, classNode, method) ?: throw LocalAnalysisFailedException() @@ -808,7 +808,7 @@ val trimmedFrameThreshold: Int, val resurrectExposedOnLoad: Boolean, val resurrectExposedOnStore: Boolean, - val resurrectForBogusTop: Boolean + val resurrectForBogusTop: Boolean, ) { companion object { val NO_RESURRECT = Settings( @@ -818,7 +818,7 @@ trimmedFrameThreshold = 0, resurrectExposedOnLoad = false, resurrectExposedOnStore = false, - resurrectForBogusTop = false + resurrectForBogusTop = false, ) val DEFAULT = Settings( @@ -828,7 +828,7 @@ trimmedFrameThreshold = -1, resurrectExposedOnLoad = true, resurrectExposedOnStore = true, - resurrectForBogusTop = true + resurrectForBogusTop = true, ) } } @@ -841,7 +841,7 @@ val implicitLoadCountBefore: Int = 0, val implicitLoadCountAfter: Int = 0, val implicitStoreCountBefore: Int = 0, - val implicitStoreCountAfter: Int = 0 + val implicitStoreCountAfter: Int = 0, ) open class LocalVariable( @@ -850,7 +850,7 @@ val signature: String?, val start: Int?, var end: Int?, - val index: Int + val index: Int, ) { fun isInRange(index: Int): Boolean { val end = this.end @@ -866,14 +866,14 @@ private class ZombieLocalVariable private constructor( val ancestor: LocalVariable, - val type: Char + val type: Char, ) : LocalVariable( ancestor.name, ancestor.desc, ancestor.signature, ancestor.start, ancestor.end, - ancestor.index + ancestor.index, ) { var lifetime = 0 var frames = 0 Index: src/main/kotlin/platform/mixin/util/Mixin.kt =================================================================== --- src/main/kotlin/platform/mixin/util/Mixin.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/util/Mixin.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -11,10 +11,10 @@ package com.demonwav.mcdev.platform.mixin.util import com.demonwav.mcdev.platform.mixin.action.FindMixinsAction +import com.demonwav.mcdev.platform.mixin.handlers.MixinAnnotationHandler import com.demonwav.mcdev.platform.mixin.util.MixinConstants.Annotations.ACCESSOR import com.demonwav.mcdev.platform.mixin.util.MixinConstants.Annotations.INVOKER import com.demonwav.mcdev.platform.mixin.util.MixinConstants.Annotations.MIXIN -import com.demonwav.mcdev.platform.mixin.util.MixinConstants.Classes.ARGS import com.demonwav.mcdev.platform.mixin.util.MixinConstants.Classes.CALLBACK_INFO import com.demonwav.mcdev.platform.mixin.util.MixinConstants.Classes.CALLBACK_INFO_RETURNABLE import com.demonwav.mcdev.util.cached @@ -30,6 +30,7 @@ import com.intellij.psi.PsiDisjunctionType import com.intellij.psi.PsiElement import com.intellij.psi.PsiIntersectionType +import com.intellij.psi.PsiMethod import com.intellij.psi.PsiParameter import com.intellij.psi.PsiPrimitiveType import com.intellij.psi.PsiType @@ -81,7 +82,7 @@ findClassNodeByQualifiedName( project, findModule(), - name.replace('/', '.') + name.replace('/', '.'), ) } classTargets @@ -144,9 +145,6 @@ return JavaPsiFacade.getElementFactory(project).createType(psiClass, boxedType) } -fun argsType(project: Project): PsiType = - PsiType.getTypeByName(ARGS, project, GlobalSearchScope.allScope(project)) - fun isAssignable(left: PsiType, right: PsiType): Boolean { return when { left is PsiIntersectionType -> left.conjuncts.all { isAssignable(it, right) } @@ -187,3 +185,18 @@ } return result } + +fun isMixinEntryPoint(element: PsiElement?): Boolean { + if (element !is PsiMethod) { + return false + } + val project = element.project + for (annotation in element.annotations) { + val qName = annotation.qualifiedName ?: continue + val handler = MixinAnnotationHandler.forMixinAnnotation(qName, project) + if (handler != null && handler.isEntryPoint) { + return true + } + } + return false +} Index: src/main/kotlin/platform/mixin/util/SignatureToPsi.kt =================================================================== --- src/main/kotlin/platform/mixin/util/SignatureToPsi.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/util/SignatureToPsi.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -21,7 +21,7 @@ class SignatureToPsi( private val elementFactory: PsiElementFactory, private val context: PsiElement?, - private val typeCompletedCallback: ((PsiType) -> Unit)? = null + private val typeCompletedCallback: ((PsiType) -> Unit)? = null, ) : SignatureVisitor(Opcodes.ASM7) { private val text = StringBuilder() Index: src/main/kotlin/platform/mixin/util/TargetClass.kt =================================================================== --- src/main/kotlin/platform/mixin/util/TargetClass.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/mixin/util/TargetClass.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -123,12 +123,16 @@ private fun Sequence.filterAccessible( psiClass: PsiClass, - target: PsiClass + target: PsiClass, ): Sequence { - return if (psiClass equivalentTo target) this else filter { + return if (psiClass equivalentTo target) { + this + } else { + filter { - (it.access and (Opcodes.ACC_PUBLIC or Opcodes.ACC_PROTECTED)) != 0 - } -} + (it.access and (Opcodes.ACC_PUBLIC or Opcodes.ACC_PROTECTED)) != 0 + } + } +} private fun PsiClass.streamMixinHierarchy(): Sequence { return generateSequence(this) { Index: src/main/kotlin/platform/sponge/SpongeModule.kt =================================================================== --- src/main/kotlin/platform/sponge/SpongeModule.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/sponge/SpongeModule.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -18,18 +18,16 @@ import com.demonwav.mcdev.platform.PlatformType import com.demonwav.mcdev.platform.sponge.generation.SpongeGenerationData import com.demonwav.mcdev.platform.sponge.util.SpongeConstants +import com.demonwav.mcdev.util.createVoidMethodWithParameterType import com.demonwav.mcdev.util.extendsOrImplements import com.demonwav.mcdev.util.findContainingMethod import com.intellij.lang.jvm.JvmModifier import com.intellij.psi.JavaPsiFacade import com.intellij.psi.PsiAnnotationMemberValue import com.intellij.psi.PsiClass -import com.intellij.psi.PsiClassType import com.intellij.psi.PsiElement import com.intellij.psi.PsiMethod import com.intellij.psi.PsiMethodCallExpression -import com.intellij.psi.PsiType -import com.intellij.psi.search.GlobalSearchScope import org.jetbrains.uast.UClass import org.jetbrains.uast.UIdentifier import org.jetbrains.uast.toUElementOfType @@ -51,19 +49,9 @@ containingClass: PsiClass, chosenClass: PsiClass, chosenName: String, - data: GenerationData? + data: GenerationData?, ): PsiMethod? { - val method = JavaPsiFacade.getElementFactory(project).createMethod(chosenName, PsiType.VOID) - val parameterList = method.parameterList - - val qName = chosenClass.qualifiedName ?: return null - val parameter = JavaPsiFacade.getElementFactory(project) - .createParameter( - "event", - PsiClassType.getTypeByName(qName, project, GlobalSearchScope.allScope(project)) - ) - - parameterList.add(parameter) + val method = createVoidMethodWithParameterType(project, chosenName, chosenClass) ?: return null val modifierList = method.modifierList val listenerAnnotation = modifierList.addAnnotation("org.spongepowered.api.event.Listener") @@ -82,7 +70,7 @@ val value = JavaPsiFacade.getElementFactory(project) .createExpressionFromText( "org.spongepowered.api.event.Order." + generationData.eventOrder, - listenerAnnotation + listenerAnnotation, ) listenerAnnotation.setDeclaredAttributeValue("order", value) @@ -95,10 +83,9 @@ val identifier = element?.toUElementOfType() ?: return false - val psiClass = identifier.uastParent as? UClass - ?: return false + val psiClass = identifier.uastParent as? UClass ?: return false - if (psiClass.hasModifier(JvmModifier.ABSTRACT)) { + if (psiClass.javaPsi.hasModifier(JvmModifier.ABSTRACT)) { return false } @@ -122,8 +109,7 @@ return null } - val sub = text.substring(text.lastIndexOf('.') + 1) - when (sub) { + when (text.substring(text.lastIndexOf('.') + 1)) { "TRUE" -> true "FALSE" -> false else -> return null @@ -154,9 +140,9 @@ fix = { expression.replace( JavaPsiFacade.getElementFactory(project) - .createExpressionFromText(if (isCancelled) "true" else "false", expression) + .createExpressionFromText(if (isCancelled) "true" else "false", expression), ) - } + }, ) } } Index: src/main/kotlin/platform/sponge/SpongeModuleType.kt =================================================================== --- src/main/kotlin/platform/sponge/SpongeModuleType.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/sponge/SpongeModuleType.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -26,7 +26,7 @@ private val IGNORED_ANNOTATIONS = listOf( SpongeConstants.LISTENER_ANNOTATION, SpongeConstants.PLUGIN_ANNOTATION, - SpongeConstants.JVM_PLUGIN_ANNOTATION + SpongeConstants.JVM_PLUGIN_ANNOTATION, ) private val LISTENER_ANNOTATIONS = listOf(SpongeConstants.LISTENER_ANNOTATION) Index: src/main/kotlin/platform/sponge/color/SpongeColorUtil.kt =================================================================== --- src/main/kotlin/platform/sponge/color/SpongeColorUtil.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/sponge/color/SpongeColorUtil.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -25,6 +25,6 @@ arrayOf( "com.flowpowered.math.vector.Vector3d", "com.flowpowered.math.vector.Vector3f", - "com.flowpowered.math.vector.Vector3i" + "com.flowpowered.math.vector.Vector3i", + ), - ) + ) - ) Index: src/main/kotlin/platform/sponge/creator/asset-steps.kt =================================================================== --- src/main/kotlin/platform/sponge/creator/asset-steps.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/sponge/creator/asset-steps.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -50,7 +50,7 @@ } class SpongePostBuildSystemStep( - parent: NewProjectWizardStep + parent: NewProjectWizardStep, ) : AbstractRunBuildSystemStep(parent, SpongeBuildSystemStep::class.java) { override val step = BuildSystemSupport.POST_STEP } Index: src/main/kotlin/platform/sponge/creator/maven-steps.kt =================================================================== --- src/main/kotlin/platform/sponge/creator/maven-steps.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/sponge/creator/maven-steps.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -48,7 +48,7 @@ BuildSystemSupport.PRE_STEP -> SpongeMavenFilesStep(parent).chain(::SpongePatchPomStep) BuildSystemSupport.POST_STEP -> SpongeMavenProjectFilesStep(parent).chain( ::MavenImportStep, - ::ReformatPomStep + ::ReformatPomStep, ) else -> EmptyStep(parent) } @@ -113,17 +113,17 @@ BuildRepository( "spongepowered-repo", "https://repo.spongepowered.org/maven/", - buildSystems = EnumSet.of(BuildSystemType.MAVEN) - ) + buildSystems = EnumSet.of(BuildSystemType.MAVEN), - ), + ), + ), listOf( BuildDependency( "org.spongepowered", "spongeapi", spongeApiVersion.toString(), - mavenScope = "provided" + mavenScope = "provided", + ), + ), - ) + ) - ) - ) } } Index: src/main/kotlin/platform/sponge/creator/ui-steps.kt =================================================================== --- src/main/kotlin/platform/sponge/creator/ui-steps.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/sponge/creator/ui-steps.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -61,10 +61,10 @@ class SpongeApiVersionStep( parent: NewProjectWizardStep, - data: SpongeVersion + data: SpongeVersion, ) : AbstractSelectVersionStep( parent, - data.versions.keys.mapNotNull(SemanticVersion::tryParse).filter { it >= MIN_SPONGE_VERSION } + data.versions.keys.mapNotNull(SemanticVersion::tryParse).filter { it >= MIN_SPONGE_VERSION }, ) { override val label = "Sponge API Version:" Index: src/main/kotlin/platform/sponge/inspection/SpongeInjectionInspection.kt =================================================================== --- src/main/kotlin/platform/sponge/inspection/SpongeInjectionInspection.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/sponge/inspection/SpongeInjectionInspection.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -101,7 +101,7 @@ annotation.parameterList, "Constructor injection cannot be optional.", ProblemHighlightType.GENERIC_ERROR, - RemoveAnnotationParameters(annotation, "Remove 'optional' parameter") + RemoveAnnotationParameters(annotation, "Remove 'optional' parameter"), ) } } @@ -115,7 +115,7 @@ holder.registerProblem( typeElement, "Primitive types cannot be injected by Sponge.", - ProblemHighlightType.GENERIC_ERROR + ProblemHighlightType.GENERIC_ERROR, ) return } @@ -129,7 +129,7 @@ typeElement, "${classType.presentableText} cannot be injected by Sponge.", ProblemHighlightType.GENERIC_ERROR_OR_WARNING, - AddToKnownInjectableTypes(name) + AddToKnownInjectableTypes(name), ) return } @@ -143,7 +143,7 @@ private fun checkAssetId( name: String, variable: PsiVariable, - annotationsOwner: PsiModifierListOwner + annotationsOwner: PsiModifierListOwner, ) { if (name != "org.spongepowered.api.asset.Asset") { return @@ -155,7 +155,7 @@ variable.nameIdentifier ?: variable, "Injected Assets must be annotated with @AssetId.", ProblemHighlightType.GENERIC_ERROR, - AddAnnotationFix(SpongeConstants.ASSET_ID_ANNOTATION, annotationsOwner) + AddAnnotationFix(SpongeConstants.ASSET_ID_ANNOTATION, annotationsOwner), ) } else { variable.findModule()?.let { module -> @@ -173,7 +173,7 @@ holder.registerProblem( assetPathAttributeValue, "AssetId must reference a file.", - ProblemHighlightType.GENERIC_ERROR + ProblemHighlightType.GENERIC_ERROR, ) return@let } @@ -189,7 +189,7 @@ assetPathAttributeValue, "Asset '$assetPath' does not exist.", ProblemHighlightType.GENERIC_ERROR, - fix + fix, ) } } @@ -200,7 +200,7 @@ variable: PsiVariable, name: String, classType: PsiClassReferenceType, - annotationsOwner: PsiModifierListOwner + annotationsOwner: PsiModifierListOwner, ) { val configDir = variable.getAnnotation(SpongeConstants.CONFIG_DIR_ANNOTATION) val defaultConfig = variable.getAnnotation(SpongeConstants.DEFAULT_CONFIG_ANNOTATION) @@ -214,7 +214,7 @@ "@ConfigDir and @DefaultConfig cannot be used on the same field.", ProblemHighlightType.GENERIC_ERROR, quickFixFactory.createDeleteFix(configDir, "Remove @ConfigDir"), - quickFixFactory.createDeleteFix(defaultConfig, "Remove @DefaultConfig") + quickFixFactory.createDeleteFix(defaultConfig, "Remove @DefaultConfig"), ) } else if (configDir == null && defaultConfig == null) { holder.registerProblem( @@ -222,7 +222,7 @@ "An injected ${classType.name} must be annotated with either @ConfigDir or @DefaultConfig.", ProblemHighlightType.GENERIC_ERROR, AddAnnotationFix(SpongeConstants.CONFIG_DIR_ANNOTATION, annotationsOwner), - AddAnnotationFix(SpongeConstants.DEFAULT_CONFIG_ANNOTATION, annotationsOwner) + AddAnnotationFix(SpongeConstants.DEFAULT_CONFIG_ANNOTATION, annotationsOwner), ) } } @@ -232,7 +232,7 @@ variable.nameIdentifier ?: variable, "Injected ConfigurationLoader must be annotated with @DefaultConfig.", ProblemHighlightType.GENERIC_ERROR, - AddAnnotationFix(SpongeConstants.DEFAULT_CONFIG_ANNOTATION, annotationsOwner) + AddAnnotationFix(SpongeConstants.DEFAULT_CONFIG_ANNOTATION, annotationsOwner), ) } @@ -241,7 +241,7 @@ configDir, "Injected ConfigurationLoader cannot be annotated with @ConfigDir.", ProblemHighlightType.GENERIC_ERROR, - QuickFixFactory.getInstance().createDeleteFix(configDir, "Remove @ConfigDir") + QuickFixFactory.getInstance().createDeleteFix(configDir, "Remove @ConfigDir"), ) } @@ -251,7 +251,7 @@ ref, "Injected ConfigurationLoader must have a generic parameter.", ProblemHighlightType.GENERIC_ERROR, - MissingConfLoaderTypeParamFix(ref) + MissingConfLoaderTypeParamFix(ref), ) } else { classType.parameters.firstOrNull()?.let { param -> @@ -264,7 +264,7 @@ "Injected ConfigurationLoader generic parameter must be " + "CommentedConfigurationNode.", ProblemHighlightType.GENERIC_ERROR, - WrongConfLoaderTypeParamFix(ref) + WrongConfLoaderTypeParamFix(ref), ) } } @@ -277,7 +277,7 @@ configDir, "${classType.name} cannot be annotated with @ConfigDir.", ProblemHighlightType.GENERIC_ERROR, - quickFixFactory.createDeleteFix(configDir, "Remove @ConfigDir") + quickFixFactory.createDeleteFix(configDir, "Remove @ConfigDir"), ) } @@ -286,7 +286,7 @@ defaultConfig, "${classType.name} cannot be annotated with @DefaultConfig.", ProblemHighlightType.GENERIC_ERROR, - quickFixFactory.createDeleteFix(defaultConfig, "Remove @DefaultConfig") + quickFixFactory.createDeleteFix(defaultConfig, "Remove @DefaultConfig"), ) } } @@ -333,7 +333,7 @@ "org.spongepowered.api.asset.Asset", "org.bstats.sponge.MetricsLite2.Factory", - "org.bstats.sponge.Metrics2.Factory" + "org.bstats.sponge.Metrics2.Factory", ) val serializedDefaultInjectableTypes: String = formatString(defaultInjectableTypes) @@ -362,7 +362,7 @@ override fun invoke(project: Project, file: PsiFile, startElement: PsiElement, endElement: PsiElement) { val newRef = JavaPsiFacade.getElementFactory(project).createReferenceFromText( "ninja.leaping.configurate.commented.CommentedConfigurationNode", - startElement + startElement, ) startElement.replace(newRef) } @@ -378,7 +378,7 @@ val newRef = JavaPsiFacade.getElementFactory(project).createReferenceFromText( "ninja.leaping.configurate.loader.ConfigurationLoader" + "", - startElement + startElement, ) startElement.replace(newRef) } @@ -388,7 +388,7 @@ private val assetPath: String, private val module: Module, private val pluginId: String, - directory: PsiDirectory + directory: PsiDirectory, ) : LocalQuickFix { private val dirPointer = directory.createSmartPointer() @@ -409,7 +409,7 @@ module, "assets.$pluginId$assetDir", dirPointer.element, - false + false, ) val createdFile = runWriteAction { createdDir?.createFile(fileName) @@ -432,7 +432,7 @@ val chooserList = UiUtils.createTreeClassChooserList( injectableTypesList, "Injectable types", - "Choose injectable type" + "Choose injectable type", ) UiUtils.setComponentSize(chooserList, 7, 25) return chooserList Index: src/main/kotlin/platform/sponge/inspection/SpongeInvalidGetterTargetInspection.kt =================================================================== --- src/main/kotlin/platform/sponge/inspection/SpongeInvalidGetterTargetInspection.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/sponge/inspection/SpongeInvalidGetterTargetInspection.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -29,7 +29,7 @@ override fun checkMethod( method: UMethod, manager: InspectionManager, - isOnTheFly: Boolean + isOnTheFly: Boolean, ): Array? { if (!method.isValidSpongeListener()) { return null @@ -45,7 +45,7 @@ this.staticDescription, isOnTheFly, null, - ProblemHighlightType.GENERIC_ERROR_OR_WARNING + ProblemHighlightType.GENERIC_ERROR_OR_WARNING, ) } } Index: src/main/kotlin/platform/sponge/inspection/SpongeLoggingInspection.kt =================================================================== --- src/main/kotlin/platform/sponge/inspection/SpongeLoggingInspection.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/sponge/inspection/SpongeLoggingInspection.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -59,7 +59,7 @@ holder.registerProblem( element, "Sponge plugins should use ${Constants.SLF4J_LOGGER} rather than ${Constants.JAVA_UTIL_LOGGER}.", - ProblemHighlightType.GENERIC_ERROR_OR_WARNING + ProblemHighlightType.GENERIC_ERROR_OR_WARNING, ) } } Index: src/main/kotlin/platform/sponge/inspection/SpongePluginClassInspection.kt =================================================================== --- src/main/kotlin/platform/sponge/inspection/SpongePluginClassInspection.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/sponge/inspection/SpongePluginClassInspection.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -66,7 +66,7 @@ injectAnno, "There can only be one injected constructor.", quickFixFactory.createDeleteFix(injectAnno, "Remove this @Inject"), - quickFixFactory.createDeleteFix(injectedMethod, "Remove this injected constructor") + quickFixFactory.createDeleteFix(injectedMethod, "Remove this injected constructor"), ) } } @@ -80,7 +80,7 @@ classIdentifier, "Plugin class must have an empty constructor or an @Inject constructor.", ProblemHighlightType.GENERIC_ERROR, - AddDefaultConstructorFix(aClass) + AddDefaultConstructorFix(aClass), ) } } @@ -94,7 +94,7 @@ ProblemHighlightType.GENERIC_ERROR, ModifierFix(emptyCtor, PsiModifier.PACKAGE_LOCAL, true, false), ModifierFix(emptyCtor, PsiModifier.PROTECTED, true, false), - ModifierFix(emptyCtor, PsiModifier.PUBLIC, true, false) + ModifierFix(emptyCtor, PsiModifier.PUBLIC, true, false), ) } } @@ -108,7 +108,7 @@ holder.registerProblem( pluginIdValue, "Plugin IDs should be lowercase, and only contain characters from a-z, dashes or underscores," + - " start with a lowercase letter, and not exceed 64 characters." + " start with a lowercase letter, and not exceed 64 characters.", ) } } Index: src/main/kotlin/platform/sponge/inspection/SpongeWrongGetterTypeInspection.kt =================================================================== --- src/main/kotlin/platform/sponge/inspection/SpongeWrongGetterTypeInspection.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/sponge/inspection/SpongeWrongGetterTypeInspection.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -48,7 +48,7 @@ override fun checkMethod( method: UMethod, manager: InspectionManager, - isOnTheFly: Boolean + isOnTheFly: Boolean, ): Array? { val parameters = method.uastParameters if (parameters.size < 2 || !method.isValidSpongeListener()) { @@ -73,7 +73,7 @@ val getterSubst = TypeConversionUtil.getSuperClassSubstitutor( getterClass.javaPsi, eventClass, - eventTypeSubstitutor + eventTypeSubstitutor, ) val getterReturnType = getterMethod.returnType?.let(getterSubst::substitute) ?: continue val parameterType = parameter.type @@ -105,7 +105,7 @@ this.staticDescription, isOnTheFly, fixes, - ProblemHighlightType.GENERIC_ERROR_OR_WARNING + ProblemHighlightType.GENERIC_ERROR_OR_WARNING, ) } return problems.toTypedArray() @@ -126,7 +126,7 @@ method: JvmMethod, expectedType: PsiType, paramIndex: Int, - project: Project + project: Project, ): Array { if (expectedType is PsiPrimitiveType || expectedType is PsiClassType && !isOptional(expectedType) @@ -155,7 +155,7 @@ // Suggest a non-Optional version too return arrayOf( Fix(method, paramIndex, expectedType), - Fix(method, paramIndex, fixedClassType) + Fix(method, paramIndex, fixedClassType), ) } @@ -174,7 +174,7 @@ val newParam = expectedParameter( expectedType, existingParam.semanticNames.first(), - existingParam.expectedAnnotations + existingParam.expectedAnnotations, ) actualParams.toMutableList().also { it[paramIndex] = newParam } } Index: src/main/kotlin/platform/sponge/reference/SpongeReferenceContributor.kt =================================================================== --- src/main/kotlin/platform/sponge/reference/SpongeReferenceContributor.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/sponge/reference/SpongeReferenceContributor.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -46,7 +46,7 @@ PlatformPatterns.psiElement(PsiLanguageInjectionHost::class.java) .and(FilterPattern(GetterAnnotationFilter)), UastGetterEventListenerReferenceResolver, - PsiReferenceRegistrar.HIGHER_PRIORITY + PsiReferenceRegistrar.HIGHER_PRIORITY, ) } } Index: src/main/kotlin/platform/velocity/VelocityModule.kt =================================================================== --- src/main/kotlin/platform/velocity/VelocityModule.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/velocity/VelocityModule.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -18,14 +18,12 @@ import com.demonwav.mcdev.platform.velocity.generation.VelocityGenerationData import com.demonwav.mcdev.platform.velocity.util.VelocityConstants import com.demonwav.mcdev.platform.velocity.util.VelocityConstants.SUBSCRIBE_ANNOTATION +import com.demonwav.mcdev.util.createVoidMethodWithParameterType import com.intellij.lang.jvm.JvmModifier import com.intellij.psi.JavaPsiFacade import com.intellij.psi.PsiClass -import com.intellij.psi.PsiClassType import com.intellij.psi.PsiElement import com.intellij.psi.PsiMethod -import com.intellij.psi.PsiType -import com.intellij.psi.search.GlobalSearchScope import org.jetbrains.uast.UClass import org.jetbrains.uast.UIdentifier import org.jetbrains.uast.toUElementOfType @@ -41,19 +39,9 @@ containingClass: PsiClass, chosenClass: PsiClass, chosenName: String, - data: GenerationData? + data: GenerationData?, ): PsiMethod? { - val method = JavaPsiFacade.getElementFactory(project).createMethod(chosenName, PsiType.VOID) - val parameterList = method.parameterList - - val qName = chosenClass.qualifiedName ?: return null - val parameter = JavaPsiFacade.getElementFactory(project) - .createParameter( - "event", - PsiClassType.getTypeByName(qName, project, GlobalSearchScope.allScope(project)) - ) - - parameterList.add(parameter) + val method = createVoidMethodWithParameterType(project, chosenName, chosenClass) ?: return null val modifierList = method.modifierList val subscribeAnnotation = modifierList.addAnnotation(SUBSCRIBE_ANNOTATION) @@ -64,7 +52,7 @@ val value = JavaPsiFacade.getElementFactory(project) .createExpressionFromText( "com.velocitypowered.api.event.PostOrder." + generationData.eventOrder, - subscribeAnnotation + subscribeAnnotation, ) subscribeAnnotation.setDeclaredAttributeValue("order", value) Index: src/main/kotlin/platform/velocity/creator/asset-steps.kt =================================================================== --- src/main/kotlin/platform/velocity/creator/asset-steps.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/velocity/creator/asset-steps.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -69,14 +69,14 @@ assets.addTemplates( project, - "src/main/java/${mainClass.replace('.', '/')}.java" to template + "src/main/java/${mainClass.replace('.', '/')}.java" to template, ) } } class VelocityModifyMainClassStep( parent: NewProjectWizardStep, - private val isGradle: Boolean + private val isGradle: Boolean, ) : AbstractLongRunningStep(parent) { override val description = "Patching main class" @@ -152,7 +152,7 @@ class VelocityPostBuildSystemStep(parent: NewProjectWizardStep) : AbstractRunBuildSystemStep( parent, - VelocityBuildSystemStep::class.java + VelocityBuildSystemStep::class.java, ) { override val step = BuildSystemSupport.POST_STEP } Index: src/main/kotlin/platform/velocity/creator/gradle-steps.kt =================================================================== --- src/main/kotlin/platform/velocity/creator/gradle-steps.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/velocity/creator/gradle-steps.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -40,11 +40,11 @@ return when (step) { BuildSystemSupport.PRE_STEP -> VelocityGradleFilesStep(parent).chain( ::VelocityPatchGradleFilesStep, - ::GradleWrapperStep + ::GradleWrapperStep, ) BuildSystemSupport.POST_STEP -> GradleImportStep(parent).chain( ::ReformatBuildGradleStep, - { VelocityModifyMainClassStep(it, true) } + { VelocityModifyMainClassStep(it, true) }, ) else -> EmptyStep(parent) } @@ -91,38 +91,41 @@ val velocityApiVersion = data.getUserData(VelocityVersionStep.KEY) ?: return addPlugins( - project, gradleFiles.buildGradle, + project, + gradleFiles.buildGradle, listOf( - GradlePlugin("org.jetbrains.gradle.plugin.idea-ext", "1.0.1") + GradlePlugin("org.jetbrains.gradle.plugin.idea-ext", "1.0.1"), + ), - ) + ) - ) addRepositories( - project, gradleFiles.buildGradle, + project, + gradleFiles.buildGradle, listOf( BuildRepository( "papermc-repo", - "https://repo.papermc.io/repository/maven-public/" + "https://repo.papermc.io/repository/maven-public/", + ), + ), - ) + ) - ) - ) val annotationArtifactId = if (velocityApiVersion >= VelocityConstants.API_4) "velocity-annotation-processor" else "velocity-api" addDependencies( - project, gradleFiles.buildGradle, + project, + gradleFiles.buildGradle, listOf( BuildDependency( "com.velocitypowered", "velocity-api", velocityApiVersion.toString(), - gradleConfiguration = "compileOnly" + gradleConfiguration = "compileOnly", ), BuildDependency( "com.velocitypowered", annotationArtifactId, velocityApiVersion.toString(), - gradleConfiguration = "annotationProcessor" + gradleConfiguration = "annotationProcessor", ), + ), - ) + ) - ) } } Index: src/main/kotlin/platform/velocity/creator/maven-steps.kt =================================================================== --- src/main/kotlin/platform/velocity/creator/maven-steps.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/velocity/creator/maven-steps.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -37,7 +37,7 @@ BuildSystemSupport.PRE_STEP -> VelocityMavenFilesStep(parent).chain(::VelocityPatchPomStep) BuildSystemSupport.POST_STEP -> MavenImportStep(parent).chain( ::ReformatPomStep, - { VelocityModifyMainClassStep(it, false) } + { VelocityModifyMainClassStep(it, false) }, ) else -> EmptyStep(parent) } @@ -75,9 +75,9 @@ listOf( BuildRepository( "papermc-repo", - "https://repo.papermc.io/repository/maven-public/" - ) + "https://repo.papermc.io/repository/maven-public/", - ), + ), + ), listOf( BuildDependency( "com.velocitypowered", @@ -90,8 +90,8 @@ annotationArtifactId, velocityApiVersion.toString(), mavenScope = if (velocityApiVersion >= VelocityConstants.API_4) "provided" else null, + ), + ), - ) + ) - ) - ) } } Index: src/main/kotlin/platform/velocity/creator/ui-steps.kt =================================================================== --- src/main/kotlin/platform/velocity/creator/ui-steps.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/platform/velocity/creator/ui-steps.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -67,7 +67,7 @@ class VelocityVersionStep( parent: NewProjectWizardStep, - versions: List + versions: List, ) : AbstractSelectVersionStep(parent, versions) { override val label = "Velocity Version:" Index: src/main/kotlin/toml/TomlSchema.kt =================================================================== --- src/main/kotlin/toml/TomlSchema.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/toml/TomlSchema.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -26,7 +26,7 @@ // https://github.com/intellij-rust/intellij-rust/blob/42d0981d45e8830aa5efe82c45688bab8223201c/toml/src/main/kotlin/org/rust/toml/completion/RsTomlKeysCompletionProvider.kt class TomlSchema private constructor( val topLevelEntries: Set, - private val tables: List + private val tables: List, ) { fun topLevelKeys(isArray: Boolean): Set = @@ -88,12 +88,12 @@ data class TomlSchemaEntry( val key: String, val description: List, - val type: TomlValueType? + val type: TomlValueType?, ) class TomlTableSchema( val name: String, val isArray: Boolean, val entries: Set, - val description: List + val description: List, ) Index: src/main/kotlin/toml/platform/forge/ModsTomlDocumentationProvider.kt =================================================================== --- src/main/kotlin/toml/platform/forge/ModsTomlDocumentationProvider.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/toml/platform/forge/ModsTomlDocumentationProvider.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -30,7 +30,7 @@ editor: Editor, file: PsiFile, contextElement: PsiElement?, - targetOffset: Int + targetOffset: Int, ): PsiElement? { if (!isModsToml(contextElement)) { return null Index: src/main/kotlin/toml/platform/forge/completion/ModsTomlCompletionContributor.kt =================================================================== --- src/main/kotlin/toml/platform/forge/completion/ModsTomlCompletionContributor.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/toml/platform/forge/completion/ModsTomlCompletionContributor.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -54,7 +54,7 @@ extend( CompletionType.BASIC, inModsTomlValueWithKey(key), - ModsTomlKnownStringValuesCompletionProvider(values) + ModsTomlKnownStringValuesCompletionProvider(values), ) private fun extendKnownValues(key: String, vararg values: String) = @@ -69,7 +69,7 @@ override fun addCompletions( parameters: CompletionParameters, context: ProcessingContext, - result: CompletionResultSet + result: CompletionResultSet, ) { val schema = ModsTomlSchema.get(parameters.position.project) @@ -110,13 +110,13 @@ override fun addCompletions( parameters: CompletionParameters, context: ProcessingContext, - result: CompletionResultSet + result: CompletionResultSet, ) { val keyValue = getClosestKeyValueAncestor(parameters.position) ?: return result.addAllElements( knownValues.map { LookupElementBuilder.create(it).withInsertHandler(TomlStringValueInsertionHandler(keyValue)) - } + }, ) } } @@ -125,7 +125,7 @@ override fun addCompletions( parameters: CompletionParameters, context: ProcessingContext, - result: CompletionResultSet + result: CompletionResultSet, ) { // Make sure we do not complete after an existing value getClosestKeyValueAncestor(parameters.position) ?: return Index: src/main/kotlin/toml/toml-psi.kt =================================================================== --- src/main/kotlin/toml/toml-psi.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/toml/toml-psi.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -30,7 +30,8 @@ TomlElementTypes.BOOLEAN -> TomlValueType.BooleanType TomlElementTypes.NUMBER -> TomlValueType.NumberType TomlElementTypes.BASIC_STRING, TomlElementTypes.LITERAL_STRING, - TomlElementTypes.MULTILINE_BASIC_STRING, TomlElementTypes.MULTILINE_LITERAL_STRING -> TomlValueType.StringType + TomlElementTypes.MULTILINE_BASIC_STRING, TomlElementTypes.MULTILINE_LITERAL_STRING, + -> TomlValueType.StringType TomlElementTypes.DATE_TIME -> TomlValueType.DateType else -> null } Index: src/main/kotlin/translations/TranslationEditorNotificationProvider.kt =================================================================== --- src/main/kotlin/translations/TranslationEditorNotificationProvider.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/translations/TranslationEditorNotificationProvider.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -36,7 +36,7 @@ override fun collectNotificationData( project: Project, - file: VirtualFile + file: VirtualFile, ): Function = Function { createNotificationPanel(file, project) } private fun createNotificationPanel(file: VirtualFile, project: Project): InfoPanel? { @@ -50,7 +50,7 @@ val panel = InfoPanel() panel.setText("Translation file doesn't match default one (${TranslationConstants.DEFAULT_LOCALE} locale).") panel.createActionLabel( - "Add missing default entries (won't reflect changes in original English localization)" + "Add missing default entries (won't reflect changes in original English localization)", ) { val psi = PsiManager.getInstance(project).findFile(file) ?: return@createActionLabel psi.applyWriteAction { @@ -70,7 +70,7 @@ project, "Would you like to sort all translations now?", "Sort Translations", - Messages.getQuestionIcon() + Messages.getQuestionIcon(), ) if (sort == Messages.YES) { TranslationSorter.query(project, psi, Ordering.LIKE_DEFAULT) Index: src/main/kotlin/translations/TranslationFiles.kt =================================================================== --- src/main/kotlin/translations/TranslationFiles.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/translations/TranslationFiles.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -72,7 +72,7 @@ when { element is JsonProperty && element.value is JsonStringLiteral -> Translation( element.name, - (element.value as JsonStringLiteral).value + (element.value as JsonStringLiteral).value, ) element is LangEntry -> Translation(element.key, element.value) else -> null @@ -120,7 +120,7 @@ val files = FileTypeIndex.getFiles( if (jsonVersion) JsonFileType.INSTANCE else LangFileType, - GlobalSearchScope.moduleScope(module) + GlobalSearchScope.moduleScope(module), ).filter { getLocale(it) == TranslationConstants.DEFAULT_LOCALE } val domains = files.asSequence().mapNotNull { it.mcDomain }.distinct().sorted().toList() if (domains.size > 1) { @@ -129,7 +129,7 @@ .createPopupChooserBuilder(domains) .setTitle("Choose Resource Domain") .setAdText( - "There are multiple resource domains with localization files, choose one for this translation." + "There are multiple resource domains with localization files, choose one for this translation.", ) .setItemChosenCallback { domain -> write(files.filter { f -> f.mcDomain == domain }) @@ -166,7 +166,7 @@ doc.setText("{\n$content\n}") } else -> throw IllegalArgumentException( - "Cannot replace translations in file '${file.name}' of unknown type!" + "Cannot replace translations in file '${file.name}' of unknown type!", ) } } @@ -175,7 +175,7 @@ val doc = FileDocumentManager.getInstance().getDocument(this.virtualFile) ?: return val content = generateLangFile( this.lastChild != null && this.lastChild.node.elementType != LangTypes.LINE_ENDING, - entries + entries, ) doc.insertString(this.lastChild?.textOffset ?: 0, content) } @@ -213,7 +213,7 @@ private fun generateJsonFile( leadingComma: Boolean, indent: CharSequence, - entries: Iterable + entries: Iterable, ): CharSequence { val result = StringBuilder() @@ -244,7 +244,7 @@ val langElement = TranslationInverseIndex.findElements( entry.key, GlobalSearchScope.allScope(project), - locale + locale, ) .asSequence() .mapNotNull { it as? LangEntry } @@ -259,7 +259,7 @@ element: PsiElement, maxDepth: Int, acc: MutableList = mutableListOf(), - depth: Int = 0 + depth: Int = 0, ): List { if (maxDepth != 0 && depth >= maxDepth) { return acc @@ -287,7 +287,7 @@ .getContainingFiles( TranslationIndex.NAME, TranslationConstants.DEFAULT_LOCALE, - GlobalSearchScope.moduleScope(module) + GlobalSearchScope.moduleScope(module), ) .asSequence() .filter { domain == null || it.mcDomain == domain } Index: src/main/kotlin/translations/actions/TranslationSortOrderDialog.kt =================================================================== --- src/main/kotlin/translations/actions/TranslationSortOrderDialog.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/translations/actions/TranslationSortOrderDialog.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -56,14 +56,14 @@ override fun windowClosing(e: WindowEvent?) { onCancel() } - } + }, ) // call onCancel() on ESCAPE contentPane.registerKeyboardAction( { onCancel() }, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), - JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT + JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, ) } @@ -82,7 +82,7 @@ value: Any?, index: Int, isSelected: Boolean, - cellHasFocus: Boolean + cellHasFocus: Boolean, ): Component { val displayValue = (value as? Ordering)?.text return super.getListCellRendererComponent(list, displayValue, index, isSelected, cellHasFocus) Index: src/main/kotlin/translations/folding.kt =================================================================== --- src/main/kotlin/translations/folding.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/translations/folding.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -33,7 +33,7 @@ title = "Minecraft" checkBox( "Translation Strings", - TranslationFoldingSettings.instance::shouldFoldTranslations + TranslationFoldingSettings.instance::shouldFoldTranslations, ) { TranslationFoldingSettings.instance.shouldFoldTranslations = it } @@ -44,7 +44,7 @@ class TranslationFoldingSettings : PersistentStateComponent { data class State( - var shouldFoldTranslations: Boolean = true + var shouldFoldTranslations: Boolean = true, ) private var state = State() @@ -98,9 +98,9 @@ "\"Insufficient parameters for formatting '${translation.text}'\"" } else { "\"${translation.text}\"" - } + }, + ), - ) + ) - ) } } return descriptors.toTypedArray() Index: src/main/kotlin/translations/identification/LiteralTranslationIdentifier.kt =================================================================== --- src/main/kotlin/translations/identification/LiteralTranslationIdentifier.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/translations/identification/LiteralTranslationIdentifier.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -22,10 +22,10 @@ key = result.key.copy( infix = result.key.infix.replace( CompletionUtilCore.DUMMY_IDENTIFIER_TRIMMED, - "" + "", + ), + ), - ) + ) - ) - ) } return null } Index: src/main/kotlin/translations/identification/ReferenceTranslationIdentifier.kt =================================================================== --- src/main/kotlin/translations/identification/ReferenceTranslationIdentifier.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/translations/identification/ReferenceTranslationIdentifier.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -40,10 +40,10 @@ key = result.key.copy( infix = result.key.infix.replace( CompletionUtilCore.DUMMY_IDENTIFIER_TRIMMED, - "" + "", + ), + ), - ) + ) - ) - ) } } Index: src/main/kotlin/translations/identification/TranslationFunction.kt =================================================================== --- src/main/kotlin/translations/identification/TranslationFunction.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/translations/identification/TranslationFunction.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -30,7 +30,7 @@ val foldParameters: FoldingScope = FoldingScope.CALL, val prefix: String = "", val suffix: String = "", - val obfuscatedName: Boolean = false + val obfuscatedName: Boolean = false, ) { private fun getMethod(context: PsiElement): PsiMethod? { var reference = memberReference @@ -91,6 +91,6 @@ enum class FoldingScope { CALL, PARAMETER, - PARAMETERS + PARAMETERS, } } Index: src/main/kotlin/translations/identification/TranslationIdentifier.kt =================================================================== --- src/main/kotlin/translations/identification/TranslationIdentifier.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/translations/identification/TranslationIdentifier.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -37,7 +37,7 @@ project: Project, element: PsiExpression, container: PsiElement, - referenceElement: PsiElement + referenceElement: PsiElement, ): TranslationInstance? { if (container is PsiExpressionList && container.parent is PsiCallExpression) { val call = container.parent as PsiCallExpression @@ -64,7 +64,7 @@ translationKey, formatted, if (superfluousParams >= 0) FormattingError.SUPERFLUOUS else null, - superfluousParams + superfluousParams, ) } catch (ignored: MissingFormatArgumentException) { return TranslationInstance( @@ -73,7 +73,7 @@ referenceElement, translationKey, translation, - FormattingError.MISSING + FormattingError.MISSING, ) } } else { @@ -82,7 +82,7 @@ function.matchedIndex, referenceElement, translationKey, - null + null, ) } } Index: src/main/kotlin/translations/identification/TranslationInstance.kt =================================================================== --- src/main/kotlin/translations/identification/TranslationInstance.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/translations/identification/TranslationInstance.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -22,7 +22,7 @@ val key: Key, val text: String?, val formattingError: FormattingError? = null, - val superfluousVarargStart: Int = -1 + val superfluousVarargStart: Int = -1, ) { data class Key(val prefix: String, val infix: String, val suffix: String) { val full = (prefix + infix + suffix).trim() @@ -38,68 +38,68 @@ MemberReference( TranslationConstants.FORMAT, "(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;", - TranslationConstants.I18N_CLIENT_CLASS + TranslationConstants.I18N_CLIENT_CLASS, ), 0, formatting = true, - obfuscatedName = true + obfuscatedName = true, ), TranslationFunction( MemberReference( TranslationConstants.GET, "(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;", - TranslationConstants.I18N_CLIENT_LANG_CLASS + TranslationConstants.I18N_CLIENT_LANG_CLASS, ), 0, formatting = true, - obfuscatedName = true + obfuscatedName = true, ), TranslationFunction( MemberReference( TranslationConstants.EXISTS, "(Ljava/lang/String;)Z", - TranslationConstants.I18N_CLIENT_LANG_CLASS + TranslationConstants.I18N_CLIENT_LANG_CLASS, ), 0, formatting = false, obfuscatedName = true, - foldParameters = TranslationFunction.FoldingScope.PARAMETERS + foldParameters = TranslationFunction.FoldingScope.PARAMETERS, ), TranslationFunction( MemberReference( TranslationConstants.TRANSLATE_TO_LOCAL, "(Ljava/lang/String;)Ljava/lang/String;", - TranslationConstants.I18N_COMMON_CLASS + TranslationConstants.I18N_COMMON_CLASS, ), 0, formatting = false, - obfuscatedName = true + obfuscatedName = true, ), TranslationFunction( MemberReference( TranslationConstants.TRANSLATE_TO_LOCAL_FORMATTED, "(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;", - TranslationConstants.I18N_COMMON_CLASS + TranslationConstants.I18N_COMMON_CLASS, ), 0, formatting = true, - obfuscatedName = true + obfuscatedName = true, ), TranslationFunction( MemberReference( TranslationConstants.CONSTRUCTOR, "(Ljava/lang/String;[Ljava/lang/Object;)V", - TranslationConstants.TRANSLATION_COMPONENT_CLASS + TranslationConstants.TRANSLATION_COMPONENT_CLASS, ), 0, formatting = true, - foldParameters = TranslationFunction.FoldingScope.PARAMETERS + foldParameters = TranslationFunction.FoldingScope.PARAMETERS, ), TranslationFunction( MemberReference( TranslationConstants.CONSTRUCTOR, "(Ljava/lang/String;)V", - TranslationConstants.TRANSLATABLE_COMPONENT + TranslationConstants.TRANSLATABLE_COMPONENT, ), 0, formatting = false, @@ -108,7 +108,7 @@ MemberReference( TranslationConstants.CONSTRUCTOR, "(Ljava/lang/String;[Ljava/lang/Object;)V", - TranslationConstants.TRANSLATABLE_COMPONENT + TranslationConstants.TRANSLATABLE_COMPONENT, ), 0, formatting = true, @@ -118,7 +118,7 @@ TranslationConstants.CREATE_COMPONENT_TRANSLATION, "(Lnet/minecraft/commands/CommandSource;Ljava/lang/String;" + "[Ljava/lang/Object;)Lnet/minecraft/network/chat/BaseComponent;", - TranslationConstants.TEXT_COMPONENT_HELPER + TranslationConstants.TEXT_COMPONENT_HELPER, ), 1, formatting = true, @@ -128,17 +128,17 @@ MemberReference( TranslationConstants.CONSTRUCTOR, "(Ljava/lang/String;[Ljava/lang/Object;)V", - TranslationConstants.COMMAND_EXCEPTION_CLASS + TranslationConstants.COMMAND_EXCEPTION_CLASS, ), 0, formatting = true, - foldParameters = TranslationFunction.FoldingScope.PARAMETERS + foldParameters = TranslationFunction.FoldingScope.PARAMETERS, ), TranslationFunction( MemberReference( TranslationConstants.SET_BLOCK_NAME, "(Ljava/lang/String;)Lnet/minecraft/block/Block;", - McpConstants.BLOCK + McpConstants.BLOCK, ), 0, formatting = false, @@ -146,13 +146,13 @@ foldParameters = TranslationFunction.FoldingScope.PARAMETERS, prefix = "tile.", suffix = ".name", - obfuscatedName = true + obfuscatedName = true, ), TranslationFunction( MemberReference( TranslationConstants.SET_ITEM_NAME, "(Ljava/lang/String;)Lnet/minecraft/item/Item;", - McpConstants.ITEM + McpConstants.ITEM, ), 0, formatting = false, @@ -160,91 +160,91 @@ foldParameters = TranslationFunction.FoldingScope.PARAMETERS, prefix = "item.", suffix = ".name", - obfuscatedName = true + obfuscatedName = true, ), TranslationFunction( MemberReference( TranslationConstants.CONSTRUCTOR, "(Ljava/lang/String;ILjava/lang/String;)V", - TranslationConstants.KEY_MAPPING + TranslationConstants.KEY_MAPPING, ), 0, formatting = false, - foldParameters = TranslationFunction.FoldingScope.PARAMETER + foldParameters = TranslationFunction.FoldingScope.PARAMETER, ), TranslationFunction( MemberReference( TranslationConstants.CONSTRUCTOR, "(Ljava/lang/String;ILjava/lang/String;)V", - TranslationConstants.KEY_MAPPING + TranslationConstants.KEY_MAPPING, ), 2, formatting = false, - foldParameters = TranslationFunction.FoldingScope.PARAMETER + foldParameters = TranslationFunction.FoldingScope.PARAMETER, ), TranslationFunction( MemberReference( TranslationConstants.CONSTRUCTOR, "(Ljava/lang/String;Lcom/mojang/blaze3d/platform/InputConstants\$Type;ILjava/lang/String;)V", - TranslationConstants.KEY_MAPPING + TranslationConstants.KEY_MAPPING, ), 0, formatting = false, - foldParameters = TranslationFunction.FoldingScope.PARAMETER + foldParameters = TranslationFunction.FoldingScope.PARAMETER, ), TranslationFunction( MemberReference( TranslationConstants.CONSTRUCTOR, "(Ljava/lang/String;Lcom/mojang/blaze3d/platform/InputConstants\$Type;ILjava/lang/String;)V", - TranslationConstants.KEY_MAPPING + TranslationConstants.KEY_MAPPING, ), 3, formatting = false, - foldParameters = TranslationFunction.FoldingScope.PARAMETER + foldParameters = TranslationFunction.FoldingScope.PARAMETER, ), TranslationFunction( MemberReference( TranslationConstants.CONSTRUCTOR, "(Ljava/lang/String;Lnet/minecraftforge/client/settings/IKeyConflictContext;" + "Lcom/mojang/blaze3d/platform/InputConstants\$Type;ILjava/lang/String;)V", - TranslationConstants.KEY_MAPPING + TranslationConstants.KEY_MAPPING, ), 0, formatting = false, - foldParameters = TranslationFunction.FoldingScope.PARAMETER + foldParameters = TranslationFunction.FoldingScope.PARAMETER, ), TranslationFunction( MemberReference( TranslationConstants.CONSTRUCTOR, "(Ljava/lang/String;Lnet/minecraftforge/client/settings/IKeyConflictContext;" + "Lcom/mojang/blaze3d/platform/InputConstants\$Type;ILjava/lang/String;)V", - TranslationConstants.KEY_MAPPING + TranslationConstants.KEY_MAPPING, ), 4, formatting = false, - foldParameters = TranslationFunction.FoldingScope.PARAMETER + foldParameters = TranslationFunction.FoldingScope.PARAMETER, ), TranslationFunction( MemberReference( TranslationConstants.CONSTRUCTOR, "(Ljava/lang/String;Lnet/minecraftforge/client/settings/IKeyConflictContext;" + "Lcom/mojang/blaze3d/platform/InputConstants\$Key;Ljava/lang/String;)V", - TranslationConstants.KEY_MAPPING + TranslationConstants.KEY_MAPPING, ), 0, formatting = false, - foldParameters = TranslationFunction.FoldingScope.PARAMETER + foldParameters = TranslationFunction.FoldingScope.PARAMETER, ), TranslationFunction( MemberReference( TranslationConstants.CONSTRUCTOR, "(Ljava/lang/String;Lnet/minecraftforge/client/settings/IKeyConflictContext;" + "Lcom/mojang/blaze3d/platform/InputConstants\$Key;Ljava/lang/String;)V", - TranslationConstants.KEY_MAPPING + TranslationConstants.KEY_MAPPING, ), 3, formatting = false, - foldParameters = TranslationFunction.FoldingScope.PARAMETER + foldParameters = TranslationFunction.FoldingScope.PARAMETER, ), TranslationFunction( MemberReference( @@ -252,11 +252,11 @@ "(Ljava/lang/String;Lnet/minecraftforge/client/settings/IKeyConflictContext;" + "Lnet/minecraftforge/client/settings/KeyModifier;" + "Lcom/mojang/blaze3d/platform/InputConstants\$Type;ILjava/lang/String;)V", - TranslationConstants.KEY_MAPPING + TranslationConstants.KEY_MAPPING, ), 0, formatting = false, - foldParameters = TranslationFunction.FoldingScope.PARAMETER + foldParameters = TranslationFunction.FoldingScope.PARAMETER, ), TranslationFunction( MemberReference( @@ -264,11 +264,11 @@ "(Ljava/lang/String;Lnet/minecraftforge/client/settings/IKeyConflictContext;" + "Lnet/minecraftforge/client/settings/KeyModifier;" + "Lcom/mojang/blaze3d/platform/InputConstants\$Type;ILjava/lang/String;)V", - TranslationConstants.KEY_MAPPING + TranslationConstants.KEY_MAPPING, ), 5, formatting = false, - foldParameters = TranslationFunction.FoldingScope.PARAMETER + foldParameters = TranslationFunction.FoldingScope.PARAMETER, ), TranslationFunction( MemberReference( @@ -276,11 +276,11 @@ "(Ljava/lang/String;Lnet/minecraftforge/client/settings/IKeyConflictContext;" + "Lnet/minecraftforge/client/settings/KeyModifier;" + "Lcom/mojang/blaze3d/platform/InputConstants\$Key;Ljava/lang/String;)V", - TranslationConstants.KEY_MAPPING + TranslationConstants.KEY_MAPPING, ), 0, formatting = false, - foldParameters = TranslationFunction.FoldingScope.PARAMETER + foldParameters = TranslationFunction.FoldingScope.PARAMETER, ), TranslationFunction( MemberReference( @@ -288,22 +288,22 @@ "(Ljava/lang/String;Lnet/minecraftforge/client/settings/IKeyConflictContext;" + "Lnet/minecraftforge/client/settings/KeyModifier;" + "Lcom/mojang/blaze3d/platform/InputConstants\$Key;Ljava/lang/String;)V", - TranslationConstants.KEY_MAPPING + TranslationConstants.KEY_MAPPING, ), 4, formatting = false, - foldParameters = TranslationFunction.FoldingScope.PARAMETER + foldParameters = TranslationFunction.FoldingScope.PARAMETER, ), TranslationFunction( MemberReference( TranslationConstants.INPUT_CONSTANTS_KEY_GET_KEY, "(Ljava/lang/String;)Lcom/mojang/blaze3d/platform/InputConstants\$Key;", - TranslationConstants.INPUT_CONSTANTS_KEY + TranslationConstants.INPUT_CONSTANTS_KEY, ), 0, formatting = false, foldParameters = TranslationFunction.FoldingScope.PARAMETER, - obfuscatedName = true + obfuscatedName = true, ), ) Index: src/main/kotlin/translations/index/TranslationIndex.kt =================================================================== --- src/main/kotlin/translations/index/TranslationIndex.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/translations/index/TranslationIndex.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -57,7 +57,7 @@ return getEntries( GlobalSearchScope.fileScope(project, file), TranslationFiles.getLocale(file) ?: return emptySequence(), - file.mcDomain + file.mcDomain, ).flatten() } @@ -66,7 +66,7 @@ return getEntries( GlobalSearchScope.fileScope(file), TranslationFiles.getLocale(virtualFile) ?: return emptySequence(), - virtualFile.mcDomain + virtualFile.mcDomain, ).flatten() } @@ -80,7 +80,7 @@ FileBasedIndex.getInstance().getValues( TranslationIndex.NAME, locale, - scope + scope, ).asSequence() .filter { domain == null || it.sourceDomain == domain } Index: src/main/kotlin/translations/index/providers.kt =================================================================== --- src/main/kotlin/translations/index/providers.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/translations/index/providers.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -40,7 +40,7 @@ companion object { val INSTANCES = mapOf( JsonFileType.INSTANCE to JsonTranslationProvider, - LangFileType to LangTranslationProvider + LangFileType to LangTranslationProvider, ) } } @@ -67,12 +67,12 @@ 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( value?.propertyList?.filter { it.name == key } ?: emptyList(), - PsiModificationTracker.MODIFICATION_COUNT + PsiModificationTracker.MODIFICATION_COUNT, ) } } @@ -94,11 +94,11 @@ val psiFile = PsiManager.getInstance(project).findFile(file) as? LangFile ?: return emptyList() return CachedValuesManager.getCachedValue( psiFile, - Key("translation_lookup.$key") + Key("translation_lookup.$key"), ) { CachedValueProvider.Result.create( psiFile.childrenOfType().filter { it.key == key }, - PsiModificationTracker.MODIFICATION_COUNT + PsiModificationTracker.MODIFICATION_COUNT, ) } } Index: src/main/kotlin/translations/inspections/ChangeTranslationQuickFix.kt =================================================================== --- src/main/kotlin/translations/inspections/ChangeTranslationQuickFix.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/translations/inspections/ChangeTranslationQuickFix.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -34,7 +34,7 @@ val popup = ChooseByNamePopup.createPopup( project, TranslationGotoModel(project, key.prefix, key.suffix), - null + null, ) popup.invoke( object : ChooseByNamePopupComponent.Callback() { @@ -43,19 +43,19 @@ literal.containingFile.runWriteAction { val insertion = selectedKey.substring( key.prefix.length, - selectedKey.length - key.suffix.length + selectedKey.length - key.suffix.length, ) literal.replace( JavaPsiFacade.getInstance(project).elementFactory.createExpressionFromText( "\"$insertion\"", - literal.context + literal.context, + ), - ) + ) - ) } } }, ModalityState.current(), - false + false, ) } catch (ignored: IncorrectOperationException) { } Index: src/main/kotlin/translations/inspections/MissingFormatInspection.kt =================================================================== --- src/main/kotlin/translations/inspections/MissingFormatInspection.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/translations/inspections/MissingFormatInspection.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -42,7 +42,7 @@ expression, "There are missing formatting arguments to satisfy '${result.text}'", ProblemHighlightType.GENERIC_ERROR, - *quickFixes + *quickFixes, ) } } Index: src/main/kotlin/translations/inspections/NoTranslationInspection.kt =================================================================== --- src/main/kotlin/translations/inspections/NoTranslationInspection.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/translations/inspections/NoTranslationInspection.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -39,7 +39,7 @@ "The given translation key does not exist", ProblemHighlightType.GENERIC_ERROR, CreateTranslationQuickFix, - ChangeTranslationQuickFix("Use existing translation") + ChangeTranslationQuickFix("Use existing translation"), ) } } @@ -57,7 +57,7 @@ val result = Messages.showInputDialog( "Enter default value for \"$key\":", "Create Translation", - Messages.getQuestionIcon() + Messages.getQuestionIcon(), ) if (result != null) { TranslationFiles.add(literal, key, result) Index: src/main/kotlin/translations/inspections/SuperfluousFormatInspection.kt =================================================================== --- src/main/kotlin/translations/inspections/SuperfluousFormatInspection.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/translations/inspections/SuperfluousFormatInspection.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -56,9 +56,9 @@ RemoveArgumentsQuickFix( SmartPointerManager.getInstance(holder.project) .createSmartPsiElementPointer(result.foldingElement), - result.superfluousVarargStart + result.superfluousVarargStart, ), - ChangeTranslationQuickFix("Use a different translation") + ChangeTranslationQuickFix("Use a different translation"), ) } } @@ -66,20 +66,20 @@ private fun registerProblem( expression: PsiExpression, result: TranslationInstance, - vararg quickFixes: LocalQuickFix + vararg quickFixes: LocalQuickFix, ) { holder.registerProblem( expression, "There are missing formatting arguments to satisfy '${result.text}'", ProblemHighlightType.GENERIC_ERROR, - *quickFixes + *quickFixes, ) } } private class RemoveArgumentsQuickFix( private val call: SmartPsiElementPointer, - private val position: Int + private val position: Int, ) : LocalQuickFix { override fun getName() = "Remove superfluous arguments" Index: src/main/kotlin/translations/intentions/ConvertToTranslationIntention.kt =================================================================== --- src/main/kotlin/translations/intentions/ConvertToTranslationIntention.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/translations/intentions/ConvertToTranslationIntention.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -56,7 +56,7 @@ override fun canClose(inputString: String): Boolean { return !inputString.isEmpty() && !inputString.contains('=') } - } + }, ) val key = result.first val replaceLiteral = result.second @@ -67,7 +67,7 @@ psi.runWriteAction { val expression = JavaPsiFacade.getElementFactory(project).createExpressionFromText( "net.minecraft.client.resources.I18n.format(\"$key\")", - element.context + element.context, ) if (psi.language === JavaLanguage.INSTANCE) { JavaCodeStyleManager.getInstance(project) Index: src/main/kotlin/translations/intentions/RemoveDuplicatesIntention.kt =================================================================== --- src/main/kotlin/translations/intentions/RemoveDuplicatesIntention.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/translations/intentions/RemoveDuplicatesIntention.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -30,7 +30,7 @@ val keep = TranslationFiles.seekTranslation(element) ?: return val entries = TranslationInverseIndex.findElements( translation.key, - GlobalSearchScope.fileScope(element.containingFile) + GlobalSearchScope.fileScope(element.containingFile), ) for (other in entries) { if (other !== keep) { Index: src/main/kotlin/translations/intentions/TrimKeyIntention.kt =================================================================== --- src/main/kotlin/translations/intentions/TrimKeyIntention.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/translations/intentions/TrimKeyIntention.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -25,7 +25,7 @@ override fun isAvailable(project: Project, editor: Editor, element: PsiElement): Boolean { val translation = TranslationFiles.toTranslation( - TranslationFiles.seekTranslation(element) ?: return false + TranslationFiles.seekTranslation(element) ?: return false, ) ?: return false return translation.key != translation.trimmedKey Index: src/main/kotlin/translations/lang/colors/LangColorSettingsPage.kt =================================================================== --- src/main/kotlin/translations/lang/colors/LangColorSettingsPage.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/translations/lang/colors/LangColorSettingsPage.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -35,7 +35,7 @@ AttributesDescriptor("Key", LangSyntaxHighlighter.KEY), AttributesDescriptor("Separator", LangSyntaxHighlighter.EQUALS), AttributesDescriptor("Value", LangSyntaxHighlighter.VALUE), - AttributesDescriptor("Comments", LangSyntaxHighlighter.COMMENT) + AttributesDescriptor("Comments", LangSyntaxHighlighter.COMMENT), ) } } Index: src/main/kotlin/translations/lang/formatting/LangBlock.kt =================================================================== --- src/main/kotlin/translations/lang/formatting/LangBlock.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/translations/lang/formatting/LangBlock.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -40,7 +40,7 @@ child, Wrap.createWrap(WrapType.NONE, false), Alignment.createAlignment(), - spacingBuilder + spacingBuilder, ) blocks.add(block) } Index: src/main/kotlin/translations/lang/formatting/LangFormattingModelBuilder.kt =================================================================== --- src/main/kotlin/translations/lang/formatting/LangFormattingModelBuilder.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/translations/lang/formatting/LangFormattingModelBuilder.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -30,9 +30,9 @@ formattingContext.node, Wrap.createWrap(WrapType.NONE, false), Alignment.createAlignment(), - createSpaceBuilder(formattingContext.codeStyleSettings) + createSpaceBuilder(formattingContext.codeStyleSettings), ), - formattingContext.codeStyleSettings + formattingContext.codeStyleSettings, ) } Index: src/main/kotlin/translations/reference/TranslationGotoModel.kt =================================================================== --- src/main/kotlin/translations/reference/TranslationGotoModel.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/translations/reference/TranslationGotoModel.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -26,19 +26,19 @@ ContributorsBasedGotoByModel( project, arrayOf( - ChooseByNameContributor.SYMBOL_EP_NAME.findExtensionOrFail(TranslationGotoSymbolContributor::class.java) - ) + ChooseByNameContributor.SYMBOL_EP_NAME.findExtensionOrFail(TranslationGotoSymbolContributor::class.java), + ), ) { override fun acceptItem(item: NavigationItem?): Boolean { return TranslationFiles.getLocale( - (item as PsiElement).containingFile?.virtualFile + (item as PsiElement).containingFile?.virtualFile, ) == TranslationConstants.DEFAULT_LOCALE } override fun getElementsByName( name: String, parameters: FindSymbolParameters, - canceled: ProgressIndicator + canceled: ProgressIndicator, ): Array { val superResult = super.getElementsByName(name, parameters, canceled).asSequence() val result = TreeSet { o1, o2 -> @@ -48,7 +48,7 @@ superResult.map { it as PsiNamedElement }.filter { val key = it.name ?: return@filter false key.startsWith(prefix) && key.endsWith(suffix) - } + }, ) return result.toArray() } Index: src/main/kotlin/translations/reference/TranslationGotoSymbolContributor.kt =================================================================== --- src/main/kotlin/translations/reference/TranslationGotoSymbolContributor.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/translations/reference/TranslationGotoSymbolContributor.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -40,7 +40,7 @@ name: String, pattern: String, project: Project, - includeNonProjectItems: Boolean + includeNonProjectItems: Boolean, ): Array { val scope = if (includeNonProjectItems) { GlobalSearchScope.allScope(project) Index: src/main/kotlin/translations/reference/TranslationReference.kt =================================================================== --- src/main/kotlin/translations/reference/TranslationReference.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/translations/reference/TranslationReference.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -38,14 +38,14 @@ private val renameHandler: (element: PsiElement, range: TextRange, newName: String) -> PsiElement = { elem, range, newName -> ElementManipulators.getManipulator(elem).handleContentChange(elem, range, newName)!! - } + }, ) : PsiReferenceBase.Poly(element, textRange, false), PsiPolyVariantReference { override fun multiResolve(incompleteCode: Boolean): Array { val project = myElement.project val entries = TranslationInverseIndex.findElements( key.full, GlobalSearchScope.allScope(project), - TranslationConstants.DEFAULT_LOCALE + TranslationConstants.DEFAULT_LOCALE, ) return entries.mapToArray(::PsiElementResolveResult) } Index: src/main/kotlin/translations/reference/TranslationReferenceSearch.kt =================================================================== --- src/main/kotlin/translations/reference/TranslationReferenceSearch.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/translations/reference/TranslationReferenceSearch.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -63,7 +63,7 @@ } true }, - FindUsagesProcessPresentation(UsageViewPresentation()) + FindUsagesProcessPresentation(UsageViewPresentation()), ) } return true Index: src/main/kotlin/translations/reference/completion.kt =================================================================== --- src/main/kotlin/translations/reference/completion.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/translations/reference/completion.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -57,9 +57,9 @@ prefixResult.addElement( PrioritizedLookupElement.withPriority( LookupElementBuilder.create(key).withIcon(PlatformAssets.MINECRAFT_ICON), - 1.0 + key.getSimilarity(text) + 1.0 + key.getSimilarity(text), + ), - ) + ) - ) } } } Index: src/main/kotlin/translations/reference/contributors.kt =================================================================== --- src/main/kotlin/translations/reference/contributors.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/translations/reference/contributors.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -34,7 +34,7 @@ object : PsiReferenceProvider() { override fun getReferencesByElement( element: PsiElement, - context: ProcessingContext + context: ProcessingContext, ): Array { val result = identifier.identifyUnsafe(element) if (result != null) { @@ -43,13 +43,13 @@ TranslationReference( referenceElement, TextRange(1, referenceElement.textLength - 1), - result.key + result.key, + ), - ) + ) - ) } return emptyArray() } - } + }, ) } } @@ -62,7 +62,7 @@ object : PsiReferenceProvider() { override fun getReferencesByElement( element: PsiElement, - context: ProcessingContext + context: ProcessingContext, ): Array { if (!TranslationFiles.isTranslationFile(element.containingFile?.virtualFile)) { return arrayOf() @@ -76,13 +76,13 @@ TranslationReference( element, nameTextRange.shiftRight(1).grown(-2), - TranslationInstance.Key("", entry.name, "") + TranslationInstance.Key("", entry.name, ""), ) { elem, _, newName -> (elem as JsonProperty).setName(newName) - } + }, ) } - } + }, ) } } @@ -94,18 +94,18 @@ object : PsiReferenceProvider() { override fun getReferencesByElement( element: PsiElement, - context: ProcessingContext + context: ProcessingContext, ): Array { val entry = element as LangEntry return arrayOf( TranslationReference( element, TextRange(0, entry.key.length), - TranslationInstance.Key("", entry.key, "") + TranslationInstance.Key("", entry.key, ""), + ), - ) + ) - ) } - } + }, ) } } Index: src/main/kotlin/translations/reference/usages.kt =================================================================== --- src/main/kotlin/translations/reference/usages.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/translations/reference/usages.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -47,7 +47,7 @@ JsonLexer(), TokenSet.create(JsonElementTypes.DOUBLE_QUOTED_STRING, JsonElementTypes.SINGLE_QUOTED_STRING), TokenSet.create(JsonElementTypes.BLOCK_COMMENT, JsonElementTypes.LINE_COMMENT), - TokenSet.EMPTY + TokenSet.EMPTY, ) } @@ -57,6 +57,6 @@ LangLexerAdapter(), TokenSet.create(LangTypes.KEY), TokenSet.create(LangTypes.COMMENT), - TokenSet.EMPTY + TokenSet.EMPTY, ) } Index: src/main/kotlin/translations/sorting/Ordering.kt =================================================================== --- src/main/kotlin/translations/sorting/Ordering.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/translations/sorting/Ordering.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -16,5 +16,5 @@ ASCENDING("Ascending"), DESCENDING("Descending"), LIKE_DEFAULT("Like default (${TranslationConstants.DEFAULT_LOCALE})"), - TEMPLATE("Use Project Template") + TEMPLATE("Use Project Template"), } Index: src/main/kotlin/translations/sorting/TranslationSorter.kt =================================================================== --- src/main/kotlin/translations/sorting/TranslationSorter.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/translations/sorting/TranslationSorter.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -23,7 +23,7 @@ object TranslationSorter { private val ascendingComparator = compareBy>( - naturalOrder().lexicographical() + naturalOrder().lexicographical(), ) { it.key.split('.') } private val descendingComparator = ascendingComparator.reversed() @@ -52,20 +52,20 @@ project, locale, it.sortedWith(ascendingComparator), - keepComments + keepComments, ) Ordering.DESCENDING -> TranslationFiles.buildFileEntries( project, locale, it.sortedWith(descendingComparator), - keepComments + keepComments, ) Ordering.TEMPLATE -> sortByTemplate( project, locale, TemplateManager.getProjectTemplate(project), it, - keepComments + keepComments, ) else -> sortByTemplate( project, @@ -73,7 +73,7 @@ TranslationFiles.buildSortingTemplateFromDefault(file, domain) ?: throw IllegalStateException("Could not generate template from default translation file"), it, - keepComments + keepComments, ) } } @@ -88,7 +88,7 @@ locale: String, template: Template, entries: Sequence, - keepComments: Int + keepComments: Int, ) = sequence { val tmp = entries.toMutableList() @@ -103,9 +103,9 @@ project, locale, toWrite.sortedWith(ascendingComparator), - keepComments + keepComments, + ), - ) + ) - ) tmp.removeAll(toWrite) } } @@ -117,9 +117,9 @@ project, locale, tmp.sortedWith(ascendingComparator).asSequence(), - keepComments + keepComments, + ), - ) + ) - ) } } } Index: src/main/kotlin/translations/sorting/TranslationTemplateConfigurable.kt =================================================================== --- src/main/kotlin/translations/sorting/TranslationTemplateConfigurable.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/translations/sorting/TranslationTemplateConfigurable.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -69,7 +69,7 @@ val editorColorsScheme = EditorColorsManager.getInstance().globalScheme val highlighter = LexerEditorHighlighter( LangSyntaxHighlighter(TranslationTemplateLexerAdapter()), - editorColorsScheme + editorColorsScheme, ) (templateEditor as EditorEx).highlighter = highlighter templateEditor.settings.isLineNumbersShown = true Index: src/main/kotlin/translations/sorting/template.kt =================================================================== --- src/main/kotlin/translations/sorting/template.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/translations/sorting/template.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -37,7 +37,7 @@ } } else { listOf() - } + }, ) private val keyRegex = Regex("([?!]?[+*]?)([^+*!?]*)([?!]?[+*]?)") Index: src/main/kotlin/update/Channels.kt =================================================================== --- src/main/kotlin/update/Channels.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/update/Channels.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -13,7 +13,8 @@ import com.intellij.openapi.updateSettings.impl.UpdateSettings enum class Channels(val title: String, val url: String) { - NIGHTLY("Nightly", "https://plugins.jetbrains.com/plugins/Nightly/8327"); + NIGHTLY("Nightly", "https://plugins.jetbrains.com/plugins/Nightly/8327"), + ; fun hasChannel(): Boolean { return UpdateSettings.getInstance().pluginHosts.contains(url) Index: src/main/kotlin/update/PluginUpdater.kt =================================================================== --- src/main/kotlin/update/PluginUpdater.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/update/PluginUpdater.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -138,7 +138,7 @@ e.printStackTrace() } } - } + }, ) } } Index: src/main/kotlin/util/ActionData.kt =================================================================== --- src/main/kotlin/util/ActionData.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/util/ActionData.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -23,5 +23,5 @@ val file: PsiFile, val element: PsiElement, val caret: Caret, - val instance: MinecraftFacet + val instance: MinecraftFacet, ) Index: src/main/kotlin/util/License.kt =================================================================== --- src/main/kotlin/util/License.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/util/License.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -22,6 +22,7 @@ GPL_3("GNU GPL 3.0", "GPL-3.0"), AGPL_3("GNU AGPL 3.0", "AGPL-3.0"), UNLICENSE("Unlicense", "unlicense"), + ; override fun toString() = displayName Index: src/main/kotlin/util/MemberReference.kt =================================================================== --- src/main/kotlin/util/MemberReference.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/util/MemberReference.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -30,7 +30,7 @@ val descriptor: String? = null, override val owner: String? = null, val matchAllNames: Boolean = false, - val matchAllDescs: Boolean = false + val matchAllDescs: Boolean = false, ) : Serializable, MixinSelector { init { Index: src/main/kotlin/util/MinecraftTemplates.kt =================================================================== --- src/main/kotlin/util/MinecraftTemplates.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/util/MinecraftTemplates.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -82,7 +82,7 @@ group.addTemplate(fabricGroup) fabricGroup.addTemplate(FileTemplateDescriptor(FABRIC_BUILD_GRADLE_TEMPLATE, PlatformAssets.FABRIC_ICON)) fabricGroup.addTemplate( - FileTemplateDescriptor(FABRIC_GRADLE_PROPERTIES_TEMPLATE, PlatformAssets.FABRIC_ICON) + FileTemplateDescriptor(FABRIC_GRADLE_PROPERTIES_TEMPLATE, PlatformAssets.FABRIC_ICON), ) fabricGroup.addTemplate(FileTemplateDescriptor(FABRIC_MIXINS_JSON_TEMPLATE, PlatformAssets.FABRIC_ICON)) fabricGroup.addTemplate(FileTemplateDescriptor(FABRIC_MOD_JSON_TEMPLATE, PlatformAssets.FABRIC_ICON)) Index: src/main/kotlin/util/ModuleDebugRunConfigurationExtension.kt =================================================================== --- src/main/kotlin/util/ModuleDebugRunConfigurationExtension.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/util/ModuleDebugRunConfigurationExtension.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -30,7 +30,7 @@ override fun > updateJavaParameters( configuration: T, params: JavaParameters, - runnerSettings: RunnerSettings? + runnerSettings: RunnerSettings?, ) { } @@ -39,7 +39,7 @@ override fun attachToProcess( configuration: RunConfigurationBase<*>, handler: ProcessHandler, - runnerSettings: RunnerSettings? + runnerSettings: RunnerSettings?, ) { // Check if we are in a debug run if (runnerSettings !is DebuggingRunnerData) { Index: src/main/kotlin/util/SemanticVersion.kt =================================================================== --- src/main/kotlin/util/SemanticVersion.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/util/SemanticVersion.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -22,7 +22,7 @@ */ class SemanticVersion( val parts: List, - private val buildMetadata: String = "" + private val buildMetadata: String = "", ) : Comparable { private fun createVersionString(): String { @@ -73,7 +73,7 @@ val TEXT_PRIORITIES = mapOf( "snapshot" to 0, "rc" to 1, - "pre" to 1 + "pre" to 1, ) /** @@ -105,7 +105,7 @@ } else { throw IllegalArgumentException( "Failed to parse version part as integer: $part " + - "(whole version text: $value)" + "(whole version text: $value)", ) } @@ -114,7 +114,7 @@ versionPart: String, preReleasePart: String, separator: Char, - versionString: String + versionString: String, ): VersionPart { val version = parseInt(versionPart) if (!preReleasePart.contains('.')) { @@ -204,7 +204,7 @@ val version: Int, val separator: Char, val subParts: List, - override val versionString: String + override val versionString: String, ) : VersionPart() { override fun compareTo(other: VersionPart): Int = Index: src/main/kotlin/util/SourceType.kt =================================================================== --- src/main/kotlin/util/SourceType.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/util/SourceType.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -14,5 +14,5 @@ SOURCE, RESOURCE, TEST_SOURCE, - TEST_RESOURCE + TEST_RESOURCE, } Index: src/main/kotlin/util/call-utils.kt =================================================================== --- src/main/kotlin/util/call-utils.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/util/call-utils.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -45,7 +45,7 @@ type: PsiType, elements: List, allowReferences: Boolean, - allowTranslations: Boolean + allowTranslations: Boolean, ): Array { tailrec fun resolveReference(expression: PsiExpression): Array { if (expression is PsiTypeCastExpression && expression.operand != null) { Index: src/main/kotlin/util/class-utils.kt =================================================================== --- src/main/kotlin/util/class-utils.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/util/class-utils.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -117,7 +117,7 @@ fun findQualifiedClass( project: Project, fullQualifiedName: String, - scope: GlobalSearchScope = GlobalSearchScope.allScope(project) + scope: GlobalSearchScope = GlobalSearchScope.allScope(project), ): PsiClass? { return findQualifiedClass(fullQualifiedName) { name -> JavaPsiFacade.getInstance(project).findClass(name, scope) @@ -126,7 +126,7 @@ fun findQualifiedClass( fullQualifiedName: String, - outerResolver: (String) -> PsiClass? + outerResolver: (String) -> PsiClass?, ): PsiClass? { var innerPos = fullQualifiedName.indexOf('$') if (innerPos == -1) { @@ -232,7 +232,7 @@ pattern: PsiMethod, checkBases: Boolean, name: String = pattern.name, - constructor: Boolean = pattern.isConstructor + constructor: Boolean = pattern.isConstructor, ): PsiMethod? { return findMethodsByName(name, checkBases).firstOrNull { it.isMatchingMethod(pattern, constructor) } } @@ -241,7 +241,7 @@ pattern: PsiMethod, checkBases: Boolean, name: String = pattern.name, - constructor: Boolean = pattern.isConstructor + constructor: Boolean = pattern.isConstructor, ): List { return findMethodsByName(name, checkBases).filter { it.isMatchingMethod(pattern, constructor) } } @@ -250,7 +250,7 @@ pattern: PsiMethod, checkBases: Boolean, name: String, - func: (PsiMethod) -> Unit + func: (PsiMethod) -> Unit, ) { for (method in findMethodsByName(name, checkBases)) { if (method.isMatchingMethod(pattern)) { @@ -279,7 +279,7 @@ private fun areReallyOnlyParametersErasureEqual( parameterList1: PsiParameterList, - parameterList2: PsiParameterList + parameterList2: PsiParameterList, ): Boolean { // Similar to MethodSignatureUtil.areParametersErasureEqual, but doesn't check method name if (parameterList1.parametersCount != parameterList2.parametersCount) { Index: src/main/kotlin/util/code-gen.kt =================================================================== --- src/main/kotlin/util/code-gen.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) +++ src/main/kotlin/util/code-gen.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -0,0 +1,51 @@ +/* + * Minecraft Dev for IntelliJ + * + * https://minecraftdev.org + * + * Copyright (c) 2023 minecraft-dev + * + * MIT License + */ + +package com.demonwav.mcdev.util + +import com.intellij.codeInsight.generation.PsiGenerationInfo +import com.intellij.openapi.project.Project +import com.intellij.openapi.util.text.StringUtil +import com.intellij.psi.JavaPsiFacade +import com.intellij.psi.PsiAnnotation +import com.intellij.psi.PsiClass +import com.intellij.psi.PsiClassType +import com.intellij.psi.PsiMember +import com.intellij.psi.PsiMethod +import com.intellij.psi.PsiType +import com.intellij.psi.search.GlobalSearchScope + +fun createVoidMethodWithParameterType(project: Project, name: String, paramType: PsiClass): PsiMethod? { + val newMethod = JavaPsiFacade.getElementFactory(project).createMethod(name, PsiType.VOID) + + val list = newMethod.parameterList + val qName = paramType.qualifiedName ?: return null + val parameter = JavaPsiFacade.getElementFactory(project) + .createParameter( + "event", + PsiClassType.getTypeByName(qName, project, GlobalSearchScope.allScope(project)), + ) + list.add(parameter) + + return newMethod +} + +fun generationInfoFromMethod(method: T, annotation: PsiAnnotation, newMethod: T): PsiGenerationInfo { + val realName = method.realName + if (realName != null && realName != method.name) { + val elementFactory = JavaPsiFacade.getElementFactory(method.project) + val value = elementFactory.createExpressionFromText( + "\"${StringUtil.escapeStringCharacters(realName)}\"", + annotation, + ) + annotation.setDeclaredAttributeValue("aliases", value) + } + return PsiGenerationInfo(newMethod) +} Index: src/main/kotlin/util/coroutine-utils.kt =================================================================== --- src/main/kotlin/util/coroutine-utils.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/util/coroutine-utils.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -18,5 +18,5 @@ fun CoroutineScope.asyncIO( start: CoroutineStart = CoroutineStart.DEFAULT, - block: suspend CoroutineScope.() -> T + block: suspend CoroutineScope.() -> T, ): Deferred = async(Dispatchers.IO, start, block) Index: src/main/kotlin/util/gradle-util.kt =================================================================== --- src/main/kotlin/util/gradle-util.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/util/gradle-util.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -36,7 +36,7 @@ project: Project, dir: Path, func: (ExternalSystemTaskExecutionSettings) -> Unit, - callback: TaskCallback + callback: TaskCallback, ) { val settings = ExternalSystemTaskExecutionSettings().apply { externalSystemIdString = GradleConstants.SYSTEM_ID.id @@ -52,7 +52,7 @@ GradleConstants.SYSTEM_ID, callback, ProgressExecutionMode.IN_BACKGROUND_ASYNC, - false + false, ) } Index: src/main/kotlin/util/json-patterns.kt =================================================================== --- src/main/kotlin/util/json-patterns.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/util/json-patterns.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -26,7 +26,7 @@ val parent = t.parent as? JsonProperty ?: return false return parent.value == t && parent.name == property } - } + }, ) private object PropertyKeyCondition : PatternCondition("isPropertyKey") { Index: src/main/kotlin/util/patterns.kt =================================================================== --- src/main/kotlin/util/patterns.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/util/patterns.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -24,22 +24,22 @@ // It can be more if the value is for example enclosed in parentheses fun > PsiJavaElementPattern.insideAnnotationAttribute( annotation: PsiAnnotationPattern, - attribute: String + attribute: String, ): Self { return inside( true, PsiJavaPatterns.psiNameValuePair().withName(attribute) .withParent( PlatformPatterns.psiElement(PsiAnnotationParameterList::class.java) - .withParent(annotation) + .withParent(annotation), ), - ANNOTATION_ATTRIBUTE_STOP + ANNOTATION_ATTRIBUTE_STOP, ) } fun > PsiJavaElementPattern.insideAnnotationAttribute( annotation: String, - attribute: String = "value" + attribute: String = "value", ): Self { return insideAnnotationAttribute(PsiJavaPatterns.psiAnnotation().qName(annotation), attribute) } Index: src/main/kotlin/util/psi-utils.kt =================================================================== --- src/main/kotlin/util/psi-utils.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/util/psi-utils.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -230,7 +230,9 @@ ?: return@cached null ModuleManager.getInstance(project).modules.asSequence() .filter { OrderEntryUtil.findLibraryOrderEntry(ModuleRootManager.getInstance(it), library) != null } - } else sequenceOf(this.findModule()) + } else { + sequenceOf(this.findModule()) + } modules.mapNotNull { it?.findMcpModule() }.firstOrNull() } Index: src/main/kotlin/util/reference/ClassNameReferenceProvider.kt =================================================================== --- src/main/kotlin/util/reference/ClassNameReferenceProvider.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/util/reference/ClassNameReferenceProvider.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -86,7 +86,9 @@ } basePackage.length + 1 - } else 0 + } else { + 0 + } val end = packageName.indexOf('.', start) return if (end == -1) { Index: src/main/kotlin/util/reference/PackageNameReferenceProvider.kt =================================================================== --- src/main/kotlin/util/reference/PackageNameReferenceProvider.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/util/reference/PackageNameReferenceProvider.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -40,7 +40,7 @@ protected open fun resolve( qualifiedName: String, element: PsiElement, - facade: JavaPsiFacade + facade: JavaPsiFacade, ): Array { facade.findPackage(qualifiedName)?.let { return arrayOf(PsiElementResolveResult(it)) } return ResolveResult.EMPTY_ARRAY @@ -55,7 +55,7 @@ protected inline fun collectPackageChildren( context: PsiPackage, classes: Iterable, - classFunc: (PsiClass) -> Any? + classFunc: (PsiClass) -> Any?, ): Array { val parentPackage = context.qualifiedName val subPackageStart = parentPackage.length + 1 Index: src/main/kotlin/util/reference/ReferenceResolver.kt =================================================================== --- src/main/kotlin/util/reference/ReferenceResolver.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/util/reference/ReferenceResolver.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -131,7 +131,7 @@ private class ReplaceElementWithLiteral( private val editor: Editor, private val file: PsiFile, - private val text: String + private val text: String, ) : Runnable { override fun run() { @@ -145,9 +145,9 @@ element.replace( JavaPsiFacade.getElementFactory(element.project).createExpressionFromText( "\"$text\"", - element.parent + element.parent, + ), - ) + ) - ) } } } Index: src/main/kotlin/util/reflection-utils.kt =================================================================== --- src/main/kotlin/util/reflection-utils.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/main/kotlin/util/reflection-utils.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -27,7 +27,7 @@ name: String, params: Array>, args: Array, - owner: Class<*> = javaClass + owner: Class<*> = javaClass, ): Any? { return runCatching { val method = owner.getDeclaredMethod(name, *params) Index: src/test/kotlin/framework/BaseMinecraftTest.kt =================================================================== --- src/test/kotlin/framework/BaseMinecraftTest.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/test/kotlin/framework/BaseMinecraftTest.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -24,9 +24,9 @@ import com.intellij.testFramework.fixtures.DefaultLightProjectDescriptor abstract class BaseMinecraftTest( - vararg platformTypes: PlatformType + vararg platformTypes: PlatformType, ) : ProjectBuilderTest( - getProjectDescriptor(platformTypes) + getProjectDescriptor(platformTypes), ) { protected open val resourcePath = "src/test/resources" protected open val packagePath = "com/demonwav/mcdev" Index: src/test/kotlin/framework/EdtInterceptor.kt =================================================================== --- src/test/kotlin/framework/EdtInterceptor.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/test/kotlin/framework/EdtInterceptor.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -20,7 +20,7 @@ override fun interceptBeforeEachMethod( invocation: InvocationInterceptor.Invocation, invocationContext: ReflectiveInvocationContext, - extensionContext: ExtensionContext + extensionContext: ExtensionContext, ) { exec(invocation, invocationContext) } @@ -28,7 +28,7 @@ override fun interceptAfterEachMethod( invocation: InvocationInterceptor.Invocation, invocationContext: ReflectiveInvocationContext, - extensionContext: ExtensionContext + extensionContext: ExtensionContext, ) { exec(invocation, invocationContext) } @@ -36,14 +36,14 @@ override fun interceptTestMethod( invocation: InvocationInterceptor.Invocation, invocationContext: ReflectiveInvocationContext, - extensionContext: ExtensionContext + extensionContext: ExtensionContext, ) { exec(invocation, invocationContext) } private fun exec( invocation: InvocationInterceptor.Invocation, - invocationContext: ReflectiveInvocationContext + invocationContext: ReflectiveInvocationContext, ) { if (invocationContext.executable.getAnnotation(NoEdt::class.java) != null) { invocation.proceed() Index: src/test/kotlin/framework/MockJdk.kt =================================================================== --- src/test/kotlin/framework/MockJdk.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/test/kotlin/framework/MockJdk.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -55,7 +55,7 @@ override fun addRootSetChangedListener(listener: RootProvider.RootSetChangedListener) {} override fun addRootSetChangedListener( listener: RootProvider.RootSetChangedListener, - parentDisposable: Disposable + parentDisposable: Disposable, ) { } Index: src/test/kotlin/framework/ProjectBuilder.kt =================================================================== --- src/test/kotlin/framework/ProjectBuilder.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/test/kotlin/framework/ProjectBuilder.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -33,25 +33,25 @@ path: String, @Language("JAVA") code: String, configure: Boolean = true, - allowAst: Boolean = false + allowAst: Boolean = false, ) = file(path, code, ".java", configure, allowAst) fun at( path: String, @Language("Access Transformers") code: String, configure: Boolean = true, - allowAst: Boolean = false + allowAst: Boolean = false, ) = file(path, code, "_at.cfg", configure, allowAst) fun lang( path: String, @Language("MCLang") code: String, configure: Boolean = true, - allowAst: Boolean = false + allowAst: Boolean = false, ) = file(path, code, ".lang", configure, allowAst) fun nbtt( path: String, @Language("NBTT") code: String, configure: Boolean = true, - allowAst: Boolean = false + allowAst: Boolean = false, ) = file(path, code, ".nbtt", configure, allowAst) inline fun dir(path: String, block: ProjectBuilder.() -> Unit) { Index: src/test/kotlin/framework/test-util.kt =================================================================== --- src/test/kotlin/framework/test-util.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/test/kotlin/framework/test-util.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -55,7 +55,7 @@ it.children it.refresh(false, false) true - } + }, ) } return fsRoot Index: src/test/kotlin/nbt/NbtParseTest.kt =================================================================== --- src/test/kotlin/nbt/NbtParseTest.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/test/kotlin/nbt/NbtParseTest.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -90,22 +90,22 @@ listOf( TagCompound( mapOf( - "key" to TagString("value") - ) + "key" to TagString("value"), - ), + ), + ), TagCompound( mapOf( - "key" to TagString("value") + "key" to TagString("value"), + ), + ), + ), + ), + ), + ), + ), + ), + ), + ), + ), - ) + ) - ) - ) - ) - ) - ) - ) - ) - ) - ) - ) - ) } Index: src/test/kotlin/platform/forge/ModsTomlCompletionTest.kt =================================================================== --- src/test/kotlin/platform/forge/ModsTomlCompletionTest.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/test/kotlin/platform/forge/ModsTomlCompletionTest.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -42,7 +42,7 @@ "loaderVersion", "license", "showAsResourcePack", - "issueTrackerURL" + "issueTrackerURL", ) } @@ -61,7 +61,7 @@ "credits", "authors", "displayTest", - "description" + "description", ) } @@ -74,7 +74,7 @@ "mandatory", "versionRange", "ordering", - "side" + "side", ) } @@ -98,7 +98,7 @@ "MATCH_VERSION", "IGNORE_SERVER_VERSION", "IGNORE_ALL_VERSION", - "NONE" + "NONE", ) } @@ -119,7 +119,7 @@ fun stringCompletionFromNothing() { myFixture.testCompletion( "stringCompletionFromNothing/mods.toml", - "stringCompletionFromNothing/mods.toml.after" + "stringCompletionFromNothing/mods.toml.after", ) } @@ -128,7 +128,7 @@ fun stringCompletion() { myFixture.testCompletion( "stringCompletion/mods.toml", - "stringCompletion/mods.toml.after" + "stringCompletion/mods.toml.after", ) } } Index: src/test/kotlin/platform/forge/ModsTomlValidationInspectionTest.kt =================================================================== --- src/test/kotlin/platform/forge/ModsTomlValidationInspectionTest.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/test/kotlin/platform/forge/ModsTomlValidationInspectionTest.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -44,7 +44,7 @@ """ [[mods]] modId="invalid id" - """ + """, ) } @@ -63,7 +63,7 @@ modId="forge" versionRange=35 mandatory=true - """ + """, ) } @@ -82,7 +82,7 @@ modId="minecraft" ordering="NONE" side="UP" - """ + """, ) } @@ -96,7 +96,7 @@ [[mods]] modId="examplemod2" [[dependencies.examplemod3]] - """ + """, ) } } Index: src/test/kotlin/platform/mcp/at/AtCommenterTest.kt =================================================================== --- src/test/kotlin/platform/mcp/at/AtCommenterTest.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/test/kotlin/platform/mcp/at/AtCommenterTest.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -24,7 +24,7 @@ private fun doTest( @Language("Access Transformers") before: String, - @Language("Access Transformers") after: String + @Language("Access Transformers") after: String, ) { doTest(before, after, "_at.cfg", ProjectBuilder::at) } @@ -39,7 +39,7 @@ """ #public net.minecraft.entity.Entity field_190534_ay # fire public net.minecraft.entity.Entity field_70152_a # nextEntityID - """ + """, ) @Test @@ -54,7 +54,7 @@ #public net.minecraft.command.CommandHandler func_71559_a([Ljava/lang/String;)[Ljava/lang/String; # dropFirstString #public net.minecraft.command.CommandHandler func_82370_a(Lnet/minecraft/command/ICommand;[Ljava/lang/String;)I # getUsernameIndex public net.minecraft.command.EntitySelector func_82381_h(Ljava/lang/String;)Ljava/util/Map; # getArgumentMap - """ + """, ) @Test @@ -71,7 +71,7 @@ #public net.minecraft.entity.Entity func_190531_bD()I #public net.minecraft.entity.EntityHanging func_174859_a(Lnet/minecraft/util/EnumFacing;)V # updateFacingWithBoundingBox #public net.minecraft.entity.EntityList field_180126_g # stringToIDMapping - """ + """, ) @Test @@ -86,7 +86,7 @@ public net.minecraft.entity.EntityLivingBase field_70752_e # potionsNeedUpdate public net.minecraft.entity.EntityLivingBase field_70755_b # entityLivingToAttack public net.minecraft.entity.EntityLivingBase func_184583_d(Lnet/minecraft/util/DamageSource;)Z # canBlockDamageSource - """ + """, ) @Test @@ -105,6 +105,6 @@ #public net.minecraft.entity.EntityLivingBase field_184633_f # POTION_EFFECTS ##public net.minecraft.entity.EntityLivingBase field_184634_g # HIDE_PARTICLES ##public net.minecraft.entity.EntityLivingBase field_184635_h # ARROW_COUNT_IN_ENTITY - """ + """, ) } Index: src/test/kotlin/platform/mixin/AccessorMixinTest.kt =================================================================== --- src/test/kotlin/platform/mixin/AccessorMixinTest.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/test/kotlin/platform/mixin/AccessorMixinTest.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -55,7 +55,7 @@ @Invoker void invoke(); @Invoker double doThing(); } - """ + """, ) { psiClass -> Assertions.assertTrue(psiClass.isAccessorMixin) } @@ -79,7 +79,7 @@ @Invoker void invoke(); double doThing(); } - """ + """, ) { psiClass -> Assertions.assertFalse(psiClass.isAccessorMixin) } @@ -103,7 +103,7 @@ @Invoker void invoke(); @Invoker double doThing(); } - """ + """, ) { psiClass -> Assertions.assertFalse(psiClass.isAccessorMixin) } @@ -124,7 +124,7 @@ @Accessor String getString(); @Accessor int getInt(); } - """ + """, ) { psiClass -> Assertions.assertTrue(psiClass.isAccessorMixin) } @@ -145,7 +145,7 @@ @Invoker void invoke(); @Invoker double doThing(); } - """ + """, ) { psiClass -> Assertions.assertTrue(psiClass.isAccessorMixin) } @@ -167,7 +167,7 @@ @Accessor String getString(); @Invoker void invoke(); } - """ + """, ) { psiClass -> Assertions.assertFalse(psiClass.isAccessorMixin) } @@ -189,7 +189,7 @@ @Accessor String getString(); @Invoker void invoke(); } - """ + """, ) { psiClass -> Assertions.assertFalse(psiClass.isAccessorMixin) } @@ -218,7 +218,7 @@ @Invoker String callPrivateMethod(); @Invoker static MixinBase createMixinBase() { return null; } } - """ + """, ) { fixture.enableInspections(MixinAnnotationTargetInspection::class.java) fixture.checkHighlighting(false, false, false) @@ -243,7 +243,7 @@ @Invoker("privateMethod") String foo3(); @Invoker("") MixinBase foo4(); } - """ + """, ) { fixture.enableInspections(MixinAnnotationTargetInspection::class.java) fixture.checkHighlighting(false, false, false) @@ -264,7 +264,7 @@ public interface AccessorMixinTargetMixin { @Accessor String getFoo(); } - """ + """, ) { fixture.enableInspections(MixinAnnotationTargetInspection::class.java) fixture.checkHighlighting(false, false, false) @@ -285,7 +285,7 @@ public interface AccessorMixinTargetMixin { @Accessor("foo") String bar(); } - """ + """, ) { fixture.enableInspections(MixinAnnotationTargetInspection::class.java) fixture.checkHighlighting(false, false, false) @@ -306,7 +306,7 @@ public interface AccessorMixinTargetMixin { @Invoker String callFoo(); } - """ + """, ) { fixture.enableInspections(MixinAnnotationTargetInspection::class.java) fixture.checkHighlighting(false, false, false) @@ -327,7 +327,7 @@ public interface AccessorMixinTargetMixin { @Invoker("foo") String bar(); } - """ + """, ) { fixture.enableInspections(MixinAnnotationTargetInspection::class.java) fixture.checkHighlighting(false, false, false) @@ -348,7 +348,7 @@ public interface AccessorMixinTargetMixin { @Invoker("") String construct(String invalidArg); } - """ + """, ) { fixture.enableInspections(MixinAnnotationTargetInspection::class.java) fixture.checkHighlighting(false, false, false) Index: src/test/kotlin/platform/mixin/AmbiguousReferenceInspectionTest.kt =================================================================== --- src/test/kotlin/platform/mixin/AmbiguousReferenceInspectionTest.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/test/kotlin/platform/mixin/AmbiguousReferenceInspectionTest.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -51,7 +51,7 @@ public void onMethod() { } } - """ + """, ) } @@ -74,7 +74,7 @@ public void onMethod() { } } - """ + """, ) } @@ -97,7 +97,7 @@ public void onMethod() { } } - """ + """, ) } @@ -120,7 +120,7 @@ public void onMethod() { } } - """ + """, ) } @@ -143,7 +143,7 @@ public void onMethod() { } } - """ + """, ) } } Index: src/test/kotlin/platform/mixin/BaseMixinTest.kt =================================================================== --- src/test/kotlin/platform/mixin/BaseMixinTest.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/test/kotlin/platform/mixin/BaseMixinTest.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -47,7 +47,7 @@ for (l in listOfNotNull(mixinLibrary, testDataLibrary)) { ModuleRootModificationUtil.updateModel(module) { model -> model.removeOrderEntry( - model.findLibraryOrderEntry(l) ?: throw IllegalStateException("Library not found") + model.findLibraryOrderEntry(l) ?: throw IllegalStateException("Library not found"), ) } Index: src/test/kotlin/platform/mixin/InnerClassTest.kt =================================================================== --- src/test/kotlin/platform/mixin/InnerClassTest.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/test/kotlin/platform/mixin/InnerClassTest.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -67,7 +67,7 @@ } } - """ + """, ) } } Index: src/test/kotlin/platform/mixin/InvalidInjectorMethodSignatureInspectionTest.kt =================================================================== --- src/test/kotlin/platform/mixin/InvalidInjectorMethodSignatureInspectionTest.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/test/kotlin/platform/mixin/InvalidInjectorMethodSignatureInspectionTest.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -55,7 +55,7 @@ private void redirectMethod2() { } } - """ + """, ) } @@ -91,7 +91,7 @@ private void injectCtor(String string, CallbackInfo ci) { } } - """ + """, ) } @@ -127,7 +127,7 @@ private void injectCtor(String string, CallbackInfo ci) { } } - """ + """, ) } } Index: src/test/kotlin/platform/mixin/MultipleTargetTest.kt =================================================================== --- src/test/kotlin/platform/mixin/MultipleTargetTest.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/test/kotlin/platform/mixin/MultipleTargetTest.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -55,7 +55,7 @@ public void onMethod() { } } - """ + """, ) } @@ -78,7 +78,7 @@ public void onMethod() { } } - """ + """, ) } } Index: src/test/kotlin/platform/mixin/SuperClassTest.kt =================================================================== --- src/test/kotlin/platform/mixin/SuperClassTest.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/test/kotlin/platform/mixin/SuperClassTest.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -23,7 +23,7 @@ private fun doTest( @Language("JAVA") - mixinCode: String + mixinCode: String, ) { buildProject { dir("test") { @@ -49,7 +49,7 @@ public class SuperClassMixin { } - """ + """, ) } @@ -68,7 +68,7 @@ public class SuperClassMixin extends Entity { } - """ + """, ) } @@ -86,7 +86,7 @@ public class SuperClassMixin extends DemonWav { } - """ + """, ) } @@ -105,7 +105,7 @@ public class SuperClassMixin extends Minecrell { } - """ + """, ) } } Index: src/test/kotlin/platform/mixin/UnnecessaryQualifiedMemberReferenceInspectionTest.kt =================================================================== --- src/test/kotlin/platform/mixin/UnnecessaryQualifiedMemberReferenceInspectionTest.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/test/kotlin/platform/mixin/UnnecessaryQualifiedMemberReferenceInspectionTest.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -51,7 +51,7 @@ public void onMethod() { } } - """ + """, ) } @@ -74,7 +74,7 @@ public void onMethod() { } } - """ + """, ) } @@ -97,7 +97,7 @@ public void onMethod() { } } - """ + """, ) } @@ -120,7 +120,7 @@ public void onMethod() { } } - """ + """, ) } } Index: src/test/kotlin/platform/mixin/implements/DuplicateInterfaceInspectionTest.kt =================================================================== --- src/test/kotlin/platform/mixin/implements/DuplicateInterfaceInspectionTest.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/test/kotlin/platform/mixin/implements/DuplicateInterfaceInspectionTest.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -36,7 +36,7 @@ } """, - configure = false + configure = false, ) java( @@ -48,7 +48,7 @@ } """, - configure = false + configure = false, ) } } @@ -84,7 +84,7 @@ class DuplicateInterfaceMixin { } - """ + """, ) } @@ -107,7 +107,7 @@ class DuplicateInterfaceMixin { } - """ + """, ) } } Index: src/test/kotlin/platform/mixin/implements/DuplicateInterfacePrefixInspectionTest.kt =================================================================== --- src/test/kotlin/platform/mixin/implements/DuplicateInterfacePrefixInspectionTest.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/test/kotlin/platform/mixin/implements/DuplicateInterfacePrefixInspectionTest.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -36,7 +36,7 @@ } """, - configure = false + configure = false, ) java( @@ -48,7 +48,7 @@ } """, - configure = false + configure = false, ) } } @@ -84,7 +84,7 @@ class DuplicateInterfacePrefixMixin { } - """ + """, ) } @@ -107,7 +107,7 @@ class DuplicateInterfacePrefixMixin { } - """ + """, ) } } Index: src/test/kotlin/platform/mixin/implements/EmptyImplementsTest.kt =================================================================== --- src/test/kotlin/platform/mixin/implements/EmptyImplementsTest.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/test/kotlin/platform/mixin/implements/EmptyImplementsTest.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -36,7 +36,7 @@ } """, - configure = false + configure = false, ) } } @@ -69,7 +69,7 @@ class EmptyImplementsMixin { } - """ + """, ) } @@ -89,7 +89,7 @@ class EmptyImplementsMixin { } - """ + """, ) } @@ -112,7 +112,7 @@ class EmptyImplementsMixin { } - """ + """, ) } } Index: src/test/kotlin/platform/mixin/implements/InterfaceIsInterfaceTest.kt =================================================================== --- src/test/kotlin/platform/mixin/implements/InterfaceIsInterfaceTest.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/test/kotlin/platform/mixin/implements/InterfaceIsInterfaceTest.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -35,7 +35,7 @@ } """, - configure = false + configure = false, ) java( @@ -47,7 +47,7 @@ } """, - configure = false + configure = false, ) java( @@ -67,7 +67,7 @@ class InterfaceIsInterfaceMixin { } - """ + """, ) } } Index: src/test/kotlin/platform/mixin/implements/InterfacePrefixTest.kt =================================================================== --- src/test/kotlin/platform/mixin/implements/InterfacePrefixTest.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/test/kotlin/platform/mixin/implements/InterfacePrefixTest.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -35,7 +35,7 @@ } """, - configure = false + configure = false, ) java( @@ -55,7 +55,7 @@ class InterfacePrefixMixin { } - """ + """, ) } } Index: src/test/kotlin/platform/mixin/implements/SoftImplementTest.kt =================================================================== --- src/test/kotlin/platform/mixin/implements/SoftImplementTest.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/test/kotlin/platform/mixin/implements/SoftImplementTest.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -37,7 +37,7 @@ } """, - configure = false + configure = false, ) java( @@ -62,7 +62,7 @@ } } - """ + """, ) } } Index: src/test/kotlin/platform/mixin/shadow/ShadowModifiersInspectionTest.kt =================================================================== --- src/test/kotlin/platform/mixin/shadow/ShadowModifiersInspectionTest.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/test/kotlin/platform/mixin/shadow/ShadowModifiersInspectionTest.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -56,7 +56,7 @@ @Shadow protected String twoIssues; } - """ + """, ) } Index: src/test/kotlin/platform/mixin/shadow/ShadowTargetInspectionTest.kt =================================================================== --- src/test/kotlin/platform/mixin/shadow/ShadowTargetInspectionTest.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/test/kotlin/platform/mixin/shadow/ShadowTargetInspectionTest.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -56,7 +56,7 @@ @Shadow protected String twoIssues; } - """ + """, ) } Index: src/test/kotlin/platform/sponge/BaseSpongeTest.kt =================================================================== --- src/test/kotlin/platform/sponge/BaseSpongeTest.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/test/kotlin/platform/sponge/BaseSpongeTest.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -45,7 +45,7 @@ library?.let { l -> ModuleRootModificationUtil.updateModel(module) { model -> model.removeOrderEntry( - model.findLibraryOrderEntry(l) ?: throw IllegalStateException("Library not found") + model.findLibraryOrderEntry(l) ?: throw IllegalStateException("Library not found"), ) } Index: src/test/kotlin/platform/sponge/PluginClassInspectionTest.kt =================================================================== --- src/test/kotlin/platform/sponge/PluginClassInspectionTest.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/test/kotlin/platform/sponge/PluginClassInspectionTest.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -46,7 +46,7 @@ ASpongePlugin() { } } - """ + """, ) } @@ -62,7 +62,7 @@ @Plugin(id = "a-plugin") public class ASpongePlugin { } - """ + """, ) } @@ -80,7 +80,7 @@ private ASpongePlugin() { } } - """ + """, ) } @@ -104,7 +104,7 @@ private ASpongePlugin(Logger logger) { } } - """ + """, ) } @@ -125,7 +125,7 @@ private ASpongePlugin(Logger logger) { } } - """ + """, ) } } Index: src/test/kotlin/platform/sponge/SpongeInjectionInspectionTest.kt =================================================================== --- src/test/kotlin/platform/sponge/SpongeInjectionInspectionTest.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/test/kotlin/platform/sponge/SpongeInjectionInspectionTest.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -48,7 +48,7 @@ @Inject private int number; } - """ + """, ) } @@ -67,7 +67,7 @@ @Inject private String string; } - """ + """, ) } @@ -90,7 +90,7 @@ this.string = string; } } - """ + """, ) } @@ -114,7 +114,7 @@ this.logger = logger; } } - """ + """, ) } @@ -137,7 +137,7 @@ this.string = string; } } - """ + """, ) } @@ -157,7 +157,7 @@ @Inject private Asset asset; } - """ + """, ) } @@ -179,7 +179,7 @@ @AssetId("absent_asset") private Asset asset; } - """ + """, ) } @@ -202,7 +202,7 @@ private Asset asset; } """, - "assets/a-plugin/dir/an_asset.txt" + "assets/a-plugin/dir/an_asset.txt", ) } @@ -227,7 +227,7 @@ @DefaultConfig(sharedRoot = false) private File file; } - """ + """, ) } @@ -248,7 +248,7 @@ @Inject private File file; } - """ + """, ) } @@ -270,7 +270,7 @@ @DefaultConfig(sharedRoot = false) private Logger logger; } - """ + """, ) } @@ -295,7 +295,7 @@ @ConfigDir(sharedRoot = false) private ConfigurationLoader configurationLoader; } - """ + """, ) } @@ -317,7 +317,7 @@ @Inject private ConfigurationLoader configurationLoader; } - """ + """, ) } @@ -340,7 +340,7 @@ @DefaultConfig(sharedRoot = false) private ConfigurationLoader<ConfigurationNode> configurationLoader; } - """ + """, ) } } Index: src/test/kotlin/translations/LangCommenterTest.kt =================================================================== --- src/test/kotlin/translations/LangCommenterTest.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/test/kotlin/translations/LangCommenterTest.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -35,7 +35,7 @@ """ #test.key1=value1 test.key2=value2 - """ + """, ) @Test @@ -52,7 +52,7 @@ #test.key2=value2 #test.key3=value3 test.key4=value4 - """ + """, ) @Test @@ -69,7 +69,7 @@ test.key2=value2 test.key3=value3 #test.key4=value4 - """ + """, ) @Test @@ -86,6 +86,6 @@ test.key2=value2 #test.key3=value3 test.key4=value4 - """ + """, ) } Index: src/test/kotlin/util/McPsiClassTest.kt =================================================================== --- src/test/kotlin/util/McPsiClassTest.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/test/kotlin/util/McPsiClassTest.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -64,7 +64,7 @@ fun innerAnonymousInnerFullQualifiedNameTest() = Assertions.assertEquals( "com.example.test.OuterClass\$InnerClass$1\$AnonymousInnerClass", - innerAnonymousInnerClass.fullQualifiedName + innerAnonymousInnerClass.fullQualifiedName, ) @Test @@ -97,16 +97,16 @@ assertEquivalent( innerAnonymousClass, findQualifiedClass( - "com.example.test.OuterClass\$InnerClass$1" + "com.example.test.OuterClass\$InnerClass$1", + ), - ) + ) - ) @Test @DisplayName("findQualifiedClass Of Inner Anonymous Inner Class Test") fun innerAnonymousInnerFindTest() = assertEquivalent( innerAnonymousInnerClass, - findQualifiedClass("com.example.test.OuterClass\$InnerClass$1\$AnonymousInnerClass") + findQualifiedClass("com.example.test.OuterClass\$InnerClass$1\$AnonymousInnerClass"), ) @Test @@ -114,7 +114,7 @@ fun selfReferencingGenericFullQualifiedNameTest() = Assertions.assertEquals( "com.example.test.OuterClass\$SelfReferencingGeneric", - selfReferencingGeneric.fullQualifiedName + selfReferencingGeneric.fullQualifiedName, ) @Test Index: src/test/kotlin/util/OuterClassTest.kt =================================================================== --- src/test/kotlin/util/OuterClassTest.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/test/kotlin/util/OuterClassTest.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -54,7 +54,7 @@ public C doSomething() {} } } - """ + """, ).toPsiFile().classes.single() } Index: src/test/kotlin/util/PsiBytecodeUtilTest.kt =================================================================== --- src/test/kotlin/util/PsiBytecodeUtilTest.kt (revision 83949ccec33f5900f9afa7453acfd67b84f16454) +++ src/test/kotlin/util/PsiBytecodeUtilTest.kt (revision c9139e6a56d8e423957c79a6c0558eda10be5529) @@ -44,6 +44,6 @@ fun innerAnonymousInnerInternalNameTest() = Assertions.assertEquals( "com/example/test/OuterClass\$InnerClass$1\$AnonymousInnerClass", - innerAnonymousInnerClass.internalName + innerAnonymousInnerClass.internalName, ) }