<Sound Dev> [15] Review Request: 8236980 Cleanup of toString methods in JavaSound

Sergey Bylokhov Sergey.Bylokhov at oracle.com
Wed Jan 22 22:13:20 UTC 2020


On 1/22/20 8:54 am, Phil Race wrote:
> http://cr.openjdk.java.net/~serb/8236980/webrev.00/src/java.desktop/share/classes/javax/sound/midi/MidiDevice.java.sdiff.html
> 
> - * Provides a string representation of the device information.
> + * Returns a string representation of the info object.
>            *
> - * @return a description of the info object
> + * @return a string representation of the info object Why is this better ? What is an "info object" ? Why not ?
> "Returns a string representation of the device"?

Because technically this is not a MidiDevice class, but nested class "Info".

And it returns the same thing as "name" anyway. Are you avoiding over-specifying to that extent ?

That's because I do not like to specify the content of the string if it
was not specified before. If in the method above I'll say that the
"name" is returned instead of some generic description, then the CSR
will be needed for sure, because of the new "assertion".

But I'm fine if this spec will be aligned to other methods that returns
the "name" and specify this in the Javadoc.

Yet you preserve that same behaviour here (and elsewhere) :- http://cr.openjdk.java.net/~serb/8236980/webrev.00/src/java.desktop/share/classes/javax/sound/midi/Sequencer.java.udiff.html Are you intending a CSR for any of this ? -phil

The CSR will be necessary if I'll add or remove some assertions in the spec.

> 
> On 1/12/20 12:14 PM, Sergey Bylokhov wrote:
>> Hello.
>> Please review a "weekend cleanup" for JDK 15.
>>
>> Bug: https://bugs.openjdk.java.net/browse/JDK-8236980
>> Fix: http://cr.openjdk.java.net/~serb/8236980/webrev.00
>>
>> I have made these changes:
>>  - The words in the specs are unified across the different methods
>>  - All toString() implementations now use getXXX() methods instead
>>    of direct access to the fields(the getxxx() methods are skipped
>>    only if the getxxx() method is final)
>>  - A few tests were added to check some spec, and its implementations
>>
> 


-- 
Best regards, Sergey.


More information about the sound-dev mailing list