User: kyle wood Date: 01 Mar 23 06:24 Revision: 009966e4c2d64c933903e4fc2d4802df7042b99e Summary: Merge branch '2022.3' into 2023.1 TeamCity URL: http://ci.mcdev.io:80/viewModification.html?tab=vcsModificationFiles&modId=8338&personal=false Index: build.gradle.kts =================================================================== --- build.gradle.kts (revision c67a0e85d9aec533290c7ae87927bf0630be0b86) +++ build.gradle.kts (revision 009966e4c2d64c933903e4fc2d4802df7042b99e) @@ -9,11 +9,13 @@ */ import org.cadixdev.gradle.licenser.header.HeaderStyle +import org.cadixdev.gradle.licenser.tasks.LicenseUpdate import org.gradle.internal.jvm.Jvm 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" @@ -21,7 +23,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" } @@ -275,7 +277,7 @@ fileTree(project.projectDir) { include("*.gradle.kts", "gradle.properties") exclude("**/buildSrc/**", "**/build/**") - } + }, ) } register("buildSrc") { @@ -283,7 +285,7 @@ project.fileTree(project.projectDir.resolve("buildSrc")) { include("**/*.kt", "**/*.kts") exclude("**/build/**") - } + }, ) } register("grammars") { @@ -292,6 +294,9 @@ } } +ktlint { + disabledRules.add("filename") +} tasks.withType().configureEach { workerMaxHeapSize.set("512m") } @@ -299,9 +304,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") @@ -331,7 +334,7 @@ generateNbttParser, generateLangLexer, generateLangParser, - generateTranslationTemplateLexer + generateTranslationTemplateLexer, ) } Index: gradle.properties =================================================================== --- gradle.properties (revision c67a0e85d9aec533290c7ae87927bf0630be0b86) +++ gradle.properties (revision 009966e4c2d64c933903e4fc2d4802df7042b99e) @@ -14,7 +14,7 @@ ideaVersion = 231-EAP-SNAPSHOT ideaVersionName = 2023.1 -coreVersion = 1.5.22 +coreVersion = 1.6.0 downloadIdeaSources = true pluginTomlVersion = 231.4840.388 Index: src/main/kotlin/creator/ProjectSetupFinalizerWizardStep.kt =================================================================== --- src/main/kotlin/creator/ProjectSetupFinalizerWizardStep.kt (revision c67a0e85d9aec533290c7ae87927bf0630be0b86) +++ src/main/kotlin/creator/ProjectSetupFinalizerWizardStep.kt (revision 009966e4c2d64c933903e4fc2d4802df7042b99e) @@ -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 @@ -97,7 +98,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/step/AbstractLatentStep.kt =================================================================== --- src/main/kotlin/creator/step/AbstractLatentStep.kt (revision c67a0e85d9aec533290c7ae87927bf0630be0b86) +++ src/main/kotlin/creator/step/AbstractLatentStep.kt (revision 009966e4c2d64c933903e4fc2d4802df7042b99e) @@ -139,7 +139,7 @@ lifetime?.let(Disposer::dispose) lifetime = null } - } + }, ) .validationRequestor(WHEN_GRAPH_PROPAGATION_FINISHED(propertyGraph)) .validation(DialogValidation { ValidationInfo("Haven't finished $description") }) Index: src/main/kotlin/facet/MinecraftFacetDetector.kt =================================================================== --- src/main/kotlin/facet/MinecraftFacetDetector.kt (revision c67a0e85d9aec533290c7ae87927bf0630be0b86) +++ src/main/kotlin/facet/MinecraftFacetDetector.kt (revision 009966e4c2d64c933903e4fc2d4802df7042b99e) @@ -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/platform/mcp/actions/GotoAtEntryAction.kt =================================================================== --- src/main/kotlin/platform/mcp/actions/GotoAtEntryAction.kt (revision c67a0e85d9aec533290c7ae87927bf0630be0b86) +++ src/main/kotlin/platform/mcp/actions/GotoAtEntryAction.kt (revision 009966e4c2d64c933903e4fc2d4802df7042b99e) @@ -89,7 +89,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 c67a0e85d9aec533290c7ae87927bf0630be0b86) +++ src/main/kotlin/platform/mcp/actions/SrgActionBase.kt (revision 009966e4c2d64c933903e4fc2d4802df7042b99e) @@ -85,7 +85,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) return@invokeLater @@ -121,7 +121,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/mixin/handlers/injectionPoint/LoadInjectionPoint.kt =================================================================== --- src/main/kotlin/platform/mixin/handlers/injectionPoint/LoadInjectionPoint.kt (revision c67a0e85d9aec533290c7ae87927bf0630be0b86) +++ src/main/kotlin/platform/mixin/handlers/injectionPoint/LoadInjectionPoint.kt (revision 009966e4c2d64c933903e4fc2d4802df7042b99e) @@ -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) @@ -189,25 +189,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)) { @@ -232,7 +222,7 @@ private fun addLocalUsage( location: PsiElement, name: String, - localsHere: List + localsHere: List, ) { if (info.ordinal != null) { val local = localsHere.asSequence().filter { @@ -279,7 +269,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/util/LocalVariables.kt =================================================================== --- src/main/kotlin/platform/mixin/util/LocalVariables.kt (revision c67a0e85d9aec533290c7ae87927bf0630be0b86) +++ src/main/kotlin/platform/mixin/util/LocalVariables.kt (revision 009966e4c2d64c933903e4fc2d4802df7042b99e) @@ -123,7 +123,7 @@ val controlFlow = ControlFlowFactory.getControlFlow( body, LocalsControlFlowPolicy(body), - ControlFlowOptions.NO_CONST_EVALUATE + ControlFlowOptions.NO_CONST_EVALUATE, ) val allLocalVariables = guessAllLocalVariables(argsIndex, body, controlFlow) @@ -134,7 +134,7 @@ private fun guessAllLocalVariables( argsSize: Int, body: PsiElement, - controlFlow: ControlFlow + controlFlow: ControlFlow, ): Array> { return body.cached(PsiModificationTracker.MODIFICATION_COUNT) { guessAllLocalVariablesUncached(argsSize, body, controlFlow) @@ -144,7 +144,7 @@ private fun guessAllLocalVariablesUncached( argsSize: Int, body: PsiElement, - controlFlow: ControlFlow + controlFlow: ControlFlow, ): Array> { val method = body.parent val allLocalVariables = getAllLocalVariables(body) @@ -157,7 +157,7 @@ true }, variable, - method + method, ) // add on other implicit declarations in scope for (parent in generateSequence(variable.parent, PsiElement::getParent).takeWhile { it != method }) { @@ -186,7 +186,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)!! @@ -228,6 +228,7 @@ val localsHere = this.locals[offset] ?: emptyArray() var changed = false val nextLocals = this.locals[nextOffset] + @Suppress("KotlinConstantConditions") // kotlin is wrong if (nextLocals == null) { this.locals[nextOffset] = localsHere.clone() changed = true @@ -247,6 +248,7 @@ } } } + @Suppress("KotlinConstantConditions") // kotlin is wrong if (changed) { instructionQueue.add(nextOffset) } @@ -290,7 +292,7 @@ override fun visitLambdaExpression(expression: PsiLambdaExpression) { // don't recurse into lambdas } - } + }, ) return locals } @@ -323,7 +325,7 @@ type, localIndex, implicitLoadCountBefore = 1, - implicitStoreCountBefore = 1 + implicitStoreCountBefore = 1, ), // length SourceLocalVariable( @@ -331,7 +333,7 @@ PsiType.INT, localIndex + 1, implicitStoreCountBefore = 1, - implicitLoadCountAfter = 1 + implicitLoadCountAfter = 1, ), // index SourceLocalVariable( @@ -340,14 +342,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 @@ -356,9 +358,9 @@ iteratorType, localIndex, implicitStoreCountBefore = 1, - implicitLoadCountBefore = 1 + implicitLoadCountBefore = 1, + ), - ) + ) - ) } } @@ -366,7 +368,7 @@ module: Module, classNode: ClassNode, method: MethodNode, - node: AbstractInsnNode + node: AbstractInsnNode, ): Array? { return getLocals(module.project, classNode, method, node, detectCurrentSettings(module)) } @@ -376,7 +378,7 @@ classNode: ClassNode, method: MethodNode, nodeArg: AbstractInsnNode, - settings: Settings + settings: Settings, ): Array? { return try { doGetLocals(project, classNode, method, nodeArg, settings) @@ -401,7 +403,7 @@ classNode: ClassNode, method: MethodNode, nodeArg: AbstractInsnNode, - settings: Settings + settings: Settings, ): Array { var node = nodeArg for (i in 0 until 3) { @@ -483,7 +485,7 @@ frameSize, frameData.type, frameData.computeFrameSize(initialFrameSize), - initialFrameSize + initialFrameSize, ) } } else { @@ -492,7 +494,7 @@ frameSize, insn.type, frameNodeSize, - initialFrameSize + initialFrameSize, ) } @@ -502,7 +504,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 (( @@ -532,7 +534,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 @@ -556,7 +558,7 @@ classNode, method, method.instructions.indexOf(insn), - framePos + framePos, ) if (is64bitValue) { framePos++ @@ -565,7 +567,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) { @@ -576,7 +578,7 @@ classNode, method, insn, - framePos + framePos, ) } else { frame[framePos] = ZombieLocalVariable.of(frame[framePos], ZombieLocalVariable.TRIM) @@ -587,7 +589,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++ @@ -673,7 +675,7 @@ classNode: ClassNode, method: MethodNode, pos: AbstractInsnNode, - index: Int + index: Int, ): LocalVariable? { return getLocalVariableAt(project, classNode, method, method.instructions.indexOf(pos), index) } @@ -683,7 +685,7 @@ classNode: ClassNode, method: MethodNode, pos: Int, - index: Int + index: Int, ): LocalVariable? { var localVariableNode: LocalVariable? = null var fallbackNode: LocalVariable? = null @@ -726,7 +728,7 @@ it.signature, instructions.indexOf(it.start), instructions.indexOf(it.end), - it.index + it.index, ) } } @@ -734,7 +736,7 @@ private fun getGeneratedLocalVariableTable( project: Project, classNode: ClassNode, - method: MethodNode + method: MethodNode, ): List { val frames = AsmDfaUtil.analyzeMethod(project, classNode, method) ?: throw LocalAnalysisFailedException() @@ -812,7 +814,7 @@ val trimmedFrameThreshold: Int, val resurrectExposedOnLoad: Boolean, val resurrectExposedOnStore: Boolean, - val resurrectForBogusTop: Boolean + val resurrectForBogusTop: Boolean, ) { companion object { val NO_RESURRECT = Settings( @@ -822,7 +824,7 @@ trimmedFrameThreshold = 0, resurrectExposedOnLoad = false, resurrectExposedOnStore = false, - resurrectForBogusTop = false + resurrectForBogusTop = false, ) val DEFAULT = Settings( @@ -832,7 +834,7 @@ trimmedFrameThreshold = -1, resurrectExposedOnLoad = true, resurrectExposedOnStore = true, - resurrectForBogusTop = true + resurrectForBogusTop = true, ) } } @@ -845,7 +847,7 @@ val implicitLoadCountBefore: Int = 0, val implicitLoadCountAfter: Int = 0, val implicitStoreCountBefore: Int = 0, - val implicitStoreCountAfter: Int = 0 + val implicitStoreCountAfter: Int = 0, ) open class LocalVariable( @@ -854,7 +856,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 @@ -870,14 +872,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