Improve docs
This commit is contained in:
@ -120,10 +120,14 @@ public class Test {
|
||||
class="net.sourceforge.pmd.lang.rule.XPathRule"
|
||||
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_performance.html#avoidfilestream">
|
||||
<description>
|
||||
Use Files.newInputStream(Paths.get(fileName)) instead of new FileInputStream(fileName).
|
||||
Use Files.newOutputStream(Paths.get(fileName)) instead of new FileOutputStream(fileName).
|
||||
Use Files.newBufferedReader(Paths.get(fileName)) instead of new FileReader(fileName).
|
||||
Use Files.newBufferedWriter(Paths.get(fileName)) instead of new FileWriter(fileName).
|
||||
The FileInputStream and FileOutputStream classes contains a finalizer method which will cause garbage collection pauses. See [JDK-8080225](https://bugs.openjdk.java.net/browse/JDK-8080225) for details.
|
||||
|
||||
The FileReader and FileWriter constructors instantiate FileInputStream and FileOutputStream, again causing garbage collection issues while finalizer methods are called.
|
||||
|
||||
* Use `Files.newInputStream(Paths.get(fileName))` instead of `new FileInputStream(fileName)`.
|
||||
* Use `Files.newOutputStream(Paths.get(fileName))` instead of `new FileOutputStream(fileName)`.
|
||||
* Use `Files.newBufferedReader(Paths.get(fileName))` instead of `new FileReader(fileName)`.
|
||||
* Use `Files.newBufferedWriter(Paths.get(fileName))` instead of `new FileWriter(fileName)`.
|
||||
</description>
|
||||
<priority>1</priority>
|
||||
<properties>
|
||||
|
Reference in New Issue
Block a user