mirror of
https://github.com/alibaba/p3c.git
synced 2025-10-14 15:10:54 +00:00
idea-plugin v2.0.1
This commit is contained in:
@@ -26,19 +26,27 @@ artifacts {
|
||||
archives sourcesJar
|
||||
}
|
||||
|
||||
def myPlugins = []
|
||||
|
||||
if (idea_version.startsWith('193.') || idea_version.startsWith('2019.3')) {
|
||||
myPlugins = ['java']
|
||||
}
|
||||
|
||||
|
||||
intellij {
|
||||
version idea_version
|
||||
plugins = myPlugins
|
||||
pluginName plugin_name
|
||||
updateSinceUntilBuild false
|
||||
sandboxDirectory "$project.buildDir/idea-sandbox/$idea_version"
|
||||
}
|
||||
version '2.0.0'
|
||||
version '2.0.1'
|
||||
|
||||
ext.isReleaseVersion = !version.endsWith("SNAPSHOT")
|
||||
|
||||
dependencies {
|
||||
compile group: 'org.freemarker', name: 'freemarker', version: '2.3.25-incubating'
|
||||
compile 'com.alibaba.p3c:p3c-pmd:2.0.0'
|
||||
compile 'com.alibaba.p3c:p3c-pmd:2.0.1'
|
||||
compile group: 'org.javassist', name: 'javassist', version: '3.21.0-GA'
|
||||
}
|
||||
|
||||
|
@@ -33,7 +33,6 @@ import com.intellij.codeInspection.ui.InspectionResultsView
|
||||
import com.intellij.openapi.actionSystem.AnAction
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys
|
||||
import com.intellij.openapi.actionSystem.DataKeys
|
||||
import com.intellij.openapi.components.ServiceManager
|
||||
import com.intellij.openapi.diagnostic.Logger
|
||||
import com.intellij.openapi.module.Module
|
||||
@@ -60,9 +59,9 @@ class AliInspectionAction : AnAction() {
|
||||
val toolWrappers = Inspections.aliInspections(project) {
|
||||
it.tool is AliBaseInspection
|
||||
}
|
||||
val psiElement = e.getData<PsiElement>(DataKeys.PSI_ELEMENT)
|
||||
val psiFile = e.getData<PsiFile>(DataKeys.PSI_FILE)
|
||||
val virtualFile = e.getData<VirtualFile>(DataKeys.VIRTUAL_FILE)
|
||||
val psiElement = e.getData<PsiElement>(CommonDataKeys.PSI_ELEMENT)
|
||||
val psiFile = e.getData<PsiFile>(CommonDataKeys.PSI_FILE)
|
||||
val virtualFile = e.getData<VirtualFile>(CommonDataKeys.VIRTUAL_FILE)
|
||||
val virtualFiles = e.getData<Array<VirtualFile>>(CommonDataKeys.VIRTUAL_FILE_ARRAY)
|
||||
var analysisScope: AnalysisScope? = null
|
||||
var projectDir = false
|
||||
|
@@ -48,7 +48,7 @@ import javax.annotation.Generated
|
||||
*/
|
||||
class AliLocalInspectionToolProvider : InspectionToolProvider {
|
||||
|
||||
override fun getInspectionClasses(): Array<Class<*>> {
|
||||
override fun getInspectionClasses(): Array<Class<out LocalInspectionTool>> {
|
||||
return CLASS_LIST.toTypedArray()
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ class AliLocalInspectionToolProvider : InspectionToolProvider {
|
||||
val ruleInfoMap: MutableMap<String, RuleInfo> = Maps.newHashMap<String, RuleInfo>()
|
||||
private val LOGGER = Logger.getInstance(AliLocalInspectionToolProvider::class.java)
|
||||
val ruleNames: MutableList<String> = Lists.newArrayList<String>()!!
|
||||
private val CLASS_LIST = Lists.newArrayList<Class<*>>()
|
||||
private val CLASS_LIST = Lists.newArrayList<Class<LocalInspectionTool>>()
|
||||
private val nativeInspectionToolClass = arrayListOf<Class<out LocalInspectionTool>>(
|
||||
AliMissingOverrideAnnotationInspection::class.java,
|
||||
AliAccessStaticViaInstanceInspection::class.java,
|
||||
@@ -130,7 +130,7 @@ class AliLocalInspectionToolProvider : InspectionToolProvider {
|
||||
val toolClass = pool.get(LocalInspectionTool::class.java.name)
|
||||
val newField = CtField(toolClass, "forJavassist", cc)
|
||||
cc.addField(newField, CtField.Initializer.byNew(itClass))
|
||||
CLASS_LIST.add(cc.toClass())
|
||||
CLASS_LIST.add(cc.toClass() as Class<LocalInspectionTool>)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ class AliLocalInspectionToolProvider : InspectionToolProvider {
|
||||
val value = "\"" + ruleInfo.rule.name + "\""
|
||||
val newField = CtField.make("private String ruleName = $value;", cc)
|
||||
cc.addField(newField, value)
|
||||
CLASS_LIST.add(cc.toClass())
|
||||
CLASS_LIST.add(cc.toClass() as Class<LocalInspectionTool>)
|
||||
}
|
||||
|
||||
} catch (e: NotFoundException) {
|
||||
|
@@ -46,8 +46,8 @@ import com.intellij.openapi.vfs.VirtualFile
|
||||
import com.intellij.psi.PsiDocumentManager
|
||||
import com.intellij.psi.PsiManager
|
||||
import com.intellij.ui.NonFocusableCheckBox
|
||||
import com.intellij.util.ExceptionUtil
|
||||
import com.intellij.util.PairConsumer
|
||||
import com.intellij.vcsUtil.Rethrow
|
||||
import java.awt.BorderLayout
|
||||
import java.util.ArrayList
|
||||
import java.util.Arrays
|
||||
@@ -190,7 +190,7 @@ class AliCodeAnalysisCheckinHandler(
|
||||
})
|
||||
if (!exception.isNull) {
|
||||
val t = exception.get()
|
||||
Rethrow.reThrowRuntime(t)
|
||||
ExceptionUtil.rethrowAllAsUnchecked(t)
|
||||
}
|
||||
|
||||
return result.get()
|
||||
|
Reference in New Issue
Block a user