报告使用 java.nio.file.FilesString 作为字节读取或写入的方法调用 此类调用可被替换为对 Java 11 中引入的 Files.readString()Files.writeString() 方法的调用。

示例:


  String s = "example";
  Files.write(Paths.get("out.txt"), s.getBytes(StandardCharsets.UTF_8), StandardOpenOption.WRITE);
  s = new String(Files.readAllBytes(Paths.get("in.txt")), StandardCharsets.ISO_8859_1);

在应用快速修复后:


  String s = "example";
  Files.writeString(Paths.get("out.txt"), s, StandardOpenOption.WRITE);
  s = Files.readString(Paths.get("in.txt"), StandardCharsets.ISO_8859_1);

2018.3 最新变化