Looks like I've optimized some code, that we don't need at all. refElement.getPsiElement(), which is slow is only used to get it's file to check if it belongs to search scope.

This commit is contained in:
Maxim Shafirov
2012-04-10 21:08:44 +04:00
parent b7bbb9bcbf
commit 5d8433e70f
3 changed files with 14 additions and 11 deletions
@@ -343,11 +343,12 @@ public class UnusedDeclarationInspection extends FilteringInspectionTool {
final RefElementImpl refElement = (RefElementImpl)refEntity;
if (!refElement.isSuspicious()) return;
final PsiElement element = refElement.getElement();
if (element == null) return;
PsiFile file = refElement.getContainingFile();
if (file == null) return;
final boolean isSuppressed = refElement.isSuppressed(getShortName());
if (!getContext().isToCheckMember(element, UnusedDeclarationInspection.this) || isSuppressed) {
if (isSuppressed || !scope.contains(element)) {
if (!getContext().isToCheckFile(file, UnusedDeclarationInspection.this) || isSuppressed) {
if (isSuppressed || !scope.contains(file)) {
getEntryPointsManager().addEntryPoint(refElement, false);
}
return;