mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
InlineMethod: better transformation when return value is unused
This commit is contained in:
+16
@@ -0,0 +1,16 @@
|
||||
class A {
|
||||
String foo(int i) {
|
||||
if (i > 0) {
|
||||
if (i == 10) return null;
|
||||
System.out.println(i);
|
||||
}
|
||||
return String.valueOf(i);
|
||||
}
|
||||
|
||||
void bar(int x) {
|
||||
if (x > 0) {
|
||||
f<caret>oo(x);
|
||||
}
|
||||
System.out.println("x < 0");
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
class A {
|
||||
|
||||
void bar(int x) {
|
||||
if (x > 0) {
|
||||
if (x > 0) {
|
||||
if (x != 10) {
|
||||
System.out.println(x);
|
||||
}
|
||||
}
|
||||
}
|
||||
System.out.println("x < 0");
|
||||
}
|
||||
}
|
||||
@@ -8,11 +8,9 @@ class AAA {
|
||||
if (s1.isEmpty()) {
|
||||
s1.add("foo");
|
||||
s2.add("foo");
|
||||
return;
|
||||
} else {
|
||||
s1.add("foo");
|
||||
s2.add("foo");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import java.util.*;
|
||||
|
||||
class Test {
|
||||
boolean test(Set<String> set) {
|
||||
return set.add("foo");
|
||||
}
|
||||
|
||||
void use() {
|
||||
Set<String> set = new HashSet<>();
|
||||
<caret>test(set);
|
||||
test(set);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import java.util.*;
|
||||
|
||||
class Test {
|
||||
|
||||
void use() {
|
||||
Set<String> set = new HashSet<>();
|
||||
set.add("foo");
|
||||
set.add("foo");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user