mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
introduce functional parameter: do not fold as functional interface creation would be in the place where local vars are not available
This commit is contained in:
+27
@@ -0,0 +1,27 @@
|
||||
import java.util.function.Function;
|
||||
|
||||
class Test {
|
||||
|
||||
{
|
||||
final int[] equals = new int[0];
|
||||
performTest(new Function<String[],String[]>() {
|
||||
public String[] apply(String[] fields) {
|
||||
System.out.println();
|
||||
return getIndexed(fields, equals);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static void performTest(Function<String[], String[]> anObject) {
|
||||
String[] fields = new String[0];
|
||||
|
||||
final String[] indexed = anObject.apply(fields);
|
||||
|
||||
System.out.println(indexed);
|
||||
}
|
||||
|
||||
private static String[] getIndexed(String[] fields, int[] indices) {
|
||||
return new String[indices.length];
|
||||
}
|
||||
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
class Test {
|
||||
|
||||
{
|
||||
performTest(new int[0]);
|
||||
}
|
||||
|
||||
private static void performTest(int[] equals) {
|
||||
String[] fields = new String[0];
|
||||
|
||||
<selection>System.out.println();
|
||||
final String[] indexed = getIndexed(fields, equals);</selection>
|
||||
|
||||
System.out.println(indexed);
|
||||
}
|
||||
|
||||
private static String[] getIndexed(String[] fields, int[] indices) {
|
||||
return new String[indices.length];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -53,6 +53,10 @@ public class IntroduceFunctionalParameterTest extends LightRefactoringTestCase
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testEnsureNotFolded() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTestDataPath() {
|
||||
|
||||
Reference in New Issue
Block a user