Skip to content

Commit

Permalink
Merge pull request #24 from godfather1103/dev
Browse files Browse the repository at this point in the history
feat(issues/23): 支持2023.3
  • Loading branch information
godfather1103 authored Dec 7, 2023
2 parents 9852fbe + 58e2b0a commit df5a1c4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions idea-plugin/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
kotlin_version=1.7.20
idea_version=2023.2
kotlin_version=1.9.20
idea_version=2023.3
plugin_name=Alibaba Java Coding Guidelines(Fix Some Bug)
gradle_jetbrains_version=1.13.3
systemProp.file.encoding=UTF-8
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@ import com.intellij.codeInsight.daemon.impl.analysis.HighlightUtil
import com.intellij.codeInsight.daemon.impl.analysis.JavaHighlightUtil
import com.intellij.codeInsight.daemon.impl.quickfix.AccessStaticViaInstanceFix
import com.intellij.codeInsight.daemon.impl.quickfix.RemoveUnusedVariableUtil
import com.intellij.codeInspection.LocalQuickFix
import com.intellij.codeInspection.ProblemsHolder
import com.intellij.codeInspection.accessStaticViaInstance.AccessStaticViaInstance
import com.intellij.modcommand.ActionContext
import com.intellij.modcommand.Presentation
import com.intellij.psi.*

/**
Expand Down Expand Up @@ -56,19 +59,11 @@ class AliAccessStaticViaInstanceInspection(any: Any?) : AccessStaticViaInstance(

override fun createAccessStaticViaInstanceFix(
expr: PsiReferenceExpression,
onTheFly: Boolean,
result: JavaResolveResult
): AccessStaticViaInstanceFix {
return object : AccessStaticViaInstanceFix(expr, result, onTheFly) {

): LocalQuickFix {
val entity = object : AccessStaticViaInstanceFix(expr, result) {
val fixKey = "com.alibaba.p3c.idea.quickfix.standalone.AliAccessStaticViaInstanceInspection"

val resultText = calcText(result.element as PsiMember, result.substitutor)

override fun getText(): String {
return resultText
}

private fun calcText(member: PsiMember, substitutor: PsiSubstitutor): String {
val aClass = member.containingClass ?: return ""
val p3cConfig = P3cConfig::class.java.getService()
Expand All @@ -86,7 +81,12 @@ class AliAccessStaticViaInstanceInspection(any: Any?) : AccessStaticViaInstance(
)
}
}

override fun getPresentation(context: ActionContext, ref: PsiReferenceExpression): Presentation? {
return Presentation.of(resultText)
}
}
return LocalQuickFix.from(entity)!!
}

override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean): PsiElementVisitor {
Expand Down Expand Up @@ -136,7 +136,7 @@ class AliAccessStaticViaInstanceInspection(any: Any?) : AccessStaticViaInstance(
return
}
}
holder.registerProblem(expr, description, createAccessStaticViaInstanceFix(expr, onTheFly, result))
holder.registerProblem(expr, description, createAccessStaticViaInstanceFix(expr, result))
}

}

0 comments on commit df5a1c4

Please sign in to comment.