Java: Don't extract method where it's not safe because of nullable result (IDEA-167391)

This commit is contained in:
Pavel Dolgov
2017-06-08 18:17:10 +03:00
parent 9ca8685340
commit a95807108c
5 changed files with 128 additions and 20 deletions
@@ -0,0 +1,12 @@
class C {
private int[] list;
private int find(int id) {
<selection>for (int n : list) {
if (n == id) {
return n <= 0 ? 0 : n;
}
}</selection>
throw new RuntimeException();
}
}