mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
EA-228757 - IOE: PsiElementFactoryImpl.createVariableDeclarationStatement
GitOrigin-RevId: 0bbefa07fde8fb4dd234aa221c4a360ae9d9b829
This commit is contained in:
committed by
intellij-monorepo-bot
parent
4fd1e215aa
commit
a6bbf74b78
+1
-1
@@ -1055,7 +1055,7 @@ public abstract class IntroduceVariableBase extends IntroduceHandlerBase {
|
||||
final JavaReplaceChoice replaceChoice) {
|
||||
final boolean replaceAll = replaceChoice.isAll();
|
||||
final SuggestedNameInfo suggestedName = getSuggestedName(typeSelectorManager.getDefaultType(), expr, anchor);
|
||||
final String variableName = suggestedName.names.length > 0 ? suggestedName.names[0] : "";
|
||||
final String variableName = suggestedName.names.length > 0 ? suggestedName.names[0] : "v";
|
||||
final boolean declareFinal = replaceAll && declareFinalIfAll || !anyAssignmentLHS && createFinals(anchor.getContainingFile()) ||
|
||||
anchor instanceof PsiSwitchLabelStatementBase;
|
||||
final boolean declareVarType = canBeExtractedWithoutExplicitType(expr) && createVarType() && !replaceChoice.isChain();
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
class _ {
|
||||
{
|
||||
new<caret> _();
|
||||
}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
class _ {
|
||||
{
|
||||
_ xyz = new _();
|
||||
}
|
||||
}
|
||||
+4
@@ -73,6 +73,10 @@ public class InplaceIntroduceVariableTest extends AbstractJavaInplaceIntroduceTe
|
||||
type("expr");
|
||||
});
|
||||
}
|
||||
|
||||
public void testNoNameSuggested() {
|
||||
doTest(introducer -> type("xyz"));
|
||||
}
|
||||
|
||||
public void testPlaceInsideLoopAndRename() {
|
||||
doTest(introducer -> type("expr"));
|
||||
|
||||
Reference in New Issue
Block a user