Summary
In the java.io
package, remove the synchronized
keyword from the mark(int)
and reset()
methods of the InputStream
and FilterInputStream
classes.
Problem
For the indicated methods, the synchronized
keyword does not appear to add any value.
Solution
Remove the synchronized
keyword from the declarations of the indicated methods.
Specification
--- a/src/java.base/share/classes/java/io/FilterInputStream.java
+++ b/src/java.base/share/classes/java/io/FilterInputStream.java
@@ -204,7 +204,7 @@ public class FilterInputStream extends InputStream {
* @see java.io.FilterInputStream#reset()
*/
@Override
- public synchronized void mark(int readlimit) {
+ public void mark(int readlimit) {
in.mark(readlimit);
}
@@ -230,7 +230,7 @@ public class FilterInputStream extends InputStream {
* @see java.io.FilterInputStream#mark(int)
*/
@Override
- public synchronized void reset() throws IOException {
+ public void reset() throws IOException {
in.reset();
}
--- a/src/java.base/share/classes/java/io/InputStream.java
+++ b/src/java.base/share/classes/java/io/InputStream.java
@@ -683,7 +683,7 @@ public abstract class InputStream implements Closeable {
* the mark position becomes invalid.
* @see java.io.InputStream#reset()
*/
- public synchronized void mark(int readlimit) {}
+ public void mark(int readlimit) {}
/**
* Repositions this stream to the position at the time the
@@ -729,7 +729,7 @@ public abstract class InputStream implements Closeable {
* @see java.io.InputStream#mark(int)
* @see java.io.IOException
*/
- public synchronized void reset() throws IOException {
+ public void reset() throws IOException {
throw new IOException("mark/reset not supported");
}
- csr of
-
JDK-8284930 Re-examine FilterInputStream mark/reset
-
- Resolved
-
- relates to
-
JDK-8285759 Re-examine PushbackInputStream mark/reset
-
- Closed
-