mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
disable fixes when target types depend on unresolved type params (IDEA-185967)
This commit is contained in:
+1
@@ -59,6 +59,7 @@ public class AddTypeCastFix extends LocalQuickFixAndIntentionActionOnPsiElement
|
||||
@NotNull PsiElement endElement) {
|
||||
return myType.isValid() &&
|
||||
PsiTypesUtil.isDenotableType(myType) &&
|
||||
PsiTypesUtil.allTypeParametersResolved(startElement, myType) &&
|
||||
startElement.getManager().isInProject(startElement);
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -21,6 +21,7 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.util.PsiTypesUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
@@ -43,7 +44,7 @@ public abstract class MethodArgumentFix implements IntentionAction {
|
||||
|
||||
@Override
|
||||
public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) {
|
||||
if (myToType != null && myToType.isValid()) {
|
||||
if (myToType != null && myToType.isValid() && PsiTypesUtil.allTypeParametersResolved(myArgList, myToType)) {
|
||||
PsiExpression[] args = myArgList.getExpressions();
|
||||
return args.length > myIndex && args[myIndex] != null && args[myIndex].isValid();
|
||||
}
|
||||
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// "Cast parameter to 'M'" "false"
|
||||
class a {
|
||||
void doSomething(String[] data) {}
|
||||
void test() {
|
||||
doSomething(Li<caret>st.of(""));
|
||||
}
|
||||
|
||||
interface List<L> {
|
||||
static <M> List<M> of(M... ms) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user