Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8285759

Re-examine PushbackInputStream mark/reset

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 19
    • core-libs
    • None
    • behavioral
    • minimal
    • Synchronization of these methods is not part of their contract. Changing the long-standing behavior is not expected to affect user-defined subclasses.
    • Java API
    • Implementation

      Summary

      In the java.io package, remove the synchronized keyword from the mark(int) and reset() methods of the PushbackInputStream class.

      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/PushbackInputStream.java
      +++ b/src/java.base/share/classes/java/io/PushbackInputStream.java
      @@ -345,7 +345,7 @@ public class PushbackInputStream extends FilterInputStream {
            *                      the mark position becomes invalid.
            * @see     java.io.InputStream#reset()
            */
      -    public synchronized void mark(int readlimit) {
      +    public void mark(int readlimit) {
           }
      
           /**
      @@ -360,7 +360,7 @@ public class PushbackInputStream extends FilterInputStream {
            * @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");
           }

            bpb Brian Burkhalter
            bpb Brian Burkhalter
            Alan Bateman, Jaikiran Pai
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: