mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 06:11:42 +07:00
inplace introduce: append semicolon if needed (to avoid parsing assignment as local variable)
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
class Test {
|
||||
private String myTimer;
|
||||
|
||||
Test() {
|
||||
"<caret>"
|
||||
myTimer = "abc";
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
class Test {
|
||||
private String myTimer;
|
||||
|
||||
Test() {
|
||||
"<caret>"
|
||||
myTimer = "";
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
class Test {
|
||||
private Foo myFoo;
|
||||
|
||||
Test() {
|
||||
new Fo<caret>o()
|
||||
myFoo = new Foo();
|
||||
}
|
||||
}
|
||||
|
||||
class Foo{}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
class Test {
|
||||
private Foo myFoo;
|
||||
private final Foo foo;
|
||||
|
||||
Test() {
|
||||
foo = new Foo();
|
||||
myFoo = foo;
|
||||
}
|
||||
}
|
||||
|
||||
class Foo{}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
class Test {
|
||||
private String myTimer;
|
||||
private final String string;
|
||||
|
||||
Test() {
|
||||
string =<caret> "";
|
||||
myTimer = string;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
class Test {
|
||||
private String myTimer;
|
||||
private final String string;
|
||||
|
||||
Test() {
|
||||
string = "";
|
||||
myTimer = "abc";
|
||||
}
|
||||
}
|
||||
@@ -41,6 +41,35 @@ public class InplaceIntroduceFieldTest extends AbstractInplaceIntroduceTest {
|
||||
});
|
||||
}
|
||||
|
||||
public void testBeforeAssignment() throws Exception {
|
||||
|
||||
doTest(new Pass<AbstractInplaceIntroducer>() {
|
||||
@Override
|
||||
public void pass(AbstractInplaceIntroducer inplaceIntroduceFieldPopup) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void testBeforeAssignmentReplaceAll() throws Exception {
|
||||
|
||||
doTest(new Pass<AbstractInplaceIntroducer>() {
|
||||
@Override
|
||||
public void pass(AbstractInplaceIntroducer inplaceIntroduceFieldPopup) {
|
||||
inplaceIntroduceFieldPopup.setReplaceAllOccurrences(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void testBeforeAssignmentReplaceAllCall() throws Exception {
|
||||
|
||||
doTest(new Pass<AbstractInplaceIntroducer>() {
|
||||
@Override
|
||||
public void pass(AbstractInplaceIntroducer inplaceIntroduceFieldPopup) {
|
||||
inplaceIntroduceFieldPopup.setReplaceAllOccurrences(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void testReplaceAll() throws Exception {
|
||||
|
||||
doTest(new Pass<AbstractInplaceIntroducer>() {
|
||||
|
||||
Reference in New Issue
Block a user