mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-08 15:09:39 +07:00
ensure expression valid, initializer expression should be already replaced (IDEA-125231)
This commit is contained in:
@@ -864,7 +864,7 @@ public class CreateFromUsageUtils {
|
||||
|
||||
public static boolean isAccessedForWriting(final PsiExpression[] expressionOccurences) {
|
||||
for (PsiExpression expression : expressionOccurences) {
|
||||
if(PsiUtil.isAccessedForWriting(expression)) return true;
|
||||
if(expression.isValid() && PsiUtil.isAccessedForWriting(expression)) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
// "Create Local Variable 'zeit'" "true"
|
||||
public class A {
|
||||
void foo() {
|
||||
final String zeit = "";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// "Create Local Variable 'zeit'" "true"
|
||||
public class A {
|
||||
void foo() {
|
||||
ze<caret>it = "";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,9 +1,24 @@
|
||||
package com.intellij.codeInsight.daemon.quickFix;
|
||||
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
|
||||
|
||||
/**
|
||||
* @author ven
|
||||
*/
|
||||
public class CreateLocalFromUsageTest extends LightQuickFixParameterizedTestCase {
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
CodeStyleSettingsManager.getSettings(getProject()).GENERATE_FINAL_LOCALS = getTestName(true).contains("final");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
CodeStyleSettingsManager.getSettings(getProject()).GENERATE_FINAL_LOCALS = false;
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
public void test() throws Exception { doAllTests(); }
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user