Files
openide/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/redundantStringOperation/beforeByteArrayOutputStreamToStringCsn.java
Bas Leijdekkers 3d5589bde2 IG: better messages and fixed highlighting for "Redundant 'String' operation" inspection
GitOrigin-RevId: f328b47c3c64b6f078f89fa04f0353ec34d57f24
2022-08-29 22:19:49 +00:00

32 lines
1.1 KiB
Java

// "Fix all 'Redundant 'String' operation' problems in file" "true"
import java.io.ByteArrayOutputStream;
import java.io.UnsupportedEncodingException;
class Main {
private static ByteArrayOutputStream foo() {
return new ByteArrayOutputStream();
}
public static void main(String[] args) throws UnsupportedEncodingException {
String csn = "ISO-8859-1";
ByteArrayOutputStream out1 = new ByteArrayOutputStream();
byte[] result1 = (out1.toByteArray());
String s1 = new String(result1, csn);
ByteArrayOutputStream out2 = new ByteArrayOutputStream();
byte[] result2 = (((out2.toByteArray())));
String s2 = new String((result2), (csn));
ByteArrayOutputStream out3 = new ByteArrayOutputStream();
String s3 = new String(out3.toByteArray(), csn);
ByteArrayOutputStream out4 = new ByteArrayOutputStream();
String s4 = new String((out4.toByteArray()), (csn));
String s5 = new String(foo().toByteArray(), csn);
String s6 = new <caret>String((foo().toByteArray()), (csn));
}
}