IJPL-166399 Coerce progress fraction to range 0.0-1.0 in the bridge indicator

`ProgressIndicator` doesn't have a fraction check (although documentation states that the value should be in the range), so some progresses reported the wrong values without noticing that there is a problem.

Now these indicators are converted to new `RawProgressReporter` there might be error spam in some cases, because the reporter checks that value is in the range.
As this is a bridge between old and new functionality and `ProgressIndicator` is obsolete, it's better to prevent these errors from happening by adding the check to the bridge itself rather by fixing every place separately.

GitOrigin-RevId: eae5f1c6caa3b21c43342cdba61fac12c0ed99d6
This commit is contained in:
Kate Botsman
2024-11-21 13:42:25 +00:00
committed by intellij-monorepo-bot
parent a19217b529
commit c174b9c992
@@ -530,7 +530,10 @@ open class IdeStatusBarImpl @ApiStatus.Internal constructor(
override fun setFraction(fraction: Double) {
super.setFraction(fraction)
reporter.fraction(fraction)
// RawProgressReporter logs an error if the value is not in the interval 0.0-1.0,
// but ProgressIndicator didn't have that check before (although, according to the documentation, it should be in the range),
// so some indicators report the wrong value and this can cause error spam - IJPL-166399
reporter.fraction(fraction.coerceIn(0.0, 1.0))
}
}
}