FileRules
SUGGESTION
Simplification
Suppression
Disable all rules by adding
-XepOpt:Refaster:NamePattern=^(?!FileRules\$).*
as compiler argument.
Table of contents
FilesReadStringWithCharset
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("FilesReadStringWithCharset")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!FileRules\$FilesReadStringWithCharset).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
String testFilesReadStringWithCharset() throws IOException {
- return new String(Files.readAllBytes(Paths.get("foo")), StandardCharsets.ISO_8859_1);
+ return Files.readString(Paths.get("foo"), StandardCharsets.ISO_8859_1);
}
FilesReadString
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("FilesReadString")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!FileRules\$FilesReadString).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
String testFilesReadString() throws IOException {
- return Files.readString(Paths.get("foo"), StandardCharsets.UTF_8);
+ return Files.readString(Paths.get("foo"));
}