From 5f02ff82e942dce43192623e652b6944231ffb63 Mon Sep 17 00:00:00 2001 From: Maxim Shafirov Date: Tue, 10 Apr 2012 16:00:24 +0400 Subject: [PATCH] Do fast checks first --- .../codeInspection/deadCode/UnusedDeclarationInspection.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/java/java-impl/src/com/intellij/codeInspection/deadCode/UnusedDeclarationInspection.java b/java/java-impl/src/com/intellij/codeInspection/deadCode/UnusedDeclarationInspection.java index e0106b8889ae..d68b2a10970d 100644 --- a/java/java-impl/src/com/intellij/codeInspection/deadCode/UnusedDeclarationInspection.java +++ b/java/java-impl/src/com/intellij/codeInspection/deadCode/UnusedDeclarationInspection.java @@ -341,6 +341,8 @@ public class UnusedDeclarationInspection extends FilteringInspectionTool { @Override public void visitElement(final RefEntity refEntity) { if (refEntity instanceof RefJavaElement) { final RefElementImpl refElement = (RefElementImpl)refEntity; + if (!refElement.isSuspicious()) return; + final PsiElement element = refElement.getElement(); if (element == null) return; final boolean isSuppressed = refElement.isSuppressed(getShortName()); @@ -350,7 +352,6 @@ public class UnusedDeclarationInspection extends FilteringInspectionTool { } return; } - if (!refElement.isSuspicious()) return; refElement.accept(new RefJavaVisitor() { @Override public void visitElement(final RefEntity elem) { if (elem instanceof RefElement) {