mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
enable common dataflow for class initializers
This commit is contained in:
+3
-2
@@ -88,9 +88,10 @@ public class CommonDataflow {
|
||||
|
||||
private static DataflowResult getDataflowResult(PsiElement context) {
|
||||
PsiMember member = PsiTreeUtil.getParentOfType(context, PsiMember.class);
|
||||
if(!(member instanceof PsiMethod)) return null;
|
||||
if(!(member instanceof PsiMethod) && !(member instanceof PsiClassInitializer)) return null;
|
||||
return CachedValuesManager.getCachedValue(member, () -> {
|
||||
PsiCodeBlock body = ((PsiMethod)member).getBody();
|
||||
PsiCodeBlock body = member instanceof PsiMethod ? ((PsiMethod)member).getBody()
|
||||
: ((PsiClassInitializer)member).getBody();
|
||||
DataflowResult result = runDFA(body);
|
||||
return CachedValueProvider.Result.create(result, PsiModificationTracker.MODIFICATION_COUNT);
|
||||
});
|
||||
|
||||
+10
@@ -50,6 +50,16 @@ public class SimplifiableEqualsExpression {
|
||||
System.out.println("...");
|
||||
}
|
||||
}
|
||||
|
||||
private static final boolean DEBUG = false;
|
||||
|
||||
{
|
||||
String s1 = DEBUG ? "null" : null;
|
||||
|
||||
if(<warning descr="Unnecessary 'null' check before 'equals()' call">s1 == null</warning> || !s1.equals("")) {
|
||||
System.out.println("...");
|
||||
}
|
||||
}
|
||||
|
||||
void test(List<String> list) {
|
||||
String s = list.get(0);
|
||||
|
||||
Reference in New Issue
Block a user