mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
java: avoid duplicate deadcode reports
GitOrigin-RevId: 4c9833e1adc9182906c9f0797fbeb370100f52c4
This commit is contained in:
committed by
intellij-monorepo-bot
parent
4c7002e81c
commit
8f32c2551d
+10
-9
@@ -431,18 +431,19 @@ public class UnusedDeclarationPresentation extends DefaultInspectionToolPresenta
|
||||
|
||||
private @Nullable RefJavaElement refineElement(RefEntity refEntity) {
|
||||
if (!(refEntity instanceof RefJavaElement refElement)) return null; //dead code doesn't work with refModule | refPackage
|
||||
if (!getFilter().accepts(refElement)) return null;
|
||||
refEntity = getRefManager().getRefinedElement(refEntity);
|
||||
refElement = (RefJavaElement)refEntity;
|
||||
if (!refElement.isValid()) return null;
|
||||
if (!compareVisibilities(refElement, getTool().getSharedLocalInspectionTool())) return null;
|
||||
if (isSuppressed(refElement)) return null;
|
||||
RefFilter filter = getFilter();
|
||||
if (!filter.accepts(refElement)) return null;
|
||||
RefJavaElement refinedElement = (RefJavaElement)getRefManager().getRefinedElement(refEntity);
|
||||
if (refinedElement != refEntity && filter.accepts(refinedElement)) return null; // prevent duplicate reporting
|
||||
if (!refinedElement.isValid()) return null;
|
||||
if (!compareVisibilities(refinedElement, getTool().getSharedLocalInspectionTool())) return null;
|
||||
if (isSuppressed(refinedElement)) return null;
|
||||
if (!ApplicationManager.getApplication().isHeadlessEnvironment() & getContext().getUIOptions().FILTER_RESOLVED_ITEMS &&
|
||||
(myFixedElements.containsKey(refElement) || isExcluded(refEntity))) {
|
||||
(myFixedElements.containsKey(refinedElement) || isExcluded(refinedElement))) {
|
||||
return null;
|
||||
}
|
||||
if (skipEntryPoints(refElement)) return null;
|
||||
return refElement;
|
||||
if (skipEntryPoints(refinedElement)) return null;
|
||||
return refinedElement;
|
||||
}
|
||||
|
||||
protected boolean skipEntryPoints(RefJavaElement refElement) {
|
||||
|
||||
@@ -19,11 +19,6 @@
|
||||
<length>4</length>
|
||||
<description>Class has one instantiation, but it is not reachable from entry points.</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>Test.java</file>
|
||||
<line>1</line>
|
||||
<description>Class has one instantiation but it is not reachable from entry points.</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>Test.java</file>
|
||||
<line>2</line>
|
||||
|
||||
@@ -6,12 +6,6 @@
|
||||
<description>No class references has been found. Class static initializer is not reachable.</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
<file>Test.java</file>
|
||||
<line>1</line>
|
||||
<description>No class references has been found. Class static initializer is not reachable.</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
<file>Test.java</file>
|
||||
<line>2</line>
|
||||
|
||||
-9
@@ -9,15 +9,6 @@
|
||||
<description>Class has one instantiation but it is not reachable from entry points.</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
<file>MyServiceExt.java</file>
|
||||
<line>4</line>
|
||||
<package>my.ext</package>
|
||||
<entry_point TYPE="class" FQNAME="my.ext.MyServiceExt" />
|
||||
<problem_class severity="WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">unused declaration</problem_class>
|
||||
<description>Class has one instantiation but it is not reachable from entry points.</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
<file>MyService.java</file>
|
||||
<line>1</line>
|
||||
|
||||
-9
@@ -9,15 +9,6 @@
|
||||
<description>Class has one instantiation but it is not reachable from entry points.</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
<file>MyServiceImpl.java</file>
|
||||
<line>4</line>
|
||||
<package>my.impl</package>
|
||||
<entry_point TYPE="class" FQNAME="my.impl.MyServiceImpl" />
|
||||
<problem_class severity="WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">unused declaration</problem_class>
|
||||
<description>Class has one instantiation but it is not reachable from entry points.</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
<file>MyService.java</file>
|
||||
<line>1</line>
|
||||
|
||||
Reference in New Issue
Block a user