mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-08 23:39:39 +07:00
[java-dfa] Having no unreachable branches doesn't mean that the current branch is the only reachable.
GitOrigin-RevId: 6cd26f5f00467775378d6d52b33f3916dc1eba62
This commit is contained in:
committed by
intellij-monorepo-bot
parent
31928210fc
commit
0e37e37009
@@ -302,10 +302,6 @@ public abstract class DataFlowInspectionBase extends AbstractBaseJavaLocalInspec
|
||||
PsiSwitchBlock switchBlock = labelStatement.getEnclosingSwitchBlock();
|
||||
if (switchBlock == null) continue;
|
||||
if (!canRemoveTheOnlyReachableLabel(label, switchBlock)) continue;
|
||||
if (SwitchUtils.findRemovableUnreachableBranches(label, switchBlock).isEmpty()) {
|
||||
holder.registerProblem(label, JavaAnalysisBundle.message("dataflow.message.only.switch.label"));
|
||||
continue;
|
||||
}
|
||||
if (!StreamEx.iterate(labelStatement, Objects::nonNull, l -> PsiTreeUtil.getPrevSiblingOfType(l, PsiSwitchLabelStatementBase.class))
|
||||
.skip(1).map(PsiSwitchLabelStatementBase::getCaseLabelElementList)
|
||||
.nonNull().flatArray(PsiCaseLabelElementList::getElements)
|
||||
@@ -323,7 +319,8 @@ public abstract class DataFlowInspectionBase extends AbstractBaseJavaLocalInspec
|
||||
}
|
||||
coveredSwitches.add(switchBlock);
|
||||
LocalQuickFix unwrapFix;
|
||||
if (switchBlock instanceof PsiSwitchExpression && !CodeBlockSurrounder.canSurround(((PsiSwitchExpression)switchBlock))) {
|
||||
if ((switchBlock instanceof PsiSwitchExpression && !CodeBlockSurrounder.canSurround(((PsiSwitchExpression)switchBlock))) ||
|
||||
SwitchUtils.findRemovableUnreachableBranches(label, switchBlock).isEmpty()) {
|
||||
unwrapFix = null;
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user