mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 03:13:40 +07:00
WrapWithAdapterMethodCallFix replaces individual cases
WrapArrayToArraysAsListFix, WrapLongWithMathToIntExactFix, WrapStringWithFileFix are united into WrapWithAdapterMethodCallFix. Also Paths.get(), Collections.singleton(), Collections.singletonList(), Arrays.stream() wrappers added Fixes IDEA-175129 Suggest to wrap a value with `Collections.singleton*()`
This commit is contained in:
+10
@@ -0,0 +1,10 @@
|
||||
// "Wrap using 'Collections.singletonList()'" "true"
|
||||
import java.util.*;
|
||||
|
||||
class Test {
|
||||
|
||||
void m(long l) {
|
||||
List<Long> list = Collections.singletonList(l);
|
||||
}
|
||||
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// "Wrap using 'Paths.get()'" "true"
|
||||
import java.nio.file.*;
|
||||
|
||||
class Test {
|
||||
|
||||
Path m() {
|
||||
return Paths.get("/etc/passwd");
|
||||
}
|
||||
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// "Wrap 1st parameter using 'Collections.singleton()'" "true"
|
||||
import java.util.*;
|
||||
|
||||
class Test {
|
||||
|
||||
void method(Set<Long> set, double val) {
|
||||
|
||||
}
|
||||
|
||||
void m(long l) {
|
||||
method(Collections.singleton(l), l);
|
||||
}
|
||||
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// "Wrap using 'Arrays.stream()'" "true"
|
||||
import java.util.*;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class Test {
|
||||
Stream<String> testStream(List<String[]> list) {
|
||||
return Arrays.stream(list.get(0));
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// "Wrap using 'Collections.singletonList()'" "true"
|
||||
import java.util.*;
|
||||
|
||||
class Test {
|
||||
|
||||
void m(long l) {
|
||||
List<Long> list = <caret>l;
|
||||
}
|
||||
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// "Wrap using 'Collections.singletonList()'" "false"
|
||||
import java.util.*;
|
||||
|
||||
class Test {
|
||||
|
||||
void m(long l) {
|
||||
List<Integer> list = <caret>l;
|
||||
}
|
||||
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// "Wrap using 'Paths.get()'" "true"
|
||||
import java.nio.file.*;
|
||||
|
||||
class Test {
|
||||
|
||||
Path m() {
|
||||
return "/<caret>etc/passwd";
|
||||
}
|
||||
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// "Wrap 1st parameter using 'Collections.singleton()'" "true"
|
||||
import java.util.*;
|
||||
|
||||
class Test {
|
||||
|
||||
void method(Set<Long> set, double val) {
|
||||
|
||||
}
|
||||
|
||||
void m(long l) {
|
||||
method(<caret>l, l);
|
||||
}
|
||||
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// "Wrap using 'Arrays.stream()'" "true"
|
||||
import java.util.*;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class Test {
|
||||
Stream<String> testStream(List<String[]> list) {
|
||||
return list.<caret>get(0);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Wrap using 'Arrays.asList()'" "true"
|
||||
// "Wrap parameter using 'Arrays.asList()'" "true"
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Wrap using 'Arrays.asList()'" "false"
|
||||
// "Wrap parameter using 'Arrays.asList()'" "false"
|
||||
import java.util.LinkedList;
|
||||
|
||||
public class Test {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Wrap using 'Arrays.asList()'" "false"
|
||||
// "Wrap parameter using 'Arrays.asList()'" "false"
|
||||
import java.util.LinkedList;
|
||||
|
||||
public class Test {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Wrap using 'Arrays.asList()'" "true"
|
||||
// "Wrap parameter using 'Arrays.asList()'" "true"
|
||||
import java.util.List;
|
||||
|
||||
public class Test {
|
||||
|
||||
Reference in New Issue
Block a user