Files
openide/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/redundantStringOperation/beforeByteArrayOutputStreamToStringCharset.java
Bas Leijdekkers ed2c73e98c more consistent Java inspection names
GitOrigin-RevId: 5c958dfd8b5f55e9e5bede82be5015c3299dd16e
2021-12-20 10:55:14 +00:00

33 lines
1.1 KiB
Java

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