mirror of
https://github.com/alibaba/p3c.git
synced 2025-10-14 15:10:54 +00:00
support SuppressWarning annotation
This commit is contained in:
@@ -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)
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -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
|
||||
|
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
@@ -78,6 +78,6 @@ class DelegatePmdInspection : LocalInspectionTool(), AliBaseInspection, PmdRuleI
|
||||
}
|
||||
|
||||
override fun isSuppressedFor(element: PsiElement): Boolean {
|
||||
return false
|
||||
return aliPmdInspection.isSuppressedFor(element)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user