Summary
Clarify the flush
methods in java.io
classes CharArrayWriter
and StringWriter
do nothing.
Problem
The specification of flush()
in the two indicated classes is not explicit about the fact that the methods have no effect.
Solution
To the specification of each flush()
method add the sentence
The {@code flush} method of {@code <ClassName/>} does nothing.
Specification
--- a/src/java.base/share/classes/java/io/CharArrayWriter.java
+++ b/src/java.base/share/classes/java/io/CharArrayWriter.java
@@ -276,6 +276,8 @@ public class CharArrayWriter extends Writer {
/**
* Flush the stream.
+ *
+ * <p> The {@code flush} method of {@code CharArrayWriter} does nothing.
*/
public void flush() { }
diff --git a/src/java.base/share/classes/java/io/StringWriter.java b/src/java.base/share/classes/java/io/StringWriter.java
index 16eed62d7bb..30654230ca6 100644
--- a/src/java.base/share/classes/java/io/StringWriter.java
+++ b/src/java.base/share/classes/java/io/StringWriter.java
@@ -229,6 +229,8 @@ public class StringWriter extends Writer {
/**
* Flush the stream.
+ *
+ * <p> The {@code flush} method of {@code StringWriter} does nothing.
*/
public void flush() {
}
- csr of
-
JDK-8261301 StringWriter.flush() is NOOP but documentation does not indicate it
-
- Closed
-