diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/deadCode/UnusedDeclarationInspection.java b/java/java-analysis-impl/src/com/intellij/codeInspection/deadCode/UnusedDeclarationInspection.java index df96d140ed3d..51a311194080 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/deadCode/UnusedDeclarationInspection.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/deadCode/UnusedDeclarationInspection.java @@ -391,7 +391,7 @@ public class UnusedDeclarationInspection extends GlobalInspectionTool { }); if (isAddNonJavaUsedEnabled()) { - checkForReachables(); + checkForReachables(globalContext); final StrictUnreferencedFilter strictUnreferencedFilter = new StrictUnreferencedFilter(this, globalContext); ProgressManager.getInstance().runProcess(new Runnable() { @Override @@ -520,7 +520,7 @@ public class UnusedDeclarationInspection extends GlobalInspectionTool { public boolean queryExternalUsagesRequests(@NotNull InspectionManager manager, @NotNull GlobalInspectionContext globalContext, @NotNull ProblemDescriptionsProcessor problemDescriptionsProcessor) { - checkForReachables(); + checkForReachables(globalContext); final RefFilter filter = myPhase == 1 ? new StrictUnreferencedFilter(this, globalContext) : new RefUnreachableFilter(this, globalContext); final boolean[] requestAdded = {false}; @@ -647,16 +647,16 @@ public class UnusedDeclarationInspection extends GlobalInspectionTool { } - void checkForReachables() { + void checkForReachables(@NotNull final GlobalInspectionContext context) { CodeScanner codeScanner = new CodeScanner(); // Cleanup previous reachability information. - getContext().getRefManager().iterate(new RefJavaVisitor() { + context.getRefManager().iterate(new RefJavaVisitor() { @Override public void visitElement(@NotNull RefEntity refEntity) { if (refEntity instanceof RefJavaElement) { final RefJavaElementImpl refElement = (RefJavaElementImpl)refEntity; - if (!((GlobalInspectionContextBase)getContext()).isToCheckMember(refElement, UnusedDeclarationInspection.this)) return; + if (!((GlobalInspectionContextBase)context).isToCheckMember(refElement, UnusedDeclarationInspection.this)) return; refElement.setReachable(false); } } diff --git a/java/java-impl/src/com/intellij/codeInspection/deadCode/UnusedDeclarationPresentation.java b/java/java-impl/src/com/intellij/codeInspection/deadCode/UnusedDeclarationPresentation.java index 0db0532cac90..8dd6a04d8061 100644 --- a/java/java-impl/src/com/intellij/codeInspection/deadCode/UnusedDeclarationPresentation.java +++ b/java/java-impl/src/com/intellij/codeInspection/deadCode/UnusedDeclarationPresentation.java @@ -334,7 +334,7 @@ public class UnusedDeclarationPresentation extends DefaultInspectionToolPresenta @Override public void updateContent() { - getTool().checkForReachables(); + getTool().checkForReachables(getContext()); myPackageContents = new HashMap>(); getContext().getRefManager().iterate(new RefJavaVisitor() { @Override public void visitElement(@NotNull RefEntity refEntity) {