mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
junit 5: create method from unresolved reference on MethodSource
This commit is contained in:
+9
-1
@@ -18,6 +18,7 @@ package com.intellij.execution.junit.codeInsight
|
||||
import com.intellij.codeInsight.AnnotationUtil
|
||||
import com.intellij.codeInsight.MetaAnnotationUtil
|
||||
import com.intellij.codeInsight.daemon.impl.analysis.JavaGenericsUtil
|
||||
import com.intellij.codeInsight.daemon.impl.quickfix.CreateMethodQuickFix
|
||||
import com.intellij.codeInsight.daemon.impl.quickfix.DeleteElementFix
|
||||
import com.intellij.codeInsight.intention.QuickFixFactory
|
||||
import com.intellij.codeInspection.BaseJavaBatchLocalInspectionTool
|
||||
@@ -128,8 +129,15 @@ class JUnit5MalformedParameterizedInspection : BaseJavaBatchLocalInspectionTool(
|
||||
if (reference is MethodSourceReference) {
|
||||
val resolve = reference.resolve()
|
||||
if (resolve !is PsiMethod) {
|
||||
val containingClass = method.containingClass
|
||||
var createFix : CreateMethodQuickFix? = null
|
||||
if (containingClass != null && holder.isOnTheFly)
|
||||
createFix = CreateMethodQuickFix.createFix(containingClass,
|
||||
"static Object[][] " + reference.value + "()",
|
||||
"return new Object[][] {};")
|
||||
holder.registerProblem(attributeValue,
|
||||
"Cannot resolve target method source: \'" + reference.value + "\'")
|
||||
"Cannot resolve target method source: \'" + reference.value + "\'",
|
||||
createFix)
|
||||
}
|
||||
else {
|
||||
val sourceProvider : PsiMethod = resolve
|
||||
|
||||
Reference in New Issue
Block a user