PsiElement (@NotNull PsiElement element, @NotNull PsiElement container) { if (container instanceof PsiDeclarationStatement) { if (canHave15Suppressions(element)) { PsiDeclarationStatement declarationStatement = (PsiDeclarationStatement)container; PsiElement[] declaredElements = declarationStatement.getDeclaredElements(); for (PsiElement declaredElement : declaredElements) { if (declaredElement instanceof PsiLocalVariable) { PsiModifierList modifierList = ((PsiLocalVariable)declaredElement).getModifierList(); if (modifierList != null) { return declaredElement; } } } } } else if (container instanceof PsiForeachStatement) { if (canHave15Suppressions(element)) { PsiParameter parameter = ((PsiForeachStatement)container).getIterationParameter(); PsiModifierList modifierList = element.getParent() == parameter ? parameter.getModifierList() : null; if (modifierList != null) { return parameter; } } } else if (container instanceof PsiTryStatement) { PsiResourceList resourceList = ((PsiTryStatement)container).getResourceList(); if (resourceList != null) { for (PsiResourceListElement listElement : resourceList) { if (listElement instanceof PsiResourceVariable && listElement == element.getParent()) { PsiModifierList modifierList = ((PsiResourceVariable)listElement).getModifierList(); if (modifierList != null) { return listElement; } } } } } return null; }