From 8b1d0fcceffab4662db6c0689d889bc92c4553aa Mon Sep 17 00:00:00 2001 From: lsiepel Date: Tue, 27 Dec 2022 16:16:55 +0100 Subject: [PATCH] null annotations - checkstyle (#13979) Signed-off-by: Leo Siepel --- .../binding/bluetooth/generic/internal/BluetoothUnit.java | 3 --- .../internal/CharacteristicChannelTypeProvider.java | 7 ++----- .../generic/internal/GenericBluetoothHandler.java | 3 +-- .../bluetooth/generic/internal/BluetoothUnitTest.java | 2 ++ 4 files changed, 5 insertions(+), 10 deletions(-) diff --git a/bundles/org.openhab.binding.bluetooth.generic/src/main/java/org/openhab/binding/bluetooth/generic/internal/BluetoothUnit.java b/bundles/org.openhab.binding.bluetooth.generic/src/main/java/org/openhab/binding/bluetooth/generic/internal/BluetoothUnit.java index 411256e191..ce21c6debd 100644 --- a/bundles/org.openhab.binding.bluetooth.generic/src/main/java/org/openhab/binding/bluetooth/generic/internal/BluetoothUnit.java +++ b/bundles/org.openhab.binding.bluetooth.generic/src/main/java/org/openhab/binding/bluetooth/generic/internal/BluetoothUnit.java @@ -230,9 +230,6 @@ public enum BluetoothUnit { public static final Unit KILOGRAM_PER_SQUARE_METER = addUnit( new ProductUnit(SIUnits.KILOGRAM.divide(SIUnits.SQUARE_METRE))); - public static final Unit COULOMB_PER_KILOGRAM = addUnit( - new ProductUnit(Units.COULOMB.divide(SIUnits.KILOGRAM))); - public static final Unit GRAY_PER_SECOND = addUnit( new ProductUnit(Units.GRAY.divide(Units.SECOND))); diff --git a/bundles/org.openhab.binding.bluetooth.generic/src/main/java/org/openhab/binding/bluetooth/generic/internal/CharacteristicChannelTypeProvider.java b/bundles/org.openhab.binding.bluetooth.generic/src/main/java/org/openhab/binding/bluetooth/generic/internal/CharacteristicChannelTypeProvider.java index 52a80c5047..4b523a1419 100644 --- a/bundles/org.openhab.binding.bluetooth.generic/src/main/java/org/openhab/binding/bluetooth/generic/internal/CharacteristicChannelTypeProvider.java +++ b/bundles/org.openhab.binding.bluetooth.generic/src/main/java/org/openhab/binding/bluetooth/generic/internal/CharacteristicChannelTypeProvider.java @@ -108,10 +108,7 @@ public class CharacteristicChannelTypeProvider implements ChannelTypeProvider { if (channelID.charAt(30) != '-') { return false; } - if (channelID.charAt(67) != '-') { - return false; - } - return true; + return !(channelID.charAt(67) != '-'); } public ChannelTypeUID registerChannelType(String characteristicUUID, boolean advanced, boolean readOnly, @@ -135,7 +132,7 @@ public class CharacteristicChannelTypeProvider implements ChannelTypeProvider { throw new IllegalStateException("Unknown field format type: " + field.getUnit()); } - if (itemType.equals("Switch")) { + if ("Switch".equals(itemType)) { options = Collections.emptyList(); } diff --git a/bundles/org.openhab.binding.bluetooth.generic/src/main/java/org/openhab/binding/bluetooth/generic/internal/GenericBluetoothHandler.java b/bundles/org.openhab.binding.bluetooth.generic/src/main/java/org/openhab/binding/bluetooth/generic/internal/GenericBluetoothHandler.java index 644e23bf89..c1f8a58484 100644 --- a/bundles/org.openhab.binding.bluetooth.generic/src/main/java/org/openhab/binding/bluetooth/generic/internal/GenericBluetoothHandler.java +++ b/bundles/org.openhab.binding.bluetooth.generic/src/main/java/org/openhab/binding/bluetooth/generic/internal/GenericBluetoothHandler.java @@ -202,7 +202,7 @@ public class GenericBluetoothHandler extends ConnectedBluetoothHandler { .hasPropertyEnabled(BluetoothCharacteristic.PROPERTY_BROADCAST)) .collect(Collectors.toUnmodifiableList()); - if (broadcastCharacteristics.size() == 0) { + if (broadcastCharacteristics.isEmpty()) { logger.info( "No Characteristic of service with UUID {} on {} has the broadcast property set, ignored.", uuidStr, scanNotification.getAddress()); @@ -298,7 +298,6 @@ public class GenericBluetoothHandler extends ConnectedBluetoothHandler { } public void handleCommand(ChannelUID channelUID, Command command) { - // Handle REFRESH if (command == RefreshType.REFRESH) { if (canRead()) { diff --git a/bundles/org.openhab.binding.bluetooth.generic/src/test/java/org/openhab/binding/bluetooth/generic/internal/BluetoothUnitTest.java b/bundles/org.openhab.binding.bluetooth.generic/src/test/java/org/openhab/binding/bluetooth/generic/internal/BluetoothUnitTest.java index 3ef65307d5..bc90cb9bf9 100644 --- a/bundles/org.openhab.binding.bluetooth.generic/src/test/java/org/openhab/binding/bluetooth/generic/internal/BluetoothUnitTest.java +++ b/bundles/org.openhab.binding.bluetooth.generic/src/test/java/org/openhab/binding/bluetooth/generic/internal/BluetoothUnitTest.java @@ -12,12 +12,14 @@ */ package org.openhab.binding.bluetooth.generic.internal; +import org.eclipse.jdt.annotation.NonNullByDefault; import org.junit.jupiter.api.Test; /** * @author Connor Petty - Initial contribution * */ +@NonNullByDefault class BluetoothUnitTest { @Test -- 2.47.3