mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
unused declaration: take refs from literals into account (IDEA-172447)
This commit is contained in:
+11
@@ -55,6 +55,17 @@ public class RefJavaUtilImpl extends RefJavaUtil{
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitLiteralExpression(PsiLiteralExpression expression) {
|
||||
for (PsiReference reference : expression.getReferences()) {
|
||||
PsiElement resolve = reference.resolve();
|
||||
if (resolve instanceof PsiMember) {
|
||||
final RefElement refClass = refFrom.getRefManager().getReference(resolve);
|
||||
refFrom.addReference(refClass, resolve, psiFrom, false, true, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override public void visitReferenceExpression(PsiReferenceExpression expression) {
|
||||
visitElement(expression);
|
||||
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems>
|
||||
</problems>
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
class Util {
|
||||
static void foo() { }
|
||||
|
||||
public static void main(String[] args) throws Throwable {
|
||||
Util.class.getMethod("foo");
|
||||
}
|
||||
}
|
||||
@@ -194,4 +194,8 @@ public class UnusedDeclarationTest extends AbstractUnusedDeclarationTest {
|
||||
public void testDeprecatedAsEntryPoint() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testReferenceFromReflection() {
|
||||
doTest();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user