mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
move method: new escalate visibility should be processed (IDEADEV-39711)
This commit is contained in:
+1
@@ -233,6 +233,7 @@ public class MoveInstanceMethodProcessor extends BaseRefactoringProcessor{
|
||||
for (PsiReference reference : docRefs) {
|
||||
reference.bindToElement(method);
|
||||
}
|
||||
VisibilityUtil.fixVisibility(usages, method, myNewVisibility);
|
||||
}
|
||||
catch (IncorrectOperationException e) {
|
||||
LOG.error(e);
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
public class EscalateVisibility {
|
||||
public void x(B b){
|
||||
yy(b);
|
||||
}
|
||||
private void y<caret>y(B b){
|
||||
}
|
||||
}
|
||||
|
||||
class B {}
|
||||
@@ -0,0 +1,10 @@
|
||||
public class EscalateVisibility {
|
||||
public void x(B b){
|
||||
b.yy();
|
||||
}
|
||||
}
|
||||
|
||||
class B {
|
||||
void yy(){
|
||||
}
|
||||
}
|
||||
+10
-1
@@ -8,6 +8,7 @@ import com.intellij.refactoring.move.moveInstanceMethod.MoveInstanceMethodHandle
|
||||
import com.intellij.refactoring.move.moveInstanceMethod.MoveInstanceMethodProcessor;
|
||||
import com.intellij.testFramework.LightCodeInsightTestCase;
|
||||
import com.intellij.JavaTestUtil;
|
||||
import com.intellij.util.VisibilityUtil;
|
||||
|
||||
/**
|
||||
* @author ven
|
||||
@@ -44,7 +45,15 @@ public class MoveInstanceMethodTest extends LightCodeInsightTestCase {
|
||||
|
||||
public void testIDEADEV11257() throws Exception { doTest(true, 0); }
|
||||
|
||||
public void testEscalateVisibility() throws Exception {
|
||||
doTest(true, 0, VisibilityUtil.ESCALATE_VISIBILITY);
|
||||
}
|
||||
|
||||
private void doTest(boolean isTargetParameter, final int targetIndex) throws Exception {
|
||||
doTest(isTargetParameter, targetIndex, null);
|
||||
}
|
||||
|
||||
private void doTest(boolean isTargetParameter, final int targetIndex, final String newVisibility) throws Exception {
|
||||
final String filePath = "/refactoring/moveInstanceMethod/" + getTestName(false) + ".java";
|
||||
configureByFile(filePath);
|
||||
final PsiElement targetElement = TargetElementUtilBase.findTargetElement(getEditor(), TargetElementUtilBase.ELEMENT_NAME_ACCEPTED);
|
||||
@@ -53,7 +62,7 @@ public class MoveInstanceMethodTest extends LightCodeInsightTestCase {
|
||||
final PsiVariable targetVariable = isTargetParameter ? method.getParameterList().getParameters()[targetIndex] :
|
||||
method.getContainingClass().getFields()[targetIndex];
|
||||
new MoveInstanceMethodProcessor(getProject(),
|
||||
method, targetVariable, null, MoveInstanceMethodHandler.suggestParameterNames (method, targetVariable)).run();
|
||||
method, targetVariable, newVisibility, MoveInstanceMethodHandler.suggestParameterNames (method, targetVariable)).run();
|
||||
checkResultByFile(filePath + ".after");
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user