I'm writing an Android app and use net.sourceforge.streamsupport:streamsupport:1.5.5
I'm using Android Studio 2.3.3 with the embedded JDK, source and target compatibility are set to 1.8.
Now I have a method reference Light::getColor
that, when called, calls the wrong method (Light::getMaxColorTemperature
).
return StreamSupport.stream(lights)
.filter(light -> light.getColorMode().ordinal() >= ColorMode.HUE_SATURATION.ordinal()
.findFirst()
.map(Light::getColor)
.orElse(Color.WHITE);
If I use a lambda expression instead (light -> light.getColor()
), the correct method is being called:
return StreamSupport.stream(lights)
.filter(light -> light.getColorMode().ordinal() >= ColorMode.HUE_SATURATION.ordinal()
.findFirst()
.map(light -> light.getColor())
.orElse(Color.WHITE);
Recompiling the whole project didn't change anything. Has anyone ever seen this? I'm not sure whether this is a streamsupport problem or an Android compiler problem, and how to figure out.