mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-25 14:25:04 +07:00
TrivialFunctionalExpressionUsage bugfixes & refactoring
Fixes IDEA-176019 Trivial functional expression: do not inline if parameter produces side effect and evaluated not once Fixes EA-103938 (invalid PSI was used if inlining replaced the whole method) Fixes inlining of functional expression
This commit is contained in:
+10
@@ -0,0 +1,10 @@
|
||||
// "Replace method call on lambda with lambda body" "true"
|
||||
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
public class Main {
|
||||
void test() {
|
||||
((Predicate<String>) String::isEmpty).test("abc");
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// "Replace method call on lambda with lambda body" "true"
|
||||
|
||||
import java.util.function.IntBinaryOperator;
|
||||
|
||||
public class Main {
|
||||
void test() {
|
||||
int z = 0;
|
||||
int x = z += 2;
|
||||
z += 3;
|
||||
int res = x;
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// "Replace method call on lambda with lambda body" "true"
|
||||
|
||||
import java.util.function.IntBinaryOperator;
|
||||
|
||||
public class Main {
|
||||
void test() {
|
||||
int res = 5;
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// "Replace method call on lambda with lambda body" "true"
|
||||
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
public class Main {
|
||||
void test() {
|
||||
((Consumer<Predicate<String>>) (x -> x.test("abc"))).ac<caret>cept(String::isEmpty);
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// "Replace method call on lambda with lambda body" "false"
|
||||
|
||||
import java.util.function.IntUnaryOperator;
|
||||
|
||||
public class Main {
|
||||
void test() {
|
||||
((IntUnaryOperator)x -> x+=5).app<caret>lyAsInt(10);
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// "Replace method call on lambda with lambda body" "true"
|
||||
|
||||
import java.util.function.IntBinaryOperator;
|
||||
|
||||
public class Main {
|
||||
void test() {
|
||||
int z = 0;
|
||||
int res = ((IntBinaryOperator)(x, y) -> x).applyAs<caret>Int(z+=2, z+=3);
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// "Replace method call on lambda with lambda body" "true"
|
||||
|
||||
import java.util.function.IntBinaryOperator;
|
||||
|
||||
public class Main {
|
||||
void test() {
|
||||
int res = ((IntBinaryOperator)(x, y) -> x).appl<caret>yAsInt(5, 6);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user