mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 04:51:24 +07:00
[java-highlighting] More control-flow-related stuff migrated
Public methods from HighlightControlFlowUtil moved to ControlFlowUtil Part of IDEA-365344 Create a new Java error highlighter with minimal dependencies (PSI only) GitOrigin-RevId: 64fa78391b02f9dec3d9f2410e764c8b8e479ea6
This commit is contained in:
committed by
intellij-monorepo-bot
parent
be8d051ff5
commit
a98ba9ff92
@@ -3,7 +3,6 @@ package com.intellij.refactoring.introduceVariable;
|
||||
|
||||
import com.intellij.codeInsight.ChangeContextUtil;
|
||||
import com.intellij.codeInsight.FunctionalInterfaceSuggester;
|
||||
import com.intellij.codeInsight.daemon.impl.analysis.HighlightControlFlowUtil;
|
||||
import com.intellij.codeInsight.navigation.PsiTargetNavigator;
|
||||
import com.intellij.codeInspection.AnonymousCanBeLambdaInspection;
|
||||
import com.intellij.java.JavaBundle;
|
||||
@@ -18,6 +17,7 @@ import com.intellij.openapi.util.NlsContexts;
|
||||
import com.intellij.pom.java.JavaFeature;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.codeStyle.JavaCodeStyleManager;
|
||||
import com.intellij.psi.controlFlow.ControlFlowUtil;
|
||||
import com.intellij.psi.util.PsiFormatUtil;
|
||||
import com.intellij.psi.util.PsiFormatUtilBase;
|
||||
import com.intellij.psi.util.PsiUtil;
|
||||
@@ -278,7 +278,7 @@ public class IntroduceFunctionalVariableHandler extends IntroduceVariableHandler
|
||||
if (!data.passAsParameter) {
|
||||
PsiElement scope = PsiUtil.getVariableCodeBlock(data.variable, null);
|
||||
if (PsiUtil.isAvailable(JavaFeature.EFFECTIVELY_FINAL, data.variable)
|
||||
? scope != null && !HighlightControlFlowUtil.isEffectivelyFinal(data.variable, scope, null)
|
||||
? scope != null && !ControlFlowUtil.isEffectivelyFinal(data.variable, scope)
|
||||
: data.variable.hasModifierProperty(PsiModifier.FINAL)) {
|
||||
conflicts.putValue(null, JavaBundle.message("introduce.functional.variable.accessibility.conflict", data.name));
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.refactoring.introduceVariable;
|
||||
|
||||
import com.intellij.codeInsight.daemon.impl.analysis.HighlightControlFlowUtil;
|
||||
import com.intellij.codeInsight.template.impl.TemplateManagerImpl;
|
||||
import com.intellij.codeInsight.template.impl.TemplateState;
|
||||
import com.intellij.java.refactoring.JavaRefactoringBundle;
|
||||
@@ -17,6 +16,7 @@ import com.intellij.openapi.ui.popup.JBPopupFactory;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.controlFlow.ControlFlowUtil;
|
||||
import com.intellij.psi.impl.light.LightElement;
|
||||
import com.intellij.psi.scope.processor.VariablesProcessor;
|
||||
import com.intellij.psi.scope.util.PsiScopesUtil;
|
||||
@@ -64,7 +64,7 @@ public final class ReassignVariableUtil {
|
||||
PsiElement outerCodeBlock = PsiUtil.getVariableCodeBlock(variable, null);
|
||||
if (outerCodeBlock == null) continue;
|
||||
if (ReferencesSearch.search(variable, new LocalSearchScope(outerCodeBlock))
|
||||
.allMatch(reference -> HighlightControlFlowUtil.getElementVariableReferencedFrom(variable, reference.getElement()) == null)) {
|
||||
.allMatch(reference -> ControlFlowUtil.getScopeEnforcingEffectiveFinality(variable, reference.getElement()) == null)) {
|
||||
vars.add(variable);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.intellij.refactoring.util;
|
||||
|
||||
import com.intellij.codeInsight.BlockUtils;
|
||||
import com.intellij.codeInsight.ChangeContextUtil;
|
||||
import com.intellij.codeInsight.daemon.impl.analysis.HighlightControlFlowUtil;
|
||||
import com.intellij.codeInsight.daemon.impl.quickfix.SimplifyBooleanExpressionFix;
|
||||
import com.intellij.codeInspection.dataFlow.JavaMethodContractUtil;
|
||||
import com.intellij.codeInspection.redundantCast.RemoveRedundantCastUtil;
|
||||
@@ -848,7 +847,7 @@ public final class InlineUtil implements CommonJavaInlineUtil {
|
||||
if (declaration == null || declaration.getDeclaredElements().length != 1) return;
|
||||
PsiModifierList modifiers = target.getModifierList();
|
||||
if (modifiers != null && modifiers.getAnnotations().length != 0) return;
|
||||
boolean effectivelyFinal = HighlightControlFlowUtil.isEffectivelyFinal(variable, context, null);
|
||||
boolean effectivelyFinal = ControlFlowUtil.isEffectivelyFinal(variable, context);
|
||||
if (!effectivelyFinal && !VariableAccessUtils.canUseAsNonFinal(target)) return;
|
||||
|
||||
for (PsiReferenceExpression reference : references) {
|
||||
|
||||
Reference in New Issue
Block a user