mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-06 05:10:22 +07:00
disable create method from usage/change signature based on void argument (IDEA-205710)
This commit is contained in:
@@ -336,7 +336,7 @@ public class ChangeMethodSignatureFromUsageFix implements IntentionAction/*, Hig
|
||||
else {
|
||||
if (PsiPolyExpressionUtil.isPolyExpression(expression)) return null;
|
||||
PsiType exprType = RefactoringUtil.getTypeByExpression(expression);
|
||||
if (exprType == null) return null;
|
||||
if (exprType == null || PsiType.VOID.equals(exprType)) return null;
|
||||
if (exprType instanceof PsiDisjunctionType) {
|
||||
exprType = ((PsiDisjunctionType)exprType).getLeastUpperBound();
|
||||
}
|
||||
@@ -412,7 +412,7 @@ public class ChangeMethodSignatureFromUsageFix implements IntentionAction/*, Hig
|
||||
if (varargParam != null && pi >= parameters.length) return false;
|
||||
if (PsiPolyExpressionUtil.isPolyExpression(expression)) return false;
|
||||
PsiType exprType = RefactoringUtil.getTypeByExpression(expression);
|
||||
if (exprType == null) return false;
|
||||
if (exprType == null || PsiType.VOID.equals(exprType)) return false;
|
||||
if (exprType instanceof PsiDisjunctionType) {
|
||||
exprType = ((PsiDisjunctionType)exprType).getLeastUpperBound();
|
||||
}
|
||||
|
||||
@@ -87,10 +87,14 @@ public class CreateMethodFromUsageFix extends CreateFromUsageBaseFix {
|
||||
|
||||
public static boolean hasErrorsInArgumentList(final PsiMethodCallExpression call) {
|
||||
Project project = call.getProject();
|
||||
PsiExpressionList argumentList = call.getArgumentList();
|
||||
for (PsiExpression expression : argumentList.getExpressions()) {
|
||||
PsiType type = expression.getType();
|
||||
if (type == null || PsiType.VOID.equals(type)) return true;
|
||||
}
|
||||
Document document = PsiDocumentManager.getInstance(project).getDocument(call.getContainingFile());
|
||||
if (document == null) return true;
|
||||
|
||||
PsiExpressionList argumentList = call.getArgumentList();
|
||||
final TextRange argRange = argumentList.getTextRange();
|
||||
return !DaemonCodeAnalyzerEx.processHighlights(document, project, HighlightSeverity.ERROR,
|
||||
//strictly inside arg list
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
// "Change 1st parameter of method 'foo' from 'String' to 'void'" "false"
|
||||
public class S {
|
||||
void bar() {}
|
||||
void foo(String s) {}
|
||||
{
|
||||
foo(b<caret>ar());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
// "Create method 'bar'" "false"
|
||||
class Test {
|
||||
{
|
||||
ba<caret>r(foo());
|
||||
}
|
||||
|
||||
void foo() {}
|
||||
}
|
||||
Reference in New Issue
Block a user