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

Address reliance on default constructors in the Java Sound APIs

    XMLWordPrintable

    Details

    • Type: CSR
    • Status: Closed
    • Priority: P4
    • Resolution: Approved
    • Fix Version/s: 16
    • Component/s: client-libs
    • Labels:
      None
    • Subcomponent:
    • Compatibility Risk:
      minimal
    • Interface Kind:
      Java API
    • Scope:
      SE

      Description

      Summary

      Add explicit constructors to some classes in Java Sound APIs which using default constructors.

      Problem

      Default constructors are not recommended for formal API classes.

      Solution

      Add the public constructors to the public/non-abstract classes, and protected constructors to the public/abstract classes.

      Specification

      src/java.desktop/share/classes/javax/sound/midi/VoiceStatus.java    
           public int volume = 0;
      +
      +    /**
      +     * Constructs a {@code VoiceStatus}.
      +     */
      +    public VoiceStatus() {}
       }
      
      src/java.desktop/share/classes/javax/sound/midi/spi/MidiDeviceProvider.java
          public abstract class MidiDeviceProvider {
      
      +    /**
      +     * Constructs a {@code MidiDeviceProvider}.
      +     */
      +    protected MidiDeviceProvider() {}
      
      src/java.desktop/share/classes/javax/sound/midi/spi/MidiFileReader.java
          public abstract class MidiFileReader {
      
      +    /**
      +     * Constructs a {@code MidiFileReader}.
      +     */
      +    protected MidiFileReader() {}
      
      src/java.desktop/share/classes/javax/sound/midi/spi/MidiFileWriter.java          
          public abstract class MidiFileWriter {
      
      +    /**
      +     * Constructs a {@code MidiFileWriter}.
      +     */
      +    protected MidiFileWriter() {}
      
      src/java.desktop/share/classes/javax/sound/midi/spi/SoundbankReader.java
          public abstract class SoundbankReader {
      
      +    /**
      +     * Constructs a {@code SoundbankReader}.
      +     */
      +    protected SoundbankReader() {}
      
      src/java.desktop/share/classes/javax/sound/sampled/spi/AudioFileReader.java
          public abstract class AudioFileReader {
      
      +    /**
      +     * Constructs a {@code AudioFileReader}.
      +     */
      +    protected AudioFileReader() {}
      
      src/java.desktop/share/classes/javax/sound/sampled/spi/AudioFileWriter.java
          public abstract class AudioFileWriter {
      
      +    /**
      +     * Constructs a {@code AudioFileWriter}.
      +     */
      +    protected AudioFileWriter() {}
      
      src/java.desktop/share/classes/javax/sound/sampled/spi/FormatConversionProvider.java
          public abstract class FormatConversionProvider {
      
      +    /**
      +     * Constructs a {@code FormatConversionProvider}.
      +     */
      +    protected FormatConversionProvider() {}
      
      src/java.desktop/share/classes/javax/sound/sampled/spi/MixerProvider.java
          public abstract class MixerProvider {
      
      +    /**
      +     * Constructs a {@code MixerProvider}.
      +     */
      +    protected MixerProvider() {}

      Link for convenience: http://cr.openjdk.java.net/~serb/8250858/webrev.00/

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              serb Sergey Bylokhov
              Reporter:
              prr Philip Race
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: