unused declaration: don't filter entry points from dummy node, register method patterns as persistent entry points (IDEA-160808)

This commit is contained in:
Anna Kozlova
2016-09-05 20:06:08 +03:00
parent 0c4e942a7e
commit cc6e78dd57
2 changed files with 11 additions and 2 deletions
@@ -105,6 +105,11 @@ public class DummyEntryPointsPresentation extends UnusedDeclarationPresentation
return node;
}
@Override
protected boolean skipEntryPoints(RefJavaElement refElement) {
return false;
}
@Override
@NotNull
public DeadHTMLComposer getComposer() {
@@ -157,7 +157,7 @@ public class UnusedDeclarationPresentation extends DefaultInspectionToolPresenta
if (!refEntity.isValid()) return;
RefJavaElement refElement = (RefJavaElement)refEntity;
if (!compareVisibilities(refElement, getTool().getSharedLocalInspectionTool())) return;
if (getTool().isEntryPoint(refElement)) return;
if (skipEntryPoints(refElement)) return;
Element element = refEntity.getRefManager().export(refEntity, parentNode, -1);
if (element == null) return;
@@ -460,7 +460,7 @@ public class UnusedDeclarationPresentation extends DefaultInspectionToolPresenta
RefJavaElement refElement = (RefJavaElement)refEntity;
if (!compareVisibilities(refElement, localInspectionTool)) return;
if (!(getContext().getUIOptions().FILTER_RESOLVED_ITEMS && getIgnoredRefElements().contains(refElement)) && refElement.isValid() && getFilter().accepts(refElement)) {
if (getTool().isEntryPoint(refElement)) return;
if (skipEntryPoints(refElement)) return;
registerContentEntry(refEntity, RefJavaUtil.getInstance().getPackageName(refEntity));
}
}
@@ -468,6 +468,10 @@ public class UnusedDeclarationPresentation extends DefaultInspectionToolPresenta
updateProblemElements();
}
protected boolean skipEntryPoints(RefJavaElement refElement) {
return getTool().isEntryPoint(refElement);
}
@PsiModifier.ModifierConstant
private static String getAcceptedVisibility(UnusedSymbolLocalInspectionBase tool, RefJavaElement element) {
if (element instanceof RefImplicitConstructor) {