mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-09 20:42:52 +07:00
introduce functional parameter: exclude only selection range from used parameters check as for functional interfaces the whole code block is treated as selection's parent (IDEA-154299)
This commit is contained in:
+38
@@ -0,0 +1,38 @@
|
||||
import java.util.function.BooleanSupplier;
|
||||
|
||||
class A2 {
|
||||
void method(MyObject obj, BooleanSupplier anObject) {
|
||||
obj.method1();
|
||||
if (anObject.getAsBoolean()) {
|
||||
doOtherStaff();
|
||||
}
|
||||
obj.method2();
|
||||
}
|
||||
|
||||
{
|
||||
final MyObject obj = new MyObject();
|
||||
method(obj, new BooleanSupplier() {
|
||||
public boolean getAsBoolean() {
|
||||
return obj.isCondition1();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void doOtherStaff() {
|
||||
|
||||
}
|
||||
|
||||
private class MyObject {
|
||||
public void method1() {
|
||||
|
||||
}
|
||||
|
||||
public boolean isCondition1() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void method2() {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
|
||||
class A2 {
|
||||
void method(MyObject obj) {
|
||||
obj.method1();
|
||||
if (<selection>obj.isCondition1()</selection>) {
|
||||
doOtherStaff();
|
||||
}
|
||||
obj.method2();
|
||||
}
|
||||
|
||||
{
|
||||
method(new MyObject());
|
||||
}
|
||||
|
||||
private void doOtherStaff() {
|
||||
|
||||
}
|
||||
|
||||
private class MyObject {
|
||||
public void method1() {
|
||||
|
||||
}
|
||||
|
||||
public boolean isCondition1() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void method2() {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -70,6 +70,10 @@ public class IntroduceFunctionalParameterTest extends LightRefactoringTestCase
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testUsedParametersOutsideSelectedFragment() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTestDataPath() {
|
||||
|
||||
Reference in New Issue
Block a user