mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
fix injection tests
This commit is contained in:
@@ -10,6 +10,7 @@ import com.intellij.openapi.util.UserDataHolderEx;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.filters.OrFilter;
|
||||
import com.intellij.psi.impl.compiled.ClsElementImpl;
|
||||
import com.intellij.psi.impl.source.PsiImmediateClassType;
|
||||
import com.intellij.psi.infos.MethodCandidateInfo;
|
||||
import com.intellij.psi.scope.ElementClassFilter;
|
||||
@@ -833,7 +834,7 @@ public class PsiClassImplUtil {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (aClass.getOriginalElement().equals(another.getOriginalElement())) {
|
||||
if (originalElement(aClass).equals(originalElement((PsiClass)another))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -854,6 +855,15 @@ public class PsiClassImplUtil {
|
||||
return false;
|
||||
}
|
||||
|
||||
private static PsiElement originalElement(PsiClass aClass) {
|
||||
final PsiElement originalElement = aClass.getOriginalElement();
|
||||
final PsiCompiledElement compiled = originalElement.getUserData(ClsElementImpl.COMPILED_ELEMENT);
|
||||
if (compiled != null) {
|
||||
return compiled;
|
||||
}
|
||||
return originalElement;
|
||||
}
|
||||
|
||||
public static boolean isFieldEquivalentTo(PsiField field, PsiElement another) {
|
||||
if (!(another instanceof PsiField)) return false;
|
||||
String name1 = field.getName();
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.intellij.lang.ASTNode;
|
||||
import com.intellij.lang.Language;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.fileTypes.StdFileTypes;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
|
||||
@@ -19,6 +20,7 @@ public abstract class ClsElementImpl extends PsiElementBase implements PsiCompil
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.compiled.ClsElementImpl");
|
||||
private static final boolean CHECK_MIRROR_ENABLED = false;
|
||||
protected static final Object LAZY_BUILT_LOCK = new String("lazy cls tree initialization lock");
|
||||
public static final Key<PsiCompiledElement> COMPILED_ELEMENT = Key.create("COMPILED_ELEMENT");
|
||||
|
||||
private TreeElement myMirror = null;
|
||||
|
||||
@@ -216,7 +218,7 @@ public abstract class ClsElementImpl extends PsiElementBase implements PsiCompil
|
||||
return null;
|
||||
}
|
||||
|
||||
protected void setMirrorCheckingType(TreeElement element, IElementType type) {
|
||||
protected void setMirrorCheckingType(@NotNull TreeElement element, IElementType type) {
|
||||
if (CHECK_MIRROR_ENABLED) {
|
||||
LOG.assertTrue(myMirror == null);
|
||||
}
|
||||
@@ -225,6 +227,7 @@ public abstract class ClsElementImpl extends PsiElementBase implements PsiCompil
|
||||
LOG.assertTrue(element.getElementType() == type);
|
||||
}
|
||||
|
||||
element.putUserData(COMPILED_ELEMENT, this);
|
||||
myMirror = element;
|
||||
}
|
||||
}
|
||||
|
||||
-1
@@ -125,7 +125,6 @@ public class HighlightUsagesHandler extends HighlightHandlerBase {
|
||||
if (element == null) return null;
|
||||
}
|
||||
|
||||
if (target instanceof PsiCompiledElement) target = ((PsiCompiledElement)target).getMirror();
|
||||
return target;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user