mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-86810 Find Usages not finding usages when I do it on decompiled stub source
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.intellij.psi.impl;
|
||||
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.openapi.components.ServiceManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.progress.ProgressIndicatorProvider;
|
||||
@@ -964,9 +965,12 @@ public class PsiClassImplUtil {
|
||||
|
||||
private static PsiElement originalElement(PsiClass aClass) {
|
||||
final PsiElement originalElement = aClass.getOriginalElement();
|
||||
final PsiCompiledElement compiled = originalElement.getUserData(ClsElementImpl.COMPILED_ELEMENT);
|
||||
if (compiled != null) {
|
||||
return compiled;
|
||||
ASTNode node = originalElement.getNode();
|
||||
if (node != null) {
|
||||
final PsiCompiledElement compiled = node.getUserData(ClsElementImpl.COMPILED_ELEMENT);
|
||||
if (compiled != null) {
|
||||
return compiled;
|
||||
}
|
||||
}
|
||||
return originalElement;
|
||||
}
|
||||
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
import javax.swing.JLabel;
|
||||
|
||||
public class Usage {
|
||||
JLabel s;
|
||||
}
|
||||
@@ -89,6 +89,12 @@ public class FindUsagesTest extends PsiTestCase{
|
||||
assertEquals(1, ReferencesSearch.search(method).findAll().size());
|
||||
}
|
||||
|
||||
public void testLibraryClassUsageFromDecompiledSource() {
|
||||
PsiElement decompiled =
|
||||
((PsiCompiledElement)myJavaFacade.findClass("javax.swing.JLabel", GlobalSearchScope.allScope(myProject))).getMirror();
|
||||
assertEquals(2, ReferencesSearch.search(decompiled).findAll().size());
|
||||
}
|
||||
|
||||
public void testImplicitConstructorUsage() throws Throwable {
|
||||
PsiMethod[] ctrs = myJavaFacade.findClass("Foo", GlobalSearchScope.allScope(myProject)).getConstructors();
|
||||
PsiMethod method = ctrs[0];
|
||||
|
||||
Reference in New Issue
Block a user