mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
ensure correct expression is checked during read before write variable check (IDEA-135937)
This commit is contained in:
@@ -852,6 +852,7 @@ public class ControlFlowUtil {
|
||||
|
||||
private static PsiReferenceExpression findReferenceTo(PsiElement element, PsiVariable variable) {
|
||||
if (element instanceof PsiReferenceExpression
|
||||
&& !((PsiReferenceExpression)element).isQualified()
|
||||
&& ((PsiReferenceExpression)element).resolve() == variable) {
|
||||
return (PsiReferenceExpression)element;
|
||||
}
|
||||
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
|
||||
import java.util.Comparator;
|
||||
|
||||
class Test {
|
||||
private final int x;
|
||||
|
||||
public Test(int x) {
|
||||
this.x = x;
|
||||
}
|
||||
|
||||
public static final Comparator<Test> comparator = (o1, o2) -> {
|
||||
if (o1.x == o2.x) {
|
||||
}
|
||||
<error descr="'Test.this' cannot be referenced from a static context">this</error>.x != o2.x;
|
||||
return 0;
|
||||
};
|
||||
}
|
||||
+1
@@ -32,6 +32,7 @@ public class LambdaHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
|
||||
public void testStaticAccess() { doTest(); }
|
||||
public void testEffectiveFinal() { doTest(); }
|
||||
public void testFieldInitializedUsedInLambda() {doTest();}
|
||||
public void testReassignUsedVars() { doTest(); }
|
||||
public void testLambdaContext() { doTest(); }
|
||||
public void testReturnTypeCompatibility() { doTest(); }
|
||||
|
||||
Reference in New Issue
Block a user