dfa: support outer class fields access with qualified this

This commit is contained in:
peter
2015-01-14 21:01:23 +01:00
parent 76b9c81fb4
commit 8658b30dde
2 changed files with 23 additions and 0 deletions
@@ -107,6 +107,14 @@ public class DfaExpressionFactory {
return myFactory.getConstFactory().createFromValue(value, type, null);
}
if (expression instanceof PsiThisExpression) {
PsiJavaCodeReferenceElement qualifier = ((PsiThisExpression)expression).getQualifier();
PsiElement target = qualifier == null ? null : qualifier.resolve();
if (target instanceof PsiClass) {
return myFactory.getVarFactory().createVariableValue((PsiModifierListOwner)target, null, false, null);
}
}
return null;
}
@@ -43,4 +43,19 @@ class TestInspection {
private void doSomething(@NotNull String s) {
//...
}
}
class WithInner {
@Nullable Object o;
{
new Runnable() {
@Override
public void run() {
if (WithInner.this.o != null) {
System.out.println(WithInner.this.o.toString());
}
}
};
}
}