mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-06 05:10:22 +07:00
hide iterate intention for non expression statements (IDEA-83625)
This commit is contained in:
@@ -112,7 +112,9 @@ public class IterateOverIterableIntention implements IntentionAction {
|
||||
element = ((PsiExpressionStatement)element).getExpression().getLastChild();
|
||||
}
|
||||
while ((element = PsiTreeUtil.getParentOfType(element, PsiExpression.class, true)) != null) {
|
||||
if (element.getParent() instanceof PsiMethodCallExpression) continue;
|
||||
final PsiElement parent = element.getParent();
|
||||
if (parent instanceof PsiMethodCallExpression) continue;
|
||||
if (!(parent instanceof PsiExpressionStatement)) return null;
|
||||
final PsiType type = ((PsiExpression)element).getType();
|
||||
if (type instanceof PsiArrayType || InheritanceUtil.isInheritor(type, CommonClassNames.JAVA_LANG_ITERABLE)) return (PsiExpression)element;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
// "Iterate" "false"
|
||||
class Test {
|
||||
void foo() {
|
||||
final Annotation[] annotations = getClass().getAnnotat<caret>ions();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user