mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[java-dfa] JavaDfaAssistProvider: cosmetics; test for static field
GitOrigin-RevId: ca0f9fae87932ba4c8c7e60487d17f24205e6356
This commit is contained in:
committed by
intellij-monorepo-bot
parent
54acee6f24
commit
947503db12
+12
-12
@@ -117,21 +117,21 @@ public final class JavaDfaAssistProvider implements DfaAssistProvider {
|
||||
Value qualifierValue = getJdiValueForDfaVariable(proxy, var.getQualifier(), anchor);
|
||||
if (qualifierValue == null) return null;
|
||||
PsiElement element = descriptor.getPsiElement();
|
||||
if (element instanceof PsiField && qualifierValue instanceof ObjectReference) {
|
||||
ReferenceType type = ((ObjectReference)qualifierValue).referenceType();
|
||||
PsiClass psiClass = ((PsiField)element).getContainingClass();
|
||||
if (element instanceof PsiField psiField && qualifierValue instanceof ObjectReference objectRef) {
|
||||
ReferenceType type = objectRef.referenceType();
|
||||
PsiClass psiClass = psiField.getContainingClass();
|
||||
if (psiClass != null && type.name().equals(JVMNameUtil.getClassVMName(psiClass))) {
|
||||
Field field = DebuggerUtils.findField(type, ((PsiField)element).getName());
|
||||
Field field = DebuggerUtils.findField(type, psiField.getName());
|
||||
if (field != null) {
|
||||
return DfaAssistProvider.wrap(((ObjectReference)qualifierValue).getValue(field));
|
||||
return DfaAssistProvider.wrap(objectRef.getValue(field));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (descriptor instanceof ArrayElementDescriptor && qualifierValue instanceof ArrayReference) {
|
||||
int index = ((ArrayElementDescriptor)descriptor).getIndex();
|
||||
int length = ((ArrayReference)qualifierValue).length();
|
||||
if (descriptor instanceof ArrayElementDescriptor arrayDesc && qualifierValue instanceof ArrayReference arrayRef) {
|
||||
int index = arrayDesc.getIndex();
|
||||
int length = arrayRef.length();
|
||||
if (index >= 0 && index < length) {
|
||||
return DfaAssistProvider.wrap(((ArrayReference)qualifierValue).getValue(index));
|
||||
return DfaAssistProvider.wrap(arrayRef.getValue(index));
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@@ -166,14 +166,14 @@ public final class JavaDfaAssistProvider implements DfaAssistProvider {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (psi instanceof PsiField && ((PsiField)psi).hasModifierProperty(PsiModifier.STATIC)) {
|
||||
PsiClass psiClass = ((PsiField)psi).getContainingClass();
|
||||
if (psi instanceof PsiField psiField && psiField.hasModifierProperty(PsiModifier.STATIC)) {
|
||||
PsiClass psiClass = psiField.getContainingClass();
|
||||
if (psiClass != null) {
|
||||
String name = psiClass.getQualifiedName();
|
||||
if (name != null) {
|
||||
ReferenceType type = ContainerUtil.getOnlyItem(proxy.getVirtualMachine().classesByName(name));
|
||||
if (type != null && type.isPrepared()) {
|
||||
Field field = DebuggerUtils.findField(type, ((PsiField)psi).getName());
|
||||
Field field = DebuggerUtils.findField(type, psiField.getName());
|
||||
if (field != null && field.isStatic()) {
|
||||
return DfaAssistProvider.wrap(type.getValue(field));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user