[java] better message when trying to extract constant of variable accessed for writing

GitOrigin-RevId: deb515ab12422a30908578f9cdb367c902354942
This commit is contained in:
Bas Leijdekkers
2024-03-06 15:36:05 +01:00
committed by intellij-monorepo-bot
parent bf6fdd2607
commit 29d7aea7d4
2 changed files with 2 additions and 3 deletions

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// 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.introduceField;
import com.intellij.codeInsight.highlighting.HighlightManager;
@@ -119,7 +119,7 @@ public class IntroduceConstantHandler extends BaseExpressionToFieldHandler imple
for (PsiExpression occurrence : occurrences) {
if (RefactoringUtil.isAssignmentLHS(occurrence)) {
String message =
RefactoringBundle.getCannotRefactorMessage(JavaRefactoringBundle.message("introduce.constant.used.for.write.cannot.refactor.message"));
RefactoringBundle.getCannotRefactorMessage(JavaRefactoringBundle.message("variable.is.accessed.for.writing", occurrence.getText()));
CommonRefactoringUtil.showErrorHint(project, editor, message, getRefactoringNameText(), getHelpID());
highlightError(project, editor, occurrence);
return null;

View File

@@ -390,7 +390,6 @@ introduce.constant.enum.cb=Extract as &enum constant
introduce.constant.field.of.type=Constant (static final field) of &type:
introduce.constant.introduce.to.class=Extract to &class (fully qualified name)\:
introduce.constant.move.to.another.class.checkbox=&Move to another class
introduce.constant.used.for.write.cannot.refactor.message=Selected expression is used for write
introduce.field.field.of.type=Field of &type:
introduce.field.static.field.of.type=Static field of &type:
introduce.functional.variable.pass.fields.checkbox=Pass &fields as params