mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 06:05:01 +07:00
introduce field: use precalculated settings (IDEA-83180)
(cherry picked from commit 019be99b8e2b558e2014565a15dd29f0202b4653)
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
public class A {
|
||||
private static final class Inner {
|
||||
public final String string;
|
||||
|
||||
public Inner(Integer param) {
|
||||
string = param.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
public class A {
|
||||
private static final class Inner {
|
||||
public Inner(Integer param) {
|
||||
String s<caret>tr = param.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,15 @@
|
||||
package com.intellij.refactoring;
|
||||
|
||||
import com.intellij.JavaTestUtil;
|
||||
import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.PsiPrimitiveType;
|
||||
import com.intellij.psi.PsiType;
|
||||
import com.intellij.refactoring.introduceField.BaseExpressionToFieldHandler;
|
||||
import com.intellij.refactoring.util.CommonRefactoringUtil;
|
||||
import com.intellij.testFramework.LightCodeInsightTestCase;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author ven
|
||||
*/
|
||||
@@ -115,4 +118,16 @@ public class IntroduceFieldInSameClassTest extends LightCodeInsightTestCase {
|
||||
performRefactoring(BaseExpressionToFieldHandler.InitializationPlace.IN_FIELD_DECLARATION, false);
|
||||
checkResultByFile("/refactoring/introduceField/afterLocalVarAnnotations.java");
|
||||
}
|
||||
|
||||
public void testStaticFieldInInnerClass() throws Exception {
|
||||
configureByFile("/refactoring/introduceField/beforeStaticFieldInInnerClass.java");
|
||||
new MockIntroduceFieldHandler(BaseExpressionToFieldHandler.InitializationPlace.IN_CURRENT_METHOD, false){
|
||||
@Override
|
||||
protected int getChosenClassIndex(List<PsiClass> classes) {
|
||||
return 0;
|
||||
}
|
||||
}.invoke(getProject(), myEditor, myFile, null);
|
||||
checkResultByFile("/refactoring/introduceField/afterStaticFieldInInnerClass.java");
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user