User: kyle wood Date: 01 Mar 23 06:20 Revision: 6ca53333e8fe6494dc723942d7422b66ae6972d4 Summary: Merge branch '2022.2' into 2022.3 TeamCity URL: https://ci.mcdev.io/viewModification.html?tab=vcsModificationFiles&modId=8336&personal=false Index: build.gradle.kts =================================================================== --- build.gradle.kts (revision 04a30eaa23ac7bac91d1a874b5e9eeb0c09aa619) +++ build.gradle.kts (revision 6ca53333e8fe6494dc723942d7422b66ae6972d4) @@ -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" } @@ -272,7 +274,7 @@ fileTree(project.projectDir) { include("*.gradle.kts", "gradle.properties") exclude("**/buildSrc/**", "**/build/**") - } + }, ) } register("buildSrc") { @@ -280,7 +282,7 @@ project.fileTree(project.projectDir.resolve("buildSrc")) { include("**/*.kt", "**/*.kts") exclude("**/build/**") - } + }, ) } register("grammars") { @@ -289,6 +291,9 @@ } } +ktlint { + disabledRules.add("filename") +} tasks.withType().configureEach { workerMaxHeapSize.set("512m") } @@ -296,9 +301,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") @@ -328,7 +331,7 @@ generateNbttParser, generateLangLexer, generateLangParser, - generateTranslationTemplateLexer + generateTranslationTemplateLexer, ) } @@ -370,7 +373,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: gradle.properties =================================================================== --- gradle.properties (revision 04a30eaa23ac7bac91d1a874b5e9eeb0c09aa619) +++ gradle.properties (revision 6ca53333e8fe6494dc723942d7422b66ae6972d4) @@ -14,7 +14,7 @@ ideaVersion = 2022.3 ideaVersionName = 2022.3 -coreVersion = 1.5.22 +coreVersion = 1.6.0 downloadIdeaSources = true pluginTomlVersion = 223.7571.59 Index: src/main/kotlin/errorreporter/AnonymousFeedback.kt =================================================================== --- src/main/kotlin/errorreporter/AnonymousFeedback.kt (revision 04a30eaa23ac7bac91d1a874b5e9eeb0c09aa619) +++ src/main/kotlin/errorreporter/AnonymousFeedback.kt (revision 6ca53333e8fe6494dc723942d7422b66ae6972d4) @@ -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/inspection/WrongEntityDataParameterClassInspection.kt =================================================================== --- src/main/kotlin/inspection/WrongEntityDataParameterClassInspection.kt (revision 04a30eaa23ac7bac91d1a874b5e9eeb0c09aa619) +++ src/main/kotlin/inspection/WrongEntityDataParameterClassInspection.kt (revision 6ca53333e8fe6494dc723942d7422b66ae6972d4) @@ -57,7 +57,7 @@ holder.registerProblem( expression, "Entity class does not match this entity class", - QuickFix(firstParameter) + QuickFix(firstParameter), ) } } @@ -74,9 +74,9 @@ firstParameter.replace( factory.createExpressionFromText( "${containingClass.name}.class", - firstParameter + firstParameter, + ), - ) + ) - ) } override fun getFamilyName() = name @@ -90,12 +90,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/platform/architectury/creator/ui-steps.kt =================================================================== --- src/main/kotlin/platform/architectury/creator/ui-steps.kt (revision 04a30eaa23ac7bac91d1a874b5e9eeb0c09aa619) +++ src/main/kotlin/platform/architectury/creator/ui-steps.kt (revision 6ca53333e8fe6494dc723942d7422b66ae6972d4) @@ -85,7 +85,7 @@ class ArchitecturyVersionChainStep( parent: NewProjectWizardStep, - private val versionData: ArchitecturyVersionData + private val versionData: ArchitecturyVersionData, ) : AbstractMcVersionChainStep( parent, "Forge Version:", @@ -117,7 +117,7 @@ .intersect( versionData.fabricVersions.game.mapNotNullTo(mutableSetOf()) { SemanticVersion.tryParse(it.version) - } + }, ) .toList() } @@ -144,7 +144,7 @@ } else { "Unable to match API versions to Minecraft version" } - } + }, ).bindEnabled(useFabricApiProperty).component.foreground = JBColor.YELLOW comboBox } Index: src/main/kotlin/platform/fabric/creator/ui-steps.kt =================================================================== --- src/main/kotlin/platform/fabric/creator/ui-steps.kt (revision 04a30eaa23ac7bac91d1a874b5e9eeb0c09aa619) +++ src/main/kotlin/platform/fabric/creator/ui-steps.kt (revision 6ca53333e8fe6494dc723942d7422b66ae6972d4) @@ -49,7 +49,7 @@ import kotlinx.coroutines.coroutineScope class FabricPlatformStep( - parent: ModPlatformStep + parent: ModPlatformStep, ) : AbstractLatentStep>(parent) { override val description = "download Fabric versions" @@ -85,7 +85,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 @@ -134,7 +134,7 @@ } else { "Unable to match Yarn versions to Minecraft version" } - } + }, ).component.foreground = JBColor.YELLOW comboBox } @@ -150,7 +150,7 @@ } else { "Unable to match API versions to Minecraft version" } - } + }, ).bindEnabled(useApiProperty).component.foreground = JBColor.YELLOW comboBox } @@ -234,7 +234,7 @@ "Server" -> Side.SERVER else -> Side.NONE } - }) + },), ) } } @@ -255,6 +255,6 @@ override fun createStep() = DescriptionStep(this).chain( ::AuthorsStep, ::WebsiteStep, - ::RepositoryStep + ::RepositoryStep, ) } Index: src/main/kotlin/platform/forge/inspections/sideonly/VariableUseSideOnlyInspection.kt =================================================================== --- src/main/kotlin/platform/forge/inspections/sideonly/VariableUseSideOnlyInspection.kt (revision 04a30eaa23ac7bac91d1a874b5e9eeb0c09aa619) +++ src/main/kotlin/platform/forge/inspections/sideonly/VariableUseSideOnlyInspection.kt (revision 6ca53333e8fe6494dc723942d7422b66ae6972d4) @@ -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/mixin/inspection/UnusedMixinInspection.kt =================================================================== --- src/main/kotlin/platform/mixin/inspection/UnusedMixinInspection.kt (revision 04a30eaa23ac7bac91d1a874b5e9eeb0c09aa619) +++ src/main/kotlin/platform/mixin/inspection/UnusedMixinInspection.kt (revision 6ca53333e8fe6494dc723942d7422b66ae6972d4) @@ -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/util/AsmUtil.kt =================================================================== --- src/main/kotlin/platform/mixin/util/AsmUtil.kt (revision 04a30eaa23ac7bac91d1a874b5e9eeb0c09aa619) +++ src/main/kotlin/platform/mixin/util/AsmUtil.kt (revision 6ca53333e8fe6494dc723942d7422b66ae6972d4) @@ -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 04a30eaa23ac7bac91d1a874b5e9eeb0c09aa619) +++ src/main/kotlin/platform/mixin/util/LocalVariables.kt (revision 6ca53333e8fe6494dc723942d7422b66ae6972d4) @@ -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)!! @@ -227,6 +227,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 @@ -246,6 +247,7 @@ } } } + @Suppress("KotlinConstantConditions") // kotlin is wrong if (changed) { instructionQueue.add(nextOffset) } @@ -289,7 +291,7 @@ override fun visitLambdaExpression(expression: PsiLambdaExpression) { // don't recurse into lambdas } - } + }, ) return locals } @@ -319,7 +321,7 @@ type, localIndex, implicitLoadCountBefore = 1, - implicitStoreCountBefore = 1 + implicitStoreCountBefore = 1, ), // length SourceLocalVariable( @@ -327,7 +329,7 @@ PsiType.INT, localIndex + 1, implicitStoreCountBefore = 1, - implicitLoadCountAfter = 1 + implicitLoadCountAfter = 1, ), // index SourceLocalVariable( @@ -336,14 +338,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 +354,9 @@ iteratorType, localIndex, implicitStoreCountBefore = 1, - implicitLoadCountBefore = 1 + implicitLoadCountBefore = 1, + ), - ) + ) - ) } } @@ -362,7 +364,7 @@ module: Module, classNode: ClassNode, method: MethodNode, - node: AbstractInsnNode + node: AbstractInsnNode, ): Array? { return getLocals(module.project, classNode, method, node, detectCurrentSettings(module)) } @@ -372,7 +374,7 @@ classNode: ClassNode, method: MethodNode, nodeArg: AbstractInsnNode, - settings: Settings + settings: Settings, ): Array? { return try { doGetLocals(project, classNode, method, nodeArg, settings) @@ -397,7 +399,7 @@ classNode: ClassNode, method: MethodNode, nodeArg: AbstractInsnNode, - settings: Settings + settings: Settings, ): Array { var node = nodeArg for (i in 0 until 3) { @@ -479,7 +481,7 @@ frameSize, frameData.type, frameData.computeFrameSize(initialFrameSize), - initialFrameSize + initialFrameSize, ) } } else { @@ -488,7 +490,7 @@ frameSize, insn.type, frameNodeSize, - initialFrameSize + initialFrameSize, ) } @@ -498,7 +500,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 +530,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 +554,7 @@ classNode, method, method.instructions.indexOf(insn), - framePos + framePos, ) if (is64bitValue) { framePos++ @@ -561,7 +563,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 +574,7 @@ classNode, method, insn, - framePos + framePos, ) } else { frame[framePos] = ZombieLocalVariable.of(frame[framePos], ZombieLocalVariable.TRIM) @@ -583,7 +585,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 +671,7 @@ classNode: ClassNode, method: MethodNode, pos: AbstractInsnNode, - index: Int + index: Int, ): LocalVariable? { return getLocalVariableAt(project, classNode, method, method.instructions.indexOf(pos), index) } @@ -679,7 +681,7 @@ classNode: ClassNode, method: MethodNode, pos: Int, - index: Int + index: Int, ): LocalVariable? { var localVariableNode: LocalVariable? = null var fallbackNode: LocalVariable? = null @@ -722,7 +724,7 @@ it.signature, instructions.indexOf(it.start), instructions.indexOf(it.end), - it.index + it.index, ) } } @@ -730,7 +732,7 @@ private fun getGeneratedLocalVariableTable( project: Project, classNode: ClassNode, - method: MethodNode + method: MethodNode, ): List { val frames = AsmDfaUtil.analyzeMethod(project, classNode, method) ?: throw LocalAnalysisFailedException() @@ -808,7 +810,7 @@ val trimmedFrameThreshold: Int, val resurrectExposedOnLoad: Boolean, val resurrectExposedOnStore: Boolean, - val resurrectForBogusTop: Boolean + val resurrectForBogusTop: Boolean, ) { companion object { val NO_RESURRECT = Settings( @@ -818,7 +820,7 @@ trimmedFrameThreshold = 0, resurrectExposedOnLoad = false, resurrectExposedOnStore = false, - resurrectForBogusTop = false + resurrectForBogusTop = false, ) val DEFAULT = Settings( @@ -828,7 +830,7 @@ trimmedFrameThreshold = -1, resurrectExposedOnLoad = true, resurrectExposedOnStore = true, - resurrectForBogusTop = true + resurrectForBogusTop = true, ) } } @@ -841,7 +843,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 +852,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 +868,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