Skip to content

Commit

Permalink
support SuppressWarning annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
caikang.ck committed Aug 19, 2020
1 parent 54bbd46 commit 87ba608
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@ import org.jetbrains.annotations.Nls
* @author caikang
* @date 2016/12/16
*/
class AliPmdInspection(private val ruleName: String)
: LocalInspectionTool(),
AliBaseInspection,
PmdRuleInspectionIdentify {
class AliPmdInspection(private val ruleName: String) : LocalInspectionTool(),
AliBaseInspection,
PmdRuleInspectionIdentify {
override fun manualBuildFix(psiElement: PsiElement, isOnTheFly: Boolean): LocalQuickFix? {
return QuickFixes.getQuickFix(ruleName, isOnTheFly)
}
Expand All @@ -62,8 +61,10 @@ class AliPmdInspection(private val ruleName: String)
return true
}

override fun checkFile(file: PsiFile, manager: InspectionManager,
isOnTheFly: Boolean): Array<ProblemDescriptor>? {
override fun checkFile(
file: PsiFile, manager: InspectionManager,
isOnTheFly: Boolean
): Array<ProblemDescriptor>? {
if (!shouldInspectChecker.shouldInspect(file)) {
return null
}
Expand Down Expand Up @@ -96,10 +97,6 @@ class AliPmdInspection(private val ruleName: String)
return true
}

override fun isSuppressedFor(element: PsiElement): Boolean {
return false
}

override fun getShortName(): String {

var shortName = "Alibaba" + ruleName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@ class DelegateLocalInspectionTool : LocalInspectionTool(), AliBaseInspection {
return localInspectionTool.runForWholeFile()
}

override fun checkFile(file: PsiFile, manager: InspectionManager,
isOnTheFly: Boolean): Array<ProblemDescriptor>? {
override fun checkFile(
file: PsiFile, manager: InspectionManager,
isOnTheFly: Boolean
): Array<ProblemDescriptor>? {
return localInspectionTool.checkFile(file, manager, isOnTheFly)
}

Expand Down Expand Up @@ -81,11 +83,13 @@ class DelegateLocalInspectionTool : LocalInspectionTool(), AliBaseInspection {
}

override fun isSuppressedFor(element: PsiElement): Boolean {
return false
return localInspectionTool.isSuppressedFor(element)
}

override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean,
session: LocalInspectionToolSession): PsiElementVisitor {
override fun buildVisitor(
holder: ProblemsHolder, isOnTheFly: Boolean,
session: LocalInspectionToolSession
): PsiElementVisitor {
if (!AliLocalInspectionToolProvider.javaShouldInspectChecker.shouldInspect(holder.file)) {
return PsiElementVisitor.EMPTY_VISITOR
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,6 @@ class DelegatePmdInspection : LocalInspectionTool(), AliBaseInspection, PmdRuleI
}

override fun isSuppressedFor(element: PsiElement): Boolean {
return false
return aliPmdInspection.isSuppressedFor(element)
}
}

0 comments on commit 87ba608

Please sign in to comment.