Fixed 3468 unused private method call on inner class
This commit is contained in:
@ -230,7 +230,13 @@ public class ClassScope extends AbstractJavaScope {
|
||||
Map<ClassNameDeclaration, List<NameOccurrence>> classDeclarations = getClassDeclarations();
|
||||
if (result.isEmpty() && !classDeclarations.isEmpty()) {
|
||||
for (ClassNameDeclaration innerClass : getClassDeclarations().keySet()) {
|
||||
ASTMethodDeclarator md = innerClass.getNode().getFirstDescendantOfType(ASTMethodDeclarator.class);
|
||||
if (md != null) {
|
||||
images.add(md.getImage());
|
||||
finder = new ImageFinderFunction(images);
|
||||
}
|
||||
Applier.apply(finder, innerClass.getScope().getDeclarations(VariableNameDeclaration.class).keySet().iterator());
|
||||
Applier.apply(finder, innerClass.getScope().getDeclarations(MethodNameDeclaration.class).keySet().iterator());
|
||||
if (finder.getDecl() != null) {
|
||||
result.add(finder.getDecl());
|
||||
}
|
||||
|
@ -1727,4 +1727,22 @@ public class Outer {
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
|
||||
<test-code>
|
||||
<description>#3468 UnusedPrivateMethod false positive when outer class calls private static method on inner class</description>
|
||||
<expected-problems>0</expected-problems>
|
||||
<code><![CDATA[
|
||||
public class OuterClass {
|
||||
|
||||
public void foo() {
|
||||
InnerClass.doSomething();
|
||||
}
|
||||
|
||||
static class InnerClass {
|
||||
private static void doSomething() {
|
||||
}
|
||||
}
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
</test-data>
|
||||
|
Reference in New Issue
Block a user