From f0be6da9d80a99bb1335f040fd4e8277bd46dda5 Mon Sep 17 00:00:00 2001 From: 7410 <85879080+O7410@users.noreply.github.com> Date: Wed, 8 Jan 2025 19:04:06 +0200 Subject: [PATCH] Move non-private static error to the access modifier (when there is one) --- .../platform/mixin/inspection/StaticMemberInspection.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/platform/mixin/inspection/StaticMemberInspection.kt b/src/main/kotlin/platform/mixin/inspection/StaticMemberInspection.kt index a186ed198..985b916c4 100644 --- a/src/main/kotlin/platform/mixin/inspection/StaticMemberInspection.kt +++ b/src/main/kotlin/platform/mixin/inspection/StaticMemberInspection.kt @@ -25,6 +25,7 @@ import com.demonwav.mcdev.platform.mixin.util.MixinConstants.Annotations.INVOKER import com.demonwav.mcdev.platform.mixin.util.MixinConstants.Annotations.OVERWRITE import com.demonwav.mcdev.platform.mixin.util.MixinConstants.Annotations.SHADOW import com.demonwav.mcdev.platform.mixin.util.isMixin +import com.demonwav.mcdev.util.findKeyword import com.intellij.codeInsight.intention.QuickFixFactory import com.intellij.codeInspection.ProblemsHolder import com.intellij.psi.JavaElementVisitor @@ -33,6 +34,7 @@ import com.intellij.psi.PsiField import com.intellij.psi.PsiMember import com.intellij.psi.PsiMethod import com.intellij.psi.PsiModifier +import org.jetbrains.kotlin.j2k.accessModifier class StaticMemberInspection : MixinInspection() { @@ -55,7 +57,7 @@ class StaticMemberInspection : MixinInspection() { private fun visitMember(member: PsiMember) { if (isProblematic(member)) { holder.registerProblem( - member, + member.modifierList?.findKeyword(member.accessModifier()) ?: member, "Non-private static members are not allowed in Mixin classes", QuickFixFactory.getInstance().createModifierListFix(member, PsiModifier.PRIVATE, true, false), )