<Sound Dev> com.sun.media.sound.SoftMainMixer.processAudioBuffers stoppedMixers-handling-bug?

Lothar Kimmeringer job at kimmeringer.de
Wed Jan 29 18:10:17 UTC 2020


for completely sound-unrelated reasons I've downloaded the sources of JDK 1.8
and created an Eclipse-project with it. I get a compile error in class
com.sun.media.sound.SoftMainMixer.processAudioBuffers and when checking the
source I have to agree with Eclipse that it's an issue:

Description	Resource	Path	Location	Type
Unlikely argument type SoftMainMixer.SoftChannelMixerContainer for contains(Object) on a Collection<ModelChannelMixer>	SoftMainMixer.java	/JDK1_8/src/share/classes/com/sun/media/sound	line 632	Java Problem

Disclaimer: I've configured Eclipse to regard this programming mistake as error,
while the default is just a warning.

The offending lines (threre are two) is:

     if (stoppedMixers.contains(cmixer)) {

stoppedMixer is a a Collection<ModelChannelMixer> while cmixer is of
type SoftChannelMixerContainer, so contains() will never return true.
I assume it should have been

     if (stoppedMixers.contains(cmixer.mixer)) {

instead. I've checked the sources of Java 13 and it's still there in
this way so it doesn't seem to be something that has already been found
and fixed but not been backported to Java 1.8.

WMState and KeepAliveCache have similar issues but I suppose that's
for other mail lists to report ;-)

Thanks and best regards,

Lothar Kimmeringer

More information about the sound-dev mailing list