mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-01 02:38:59 +07:00
RedundantStringOperationInspection: String constructor can be simplified in case the passed array copied entirely
IDEA-226130 GitOrigin-RevId: d20197f50aeceaea2074e905b94ea7d838d53b4a
This commit is contained in:
committed by
intellij-monorepo-bot
parent
f0efafd51c
commit
3ec4cf4a76
@@ -0,0 +1,17 @@
|
||||
// "Fix all 'Redundant 'String' operation' problems in file" "true"
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
class Main {
|
||||
void foo(char[] chars, byte[] bytes, int[] ints) {
|
||||
String s1 = new String(bytes);
|
||||
String s2 = new String(chars);
|
||||
String s3 = new String(bytes, Charset.defaultCharset());
|
||||
String s4 = new String(bytes, StandardCharsets.ISO_8859_1);
|
||||
|
||||
String s5 = new String(ints, 0, ints.length);
|
||||
String s6 = new String(chars, 0, bytes.length);
|
||||
String s7 = new String(bytes, 1, bytes.length, Charset.defaultCharset());
|
||||
String s8 = new String(bytes, 0, bytes.length - 1, StandardCharsets.ISO_8859_1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
// "Fix all 'Redundant 'String' operation' problems in file" "true"
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
class Main {
|
||||
void foo(char[] chars, byte[] bytes, int[] ints) {
|
||||
String s1 = new String(bytes, 0, bytes.length<caret>);
|
||||
String s2 = new String(chars, 0, chars.length);
|
||||
String s3 = new String(bytes, 0, bytes.length, Charset.defaultCharset());
|
||||
String s4 = new String(bytes, 0, bytes.length, StandardCharsets.ISO_8859_1);
|
||||
|
||||
String s5 = new String(ints, 0, ints.length);
|
||||
String s6 = new String(chars, 0, bytes.length);
|
||||
String s7 = new String(bytes, 1, bytes.length, Charset.defaultCharset());
|
||||
String s8 = new String(bytes, 0, bytes.length - 1, StandardCharsets.ISO_8859_1);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user