Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change static field in mixin error requirements from public to non-private #2289

Merged
merged 1 commit into from
Apr 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import com.intellij.psi.PsiModifier
class StaticMemberInspection : MixinInspection() {

override fun getStaticDescription() =
"A mixin class does not exist at runtime, and thus having them public does not make sense. " +
"A mixin class does not exist at runtime, and thus having them not private does not make sense. " +
"Make the field/method private instead."

override fun buildVisitor(holder: ProblemsHolder): PsiElementVisitor = Visitor(holder)
Expand All @@ -56,7 +56,7 @@ class StaticMemberInspection : MixinInspection() {
if (isProblematic(member)) {
holder.registerProblem(
member,
"Public static members are not allowed in Mixin classes",
"Non-private static members are not allowed in Mixin classes",
QuickFixFactory.getInstance().createModifierListFix(member, PsiModifier.PRIVATE, true, false),
)
}
Expand All @@ -70,7 +70,7 @@ class StaticMemberInspection : MixinInspection() {

val modifiers = member.modifierList!!

return modifiers.hasModifierProperty(PsiModifier.PUBLIC) &&
return !modifiers.hasModifierProperty(PsiModifier.PRIVATE) &&
modifiers.hasModifierProperty(PsiModifier.STATIC) &&
modifiers.findAnnotation(SHADOW) == null &&
modifiers.findAnnotation(OVERWRITE) == null &&
Expand Down
Loading