mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
EA-37664 - NPE: InlineUtil.getTailCallType
This commit is contained in:
@@ -196,10 +196,12 @@ public class InlineMethodProcessor extends BaseRefactoringProcessor {
|
||||
if (value != null && !(value instanceof PsiCallExpression)) {
|
||||
for (UsageInfo info : usagesIn) {
|
||||
PsiReference reference = info.getReference();
|
||||
InlineUtil.TailCallType type = InlineUtil.getTailCallType(reference);
|
||||
if (type == InlineUtil.TailCallType.Simple) {
|
||||
conflicts.putValue(statement, "Inlined result won't be a valid statement");
|
||||
break;
|
||||
if (reference != null) {
|
||||
InlineUtil.TailCallType type = InlineUtil.getTailCallType(reference);
|
||||
if (type == InlineUtil.TailCallType.Simple) {
|
||||
conflicts.putValue(statement, "Inlined result won't be a valid statement");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ import com.intellij.util.Function;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.Processor;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@@ -276,7 +277,7 @@ public class InlineUtil {
|
||||
return result && nonTailCallUsages.isEmpty();
|
||||
}
|
||||
|
||||
public static TailCallType getTailCallType(final PsiReference psiReference) {
|
||||
public static TailCallType getTailCallType(@NotNull final PsiReference psiReference) {
|
||||
PsiElement element = psiReference.getElement();
|
||||
PsiExpression methodCall = PsiTreeUtil.getParentOfType(element, PsiMethodCallExpression.class);
|
||||
if (methodCall == null) return TailCallType.None;
|
||||
|
||||
Reference in New Issue
Block a user