Fix/suppress PMD CompareObjectsWithEquals findings (#11476)

Newer PMD versions discover more CompareObjectsWithEquals findings.

Related to https://github.com/openhab/static-code-analysis/pull/423

Signed-off-by: Wouter Born <github@maindrain.net>
This commit is contained in:
Wouter Born
2021-11-02 10:43:53 +01:00
committed by GitHub
parent b67b9fcb25
commit 589400e223
82 changed files with 175 additions and 141 deletions

View File

@@ -134,14 +134,14 @@ public class ChannelUpdaterJob implements SchedulerRunnable, Runnable {
if (unit == null) {
return new DecimalType(rawValue);
}
if (unit == SIUnits.CELSIUS || unit == Units.KELVIN || unit == Units.KILOWATT_HOUR || unit == Units.PERCENT
|| unit == Units.HOUR) {
if (SIUnits.CELSIUS.equals(unit) || Units.KELVIN.equals(unit) || Units.KILOWATT_HOUR.equals(unit)
|| Units.PERCENT.equals(unit) || Units.HOUR.equals(unit)) {
return new QuantityType<>((double) rawValue / 10, unit);
} else if (unit == Units.HERTZ || unit == Units.SECOND) {
} else if (Units.HERTZ.equals(unit) || Units.SECOND.equals(unit)) {
return new QuantityType<>((double) rawValue, unit);
} else if (unit == Units.LITRE_PER_MINUTE) {
} else if (Units.LITRE_PER_MINUTE.equals(unit)) {
return new QuantityType<>((double) rawValue / 60, unit);
} else if (unit == Units.BAR || unit == Units.VOLT) {
} else if (Units.BAR.equals(unit) || Units.VOLT.equals(unit)) {
return new QuantityType<>((double) rawValue / 100, unit);
}
@@ -222,7 +222,7 @@ public class ChannelUpdaterJob implements SchedulerRunnable, Runnable {
var longState = String.format("%s - %s %s - %s", state, getStateTranslation("menuStateLine2", row2),
formatHours(time), getStateTranslation("menuStateLine3", row3));
handleEventType((State) new StringType(longState), HeatpumpChannel.CHANNEL_HEATPUMP_STATUS);
handleEventType(new StringType(longState), HeatpumpChannel.CHANNEL_HEATPUMP_STATUS);
}
private void updateProperties(Integer[] heatpumpValues) {