mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
enable introduce before void statement but with non-void qualifier (IDEA-76726 )
This commit is contained in:
+2
-2
@@ -96,8 +96,8 @@ public abstract class IntroduceVariableBase extends IntroduceHandlerBase {
|
||||
//try line selection
|
||||
if (statementsInRange.length == 1 && (PsiUtilCore.hasErrorElementChild(statementsInRange[0]) ||
|
||||
!PsiUtil.isStatement(statementsInRange[0]) ||
|
||||
statementsInRange[0].getTextRange().getStartOffset() >= offset ||
|
||||
statementsInRange[0].getTextRange().getEndOffset() <= offset ||
|
||||
statementsInRange[0].getTextRange().getStartOffset() > offset ||
|
||||
statementsInRange[0].getTextRange().getEndOffset() < offset ||
|
||||
isPreferStatements())) {
|
||||
selectionModel.selectLineAtCaret();
|
||||
final PsiExpression expressionInRange =
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
class Test {
|
||||
void foo() {
|
||||
Object c = getObject();
|
||||
c.notify();
|
||||
}
|
||||
|
||||
Object getObject() {return null;}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
class Test {
|
||||
void foo() {
|
||||
<caret>getObject().notify();
|
||||
}
|
||||
|
||||
Object getObject() {return null;}
|
||||
}
|
||||
@@ -16,7 +16,6 @@ import com.intellij.util.containers.MultiMap;
|
||||
import junit.framework.Assert;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
@@ -298,6 +297,10 @@ public class IntroduceVariableTest extends LightCodeInsightTestCase {
|
||||
doTest(new MockIntroduceVariableHandler("b", true, true, false, "java.lang.Exception", true));
|
||||
}
|
||||
|
||||
public void testBeforeVoidStatement() throws Exception {
|
||||
doTest(new MockIntroduceVariableHandler("c", false, false, false, "java.lang.Object"));
|
||||
}
|
||||
|
||||
private void doTest(IntroduceVariableBase testMe) throws Exception {
|
||||
@NonNls String baseName = "/refactoring/introduceVariable/" + getTestName(false);
|
||||
configureByFile(baseName + ".java");
|
||||
|
||||
Reference in New Issue
Block a user