Remove Map null annotation workarounds (#8916)

These workarounds to prevent false positives can be removed now the EEAs allow for proper null analysis.

Signed-off-by: Wouter Born <github@maindrain.net>
This commit is contained in:
Wouter Born 2020-11-04 13:57:24 +01:00 committed by GitHub
parent 1dccf67909
commit b423f93b1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
124 changed files with 315 additions and 387 deletions

View File

@ -63,13 +63,13 @@ public class AirQualityDiscoveryService extends AbstractDiscoveryService {
} }
@Override @Override
protected void activate(@Nullable Map<String, @Nullable Object> configProperties) { protected void activate(@Nullable Map<String, Object> configProperties) {
super.activate(configProperties); super.activate(configProperties);
} }
@Override @Override
@Modified @Modified
protected void modified(@Nullable Map<String, @Nullable Object> configProperties) { protected void modified(@Nullable Map<String, Object> configProperties) {
super.modified(configProperties); super.modified(configProperties);
} }

View File

@ -19,7 +19,6 @@ import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
/** /**
* The {@link AirQualityJsonData} is responsible for storing * The {@link AirQualityJsonData} is responsible for storing
@ -36,7 +35,7 @@ public class AirQualityJsonData {
private @NonNullByDefault({}) AirQualityJsonTime time; private @NonNullByDefault({}) AirQualityJsonTime time;
private @NonNullByDefault({}) AirQualityJsonCity city; private @NonNullByDefault({}) AirQualityJsonCity city;
private List<Attribute> attributions = new ArrayList<>(); private List<Attribute> attributions = new ArrayList<>();
private Map<String, @Nullable AirQualityValue> iaqi = new HashMap<>(); private Map<String, AirQualityValue> iaqi = new HashMap<>();
private String dominentpol = ""; private String dominentpol = "";
/** /**

View File

@ -76,7 +76,7 @@ public class AlarmDecoderHandlerFactory extends BaseThingHandlerFactory {
return SUPPORTED_THING_TYPES_UIDS.contains(thingTypeUID); return SUPPORTED_THING_TYPES_UIDS.contains(thingTypeUID);
} }
private final Map<ThingUID, @Nullable ServiceRegistration<?>> discoveryServiceRegMap = new HashMap<>(); private final Map<ThingUID, ServiceRegistration<?>> discoveryServiceRegMap = new HashMap<>();
// Marked as Nullable only to fix incorrect redundant null check complaints from null annotations // Marked as Nullable only to fix incorrect redundant null check complaints from null annotations
@Override @Override

View File

@ -13,6 +13,7 @@
package org.openhab.binding.alarmdecoder.internal.protocol; package org.openhab.binding.alarmdecoder.internal.protocol;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map;
import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable; import org.eclipse.jdt.annotation.Nullable;
@ -34,7 +35,7 @@ public enum ADMsgType {
INVALID; // invalid message INVALID; // invalid message
/** hash map from protocol message heading to type */ /** hash map from protocol message heading to type */
private static HashMap<String, @Nullable ADMsgType> startToMsgType = new HashMap<>(); private static Map<String, ADMsgType> startToMsgType = new HashMap<>();
static { static {
startToMsgType.put("!REL", ADMsgType.REL); startToMsgType.put("!REL", ADMsgType.REL);

View File

@ -499,8 +499,7 @@ public class AccountServlet extends HttpServlet {
html.append("<table><tr><th align='left'>Name</th><th align='left'>Value</th></tr>"); html.append("<table><tr><th align='left'>Name</th><th align='left'>Value</th></tr>");
List<JsonMusicProvider> musicProviders = connection.getMusicProviders(); List<JsonMusicProvider> musicProviders = connection.getMusicProviders();
for (JsonMusicProvider musicProvider : musicProviders) { for (JsonMusicProvider musicProvider : musicProviders) {
@Nullable List<String> properties = musicProvider.supportedProperties;
List<@Nullable String> properties = musicProvider.supportedProperties;
String providerId = musicProvider.id; String providerId = musicProvider.id;
String displayName = musicProvider.displayName; String displayName = musicProvider.displayName;
if (properties != null && properties.contains("Alexa.Music.PlaySearchPhrase") if (properties != null && properties.contains("Alexa.Music.PlaySearchPhrase")
@ -557,7 +556,7 @@ public class AccountServlet extends HttpServlet {
} }
if (playLists != null) { if (playLists != null) {
Map<String, @Nullable PlayList @Nullable []> playlistMap = playLists.playlists; Map<String, PlayList @Nullable []> playlistMap = playLists.playlists;
if (playlistMap != null && !playlistMap.isEmpty()) { if (playlistMap != null && !playlistMap.isEmpty()) {
html.append("<table><tr><th align='left'>Name</th><th align='left'>Value</th></tr>"); html.append("<table><tr><th align='left'>Name</th><th align='left'>Value</th></tr>");

View File

@ -12,10 +12,7 @@
*/ */
package org.openhab.binding.amazonechocontrol.internal; package org.openhab.binding.amazonechocontrol.internal;
import static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.SUPPORTED_ECHO_THING_TYPES_UIDS; import static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.*;
import static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.SUPPORTED_SMART_HOME_THING_TYPES_UIDS;
import static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.THING_TYPE_ACCOUNT;
import static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.THING_TYPE_FLASH_BRIEFING_PROFILE;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
@ -66,7 +63,7 @@ import com.google.gson.Gson;
@NonNullByDefault @NonNullByDefault
public class AmazonEchoControlHandlerFactory extends BaseThingHandlerFactory { public class AmazonEchoControlHandlerFactory extends BaseThingHandlerFactory {
private final Logger logger = LoggerFactory.getLogger(AmazonEchoControlHandlerFactory.class); private final Logger logger = LoggerFactory.getLogger(AmazonEchoControlHandlerFactory.class);
private final Map<ThingUID, @Nullable List<ServiceRegistration<?>>> discoveryServiceRegistrations = new HashMap<>(); private final Map<ThingUID, List<ServiceRegistration<?>>> discoveryServiceRegistrations = new HashMap<>();
private final Set<AccountHandler> accountHandlers = new HashSet<>(); private final Set<AccountHandler> accountHandlers = new HashSet<>();
private final HttpService httpService; private final HttpService httpService;

View File

@ -12,14 +12,7 @@
*/ */
package org.openhab.binding.amazonechocontrol.internal; package org.openhab.binding.amazonechocontrol.internal;
import static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.BINDING_ID; import static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.*;
import static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.CHANNEL_TYPE_AMAZON_MUSIC_PLAY_LIST_ID;
import static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.CHANNEL_TYPE_BLUETHOOTH_MAC;
import static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.CHANNEL_TYPE_CHANNEL_PLAY_ON_DEVICE;
import static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.CHANNEL_TYPE_MUSIC_PROVIDER_ID;
import static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.CHANNEL_TYPE_PLAY_ALARM_SOUND;
import static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.CHANNEL_TYPE_START_COMMAND;
import static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.FLASH_BRIEFING_COMMAND_PREFIX;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@ -119,7 +112,7 @@ public class AmazonEchoDynamicStateDescriptionProvider implements DynamicStateDe
return null; return null;
} }
ArrayList<StateOption> options = new ArrayList<>(); List<StateOption> options = new ArrayList<>();
options.add(new StateOption("", "")); options.add(new StateOption("", ""));
for (PairedDevice device : pairedDeviceList) { for (PairedDevice device : pairedDeviceList) {
if (device == null) { if (device == null) {
@ -144,10 +137,9 @@ public class AmazonEchoDynamicStateDescriptionProvider implements DynamicStateDe
return null; return null;
} }
ArrayList<StateOption> options = new ArrayList<>(); List<StateOption> options = new ArrayList<>();
options.add(new StateOption("", "")); options.add(new StateOption("", ""));
@Nullable Map<String, PlayList @Nullable []> playlistMap = playLists.playlists;
Map<String, @Nullable PlayList @Nullable []> playlistMap = playLists.playlists;
if (playlistMap != null) { if (playlistMap != null) {
for (PlayList[] innerLists : playlistMap.values()) { for (PlayList[] innerLists : playlistMap.values()) {
if (innerLists != null && innerLists.length > 0) { if (innerLists != null && innerLists.length > 0) {
@ -174,7 +166,7 @@ public class AmazonEchoDynamicStateDescriptionProvider implements DynamicStateDe
return null; return null;
} }
ArrayList<StateOption> options = new ArrayList<>(); List<StateOption> options = new ArrayList<>();
options.add(new StateOption("", "")); options.add(new StateOption("", ""));
for (JsonNotificationSound notificationSound : notificationSounds) { for (JsonNotificationSound notificationSound : notificationSounds) {
@ -202,7 +194,7 @@ public class AmazonEchoDynamicStateDescriptionProvider implements DynamicStateDe
return null; return null;
} }
ArrayList<StateOption> options = new ArrayList<>(); List<StateOption> options = new ArrayList<>();
options.add(new StateOption("", "")); options.add(new StateOption("", ""));
for (Device device : devices) { for (Device device : devices) {
final String value = device.serialNumber; final String value = device.serialNumber;
@ -223,10 +215,9 @@ public class AmazonEchoDynamicStateDescriptionProvider implements DynamicStateDe
return null; return null;
} }
ArrayList<StateOption> options = new ArrayList<>(); List<StateOption> options = new ArrayList<>();
for (JsonMusicProvider musicProvider : musicProviders) { for (JsonMusicProvider musicProvider : musicProviders) {
@Nullable List<String> properties = musicProvider.supportedProperties;
List<@Nullable String> properties = musicProvider.supportedProperties;
String providerId = musicProvider.id; String providerId = musicProvider.id;
String displayName = musicProvider.displayName; String displayName = musicProvider.displayName;
if (properties != null && properties.contains("Alexa.Music.PlaySearchPhrase") if (properties != null && properties.contains("Alexa.Music.PlaySearchPhrase")
@ -252,7 +243,7 @@ public class AmazonEchoDynamicStateDescriptionProvider implements DynamicStateDe
return null; return null;
} }
ArrayList<StateOption> options = new ArrayList<>(); List<StateOption> options = new ArrayList<>();
options.addAll(originalStateDescription.getOptions()); options.addAll(originalStateDescription.getOptions());
for (FlashBriefingProfileHandler flashBriefing : flashbriefings) { for (FlashBriefingProfileHandler flashBriefing : flashbriefings) {

View File

@ -1490,7 +1490,7 @@ public class Connection {
JsonArray ttsVolumeNodesToExecute = new JsonArray(); JsonArray ttsVolumeNodesToExecute = new JsonArray();
for (int i = 0; i < devices.length; i++) { for (int i = 0; i < devices.length; i++) {
if (ttsVolumes[i] != null && (standardVolumes == null || !ttsVolumes[i].equals(standardVolumes[i]))) { if (ttsVolumes[i] != null && (standardVolumes == null || !ttsVolumes[i].equals(standardVolumes[i]))) {
Map<String, @Nullable Object> volumeParameters = new HashMap<>(); Map<String, Object> volumeParameters = new HashMap<>();
volumeParameters.put("value", ttsVolumes[i]); volumeParameters.put("value", ttsVolumes[i]);
ttsVolumeNodesToExecute ttsVolumeNodesToExecute
.add(createExecutionNode(devices[i], "Alexa.DeviceControls.Volume", volumeParameters)); .add(createExecutionNode(devices[i], "Alexa.DeviceControls.Volume", volumeParameters));

View File

@ -122,7 +122,7 @@ public class AmazonEchoDiscovery extends AbstractDiscoveryService {
@Override @Override
@Activate @Activate
public void activate(@Nullable Map<String, @Nullable Object> config) { public void activate(@Nullable Map<String, Object> config) {
super.activate(config); super.activate(config);
if (config != null) { if (config != null) {
modified(config); modified(config);

View File

@ -12,10 +12,7 @@
*/ */
package org.openhab.binding.amazonechocontrol.internal.discovery; package org.openhab.binding.amazonechocontrol.internal.discovery;
import static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.DEVICE_PROPERTY_ID; import static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.*;
import static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.SUPPORTED_SMART_HOME_THING_TYPES_UIDS;
import static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.THING_TYPE_SMART_HOME_DEVICE;
import static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.THING_TYPE_SMART_HOME_DEVICE_GROUP;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
@ -63,7 +60,7 @@ public class SmartHomeDevicesDiscovery extends AbstractDiscoveryService {
} }
public void activate() { public void activate() {
activate(new Hashtable<String, @Nullable Object>()); activate(new Hashtable<String, Object>());
} }
@Override @Override
@ -123,7 +120,7 @@ public class SmartHomeDevicesDiscovery extends AbstractDiscoveryService {
@Override @Override
@Activate @Activate
public void activate(@Nullable Map<String, @Nullable Object> config) { public void activate(@Nullable Map<String, Object> config) {
super.activate(config); super.activate(config);
if (config != null) { if (config != null) {
modified(config); modified(config);

View File

@ -70,8 +70,8 @@ public class SmartHomeDeviceHandler extends BaseThingHandler {
private @Nullable SmartHomeBaseDevice smartHomeBaseDevice; private @Nullable SmartHomeBaseDevice smartHomeBaseDevice;
private final Gson gson; private final Gson gson;
private final Map<String, @Nullable HandlerBase> handlers = new HashMap<>(); private final Map<String, HandlerBase> handlers = new HashMap<>();
private final Map<String, @Nullable JsonArray> lastStates = new HashMap<>(); private final Map<String, JsonArray> lastStates = new HashMap<>();
public SmartHomeDeviceHandler(Thing thing, Gson gson) { public SmartHomeDeviceHandler(Thing thing, Gson gson) {
super(thing); super(thing);

View File

@ -27,7 +27,7 @@ public class JsonAutomation {
public @Nullable String automationId; public @Nullable String automationId;
public @Nullable String name; public @Nullable String name;
public @Nullable Trigger @Nullable [] triggers; public @Nullable Trigger @Nullable [] triggers;
public @Nullable TreeMap<String, @Nullable Object> sequence; public @Nullable TreeMap<String, Object> sequence;
public @Nullable String status; public @Nullable String status;
public long creationTimeEpochMillis; public long creationTimeEpochMillis;
public long lastUpdatedTimeEpochMillis; public long lastUpdatedTimeEpochMillis;

View File

@ -25,9 +25,9 @@ import org.eclipse.jdt.annotation.Nullable;
@NonNullByDefault @NonNullByDefault
public class JsonMusicProvider { public class JsonMusicProvider {
public @Nullable String displayName; public @Nullable String displayName;
public @Nullable List<@Nullable Object> @Nullable [] supportedTriggers; public @Nullable List<Object> @Nullable [] supportedTriggers;
public @Nullable String icon; public @Nullable String icon;
public @Nullable List<@Nullable String> supportedProperties; public @Nullable List<String> supportedProperties;
public @Nullable String id; public @Nullable String id;
public @Nullable String availability; public @Nullable String availability;
public @Nullable String description; public @Nullable String description;

View File

@ -25,7 +25,7 @@ import org.eclipse.jdt.annotation.Nullable;
@NonNullByDefault @NonNullByDefault
public class JsonPlaylists { public class JsonPlaylists {
public @Nullable Map<String, @Nullable PlayList @Nullable []> playlists; public @Nullable Map<String, PlayList @Nullable []> playlists;
public static class PlayList { public static class PlayList {
public @Nullable String playlistId; public @Nullable String playlistId;

View File

@ -18,7 +18,6 @@ import java.util.Set;
import java.util.function.Supplier; import java.util.function.Supplier;
import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants; import org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants;
import org.openhab.core.thing.type.ChannelTypeUID; import org.openhab.core.thing.type.ChannelTypeUID;
@ -27,7 +26,7 @@ import org.openhab.core.thing.type.ChannelTypeUID;
*/ */
@NonNullByDefault @NonNullByDefault
public class Constants { public class Constants {
public static final Map<String, @Nullable Supplier<HandlerBase>> HANDLER_FACTORY = new HashMap<>(); public static final Map<String, Supplier<HandlerBase>> HANDLER_FACTORY = new HashMap<>();
static { static {
HANDLER_FACTORY.put(HandlerPowerController.INTERFACE, HandlerPowerController::new); HANDLER_FACTORY.put(HandlerPowerController.INTERFACE, HandlerPowerController::new);

View File

@ -64,7 +64,7 @@ public class AstroDiscoveryService extends AbstractDiscoveryService {
@Activate @Activate
public AstroDiscoveryService(final @Reference LocationProvider locationProvider, public AstroDiscoveryService(final @Reference LocationProvider locationProvider,
final @Reference LocaleProvider localeProvider, final @Reference TranslationProvider i18nProvider, final @Reference LocaleProvider localeProvider, final @Reference TranslationProvider i18nProvider,
@Nullable Map<String, @Nullable Object> configProperties) { @Nullable Map<String, Object> configProperties) {
super(new HashSet<>(Arrays.asList(new ThingTypeUID(BINDING_ID, "-"))), DISCOVER_TIMEOUT_SECONDS, true); super(new HashSet<>(Arrays.asList(new ThingTypeUID(BINDING_ID, "-"))), DISCOVER_TIMEOUT_SECONDS, true);
this.locationProvider = locationProvider; this.locationProvider = locationProvider;
this.localeProvider = localeProvider; this.localeProvider = localeProvider;

View File

@ -48,7 +48,7 @@ public class BlueZHandlerFactory extends BaseThingHandlerFactory {
private static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Collections private static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Collections
.singleton(BlueZAdapterConstants.THING_TYPE_BLUEZ); .singleton(BlueZAdapterConstants.THING_TYPE_BLUEZ);
private final Map<ThingUID, @Nullable ServiceRegistration<?>> serviceRegs = new HashMap<>(); private final Map<ThingUID, ServiceRegistration<?>> serviceRegs = new HashMap<>();
private final DeviceManagerFactory deviceManagerFactory; private final DeviceManagerFactory deviceManagerFactory;

View File

@ -42,7 +42,7 @@ import org.osgi.service.component.annotations.Component;
@Component(configurationPid = "binding.roaming", service = ThingHandlerFactory.class) @Component(configurationPid = "binding.roaming", service = ThingHandlerFactory.class)
public class RoamingHandlerFactory extends BaseThingHandlerFactory { public class RoamingHandlerFactory extends BaseThingHandlerFactory {
private final Map<ThingUID, @Nullable ServiceRegistration<?>> serviceRegs = new HashMap<>(); private final Map<ThingUID, ServiceRegistration<?>> serviceRegs = new HashMap<>();
@Override @Override
public boolean supportsThingType(ThingTypeUID thingTypeUID) { public boolean supportsThingType(ThingTypeUID thingTypeUID) {

View File

@ -75,14 +75,14 @@ public class BluetoothDiscoveryService extends AbstractDiscoveryService implemen
@Override @Override
@Activate @Activate
protected void activate(@Nullable Map<String, @Nullable Object> configProperties) { protected void activate(@Nullable Map<String, Object> configProperties) {
logger.debug("Activating Bluetooth discovery service"); logger.debug("Activating Bluetooth discovery service");
super.activate(configProperties); super.activate(configProperties);
} }
@Override @Override
@Modified @Modified
protected void modified(@Nullable Map<String, @Nullable Object> configProperties) { protected void modified(@Nullable Map<String, Object> configProperties) {
super.modified(configProperties); super.modified(configProperties);
} }
@ -170,7 +170,7 @@ public class BluetoothDiscoveryService extends AbstractDiscoveryService implemen
private class DiscoveryCache { private class DiscoveryCache {
private final Map<BluetoothAdapter, SnapshotFuture> discoveryFutures = new HashMap<>(); private final Map<BluetoothAdapter, SnapshotFuture> discoveryFutures = new HashMap<>();
private final Map<BluetoothAdapter, @Nullable Set<DiscoveryResult>> discoveryResults = new ConcurrentHashMap<>(); private final Map<BluetoothAdapter, Set<DiscoveryResult>> discoveryResults = new ConcurrentHashMap<>();
private @Nullable BluetoothDeviceSnapshot latestSnapshot; private @Nullable BluetoothDeviceSnapshot latestSnapshot;

View File

@ -73,7 +73,7 @@ public class SmartherModuleDiscoveryService extends AbstractDiscoveryService
@Override @Override
public void activate() { public void activate() {
logger.debug("Bridge[{}] Activating chronothermostat discovery service", this.bridgeUID); logger.debug("Bridge[{}] Activating chronothermostat discovery service", this.bridgeUID);
Map<String, @Nullable Object> properties = new HashMap<>(); Map<String, Object> properties = new HashMap<>();
properties.put(DiscoveryService.CONFIG_PROPERTY_BACKGROUND_DISCOVERY, Boolean.TRUE); properties.put(DiscoveryService.CONFIG_PROPERTY_BACKGROUND_DISCOVERY, Boolean.TRUE);
super.activate(properties); super.activate(properties);
} }

View File

@ -28,28 +28,22 @@ import com.daveoxley.cbus.CGateThreadPoolExecutor;
* *
* @author John Harvey - Initial contribution * @author John Harvey - Initial contribution
*/ */
@NonNullByDefault @NonNullByDefault
public class CBusThreadPool extends CGateThreadPool { public class CBusThreadPool extends CGateThreadPool {
private final Map<String, @Nullable CGateThreadPoolExecutor> executorMap = new HashMap<>(); private final Map<String, CGateThreadPoolExecutor> executorMap = new HashMap<>();
@Override @Override
protected synchronized CGateThreadPoolExecutor CreateExecutor(@Nullable String name) { protected synchronized CGateThreadPoolExecutor CreateExecutor(@Nullable String name) {
if (name == null || name.isEmpty()) { String nullSafeName = name == null || name.isEmpty() ? "_default" : name;
name = "_default"; CGateThreadPoolExecutor executor = executorMap.get(nullSafeName);
if (executor == null) {
executor = new CBusThreadPoolExecutor(nullSafeName);
executorMap.put(nullSafeName, executor);
} }
@Nullable return executor;
CGateThreadPoolExecutor executor = executorMap.get(name);
if (executor != null) {
return executor;
}
CGateThreadPoolExecutor newExecutor = new CBusThreadPoolExecutor(name);
executorMap.put(name, newExecutor);
return newExecutor;
} }
@NonNullByDefault
public class CBusThreadPoolExecutor extends CGateThreadPoolExecutor { public class CBusThreadPoolExecutor extends CGateThreadPoolExecutor {
private final ThreadPoolExecutor threadPool; private final ThreadPoolExecutor threadPool;

View File

@ -53,14 +53,14 @@ public class HVACHandler extends BaseThingHandler {
* speed, but the protocol's fan command (and matching binding command) use * speed, but the protocol's fan command (and matching binding command) use
* single-letter abbreviations. * single-letter abbreviations.
*/ */
private static final Map<String, @Nullable String> FAN_NUM_TO_STR; private static final Map<String, String> FAN_NUM_TO_STR;
/** /**
* The CoolMasterNet query command returns numbers 0-5 for operation modes, * The CoolMasterNet query command returns numbers 0-5 for operation modes,
* but these don't map to any mode you can set on the device, so we use this * but these don't map to any mode you can set on the device, so we use this
* lookup table. * lookup table.
*/ */
private static final Map<String, @Nullable String> MODE_NUM_TO_STR; private static final Map<String, String> MODE_NUM_TO_STR;
static { static {
FAN_NUM_TO_STR = new HashMap<>(); FAN_NUM_TO_STR = new HashMap<>();

View File

@ -66,7 +66,7 @@ public class DarkSkyDiscoveryService extends AbstractDiscoveryService {
} }
@Override @Override
protected void activate(@Nullable Map<String, @Nullable Object> configProperties) { protected void activate(@Nullable Map<String, Object> configProperties) {
super.activate(configProperties); super.activate(configProperties);
} }

View File

@ -39,7 +39,7 @@ import org.xml.sax.SAXException;
/** /**
* The {@link Enigma2Client} class is responsible for communicating with the Enigma2 device. * The {@link Enigma2Client} class is responsible for communicating with the Enigma2 device.
* *
* @see <a href= * @see <a href=
* "https://github.com/E2OpenPlugins/e2openplugin-OpenWebif/wiki/OpenWebif-API-documentation">OpenWebif-API-documentation</a> * "https://github.com/E2OpenPlugins/e2openplugin-OpenWebif/wiki/OpenWebif-API-documentation">OpenWebif-API-documentation</a>
* *
@ -65,7 +65,7 @@ public class Enigma2Client {
static final int TYPE_INFO = 1; static final int TYPE_INFO = 1;
static final int TYPE_WARNING = 2; static final int TYPE_WARNING = 2;
static final int TYPE_ERROR = 3; static final int TYPE_ERROR = 3;
private final Map<String, @Nullable String> channels = new ConcurrentHashMap<>(); private final Map<String, String> channels = new ConcurrentHashMap<>();
private final String host; private final String host;
private boolean power; private boolean power;
private String channel = ""; private String channel = "";
@ -342,7 +342,7 @@ public class Enigma2Client {
/** /**
* Getter for Test-Injection * Getter for Test-Injection
* *
* @return HttpGet. * @return HttpGet.
*/ */
Enigma2HttpClient getEnigma2HttpClient() { Enigma2HttpClient getEnigma2HttpClient() {

View File

@ -47,7 +47,7 @@ import org.osgi.service.component.annotations.Reference;
@NonNullByDefault @NonNullByDefault
public class EvohomeHandlerFactory extends BaseThingHandlerFactory { public class EvohomeHandlerFactory extends BaseThingHandlerFactory {
private final Map<ThingUID, @Nullable ServiceRegistration<?>> discoveryServiceRegs = new HashMap<>(); private final Map<ThingUID, ServiceRegistration<?>> discoveryServiceRegs = new HashMap<>();
private final HttpClient httpClient; private final HttpClient httpClient;

View File

@ -16,8 +16,6 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.binding.freebox.internal.FreeboxBindingConstants; import org.openhab.binding.freebox.internal.FreeboxBindingConstants;
import org.openhab.binding.freebox.internal.FreeboxDataListener; import org.openhab.binding.freebox.internal.FreeboxDataListener;
import org.openhab.binding.freebox.internal.api.FreeboxException; import org.openhab.binding.freebox.internal.api.FreeboxException;
@ -73,7 +71,7 @@ public class FreeboxDiscoveryService extends AbstractDiscoveryService implements
} }
@Override @Override
public void activate(@Nullable Map<@NonNull String, @Nullable Object> configProperties) { public void activate(Map<String, Object> configProperties) {
super.activate(configProperties); super.activate(configProperties);
applyConfig(configProperties); applyConfig(configProperties);
bridgeHandler.registerDataListener(this); bridgeHandler.registerDataListener(this);

View File

@ -83,7 +83,7 @@ public class Ipx800v3Handler extends BaseThingHandler implements Ipx800EventList
private @NonNullByDefault({}) StatusFileInterpreter statusFile; private @NonNullByDefault({}) StatusFileInterpreter statusFile;
private @Nullable ScheduledFuture<?> refreshJob; private @Nullable ScheduledFuture<?> refreshJob;
private final Map<String, @Nullable PortData> portDatas = new HashMap<>(); private final Map<String, PortData> portDatas = new HashMap<>();
private class LongPressEvaluator implements Runnable { private class LongPressEvaluator implements Runnable {
private final ZonedDateTime referenceTime; private final ZonedDateTime referenceTime;
@ -147,9 +147,7 @@ public class Ipx800v3Handler extends BaseThingHandler implements Ipx800EventList
parser = null; parser = null;
portDatas.values().stream().forEach(portData -> { portDatas.values().stream().forEach(portData -> {
if (portData != null) { portData.destroy();
portData.destroy();
}
}); });
super.dispose(); super.dispose();
} }

View File

@ -104,13 +104,13 @@ public class TrackerDiscoveryService extends AbstractDiscoveryService {
@Override @Override
@Activate @Activate
protected void activate(@Nullable Map<String, @Nullable Object> configProperties) { protected void activate(@Nullable Map<String, Object> configProperties) {
super.activate(configProperties); super.activate(configProperties);
} }
@Override @Override
@Modified @Modified
protected void modified(@Nullable Map<String, @Nullable Object> configProperties) { protected void modified(@Nullable Map<String, Object> configProperties) {
super.modified(configProperties); super.modified(configProperties);
} }

View File

@ -58,8 +58,7 @@ public class GreeDiscoveryService extends AbstractDiscoveryService {
@Activate @Activate
public GreeDiscoveryService(@Reference GreeDeviceFinder deviceFinder, public GreeDiscoveryService(@Reference GreeDeviceFinder deviceFinder,
@Reference NetworkAddressService networkAddressService, @Reference NetworkAddressService networkAddressService,
@Reference GreeTranslationProvider translationProvider, @Reference GreeTranslationProvider translationProvider, @Nullable Map<String, Object> configProperties) {
@Nullable Map<String, @Nullable Object> configProperties) {
super(SUPPORTED_THING_TYPES_UIDS, TIMEOUT_SEC); super(SUPPORTED_THING_TYPES_UIDS, TIMEOUT_SEC);
this.messages = translationProvider; this.messages = translationProvider;
this.deviceFinder = deviceFinder; this.deviceFinder = deviceFinder;
@ -70,7 +69,7 @@ public class GreeDiscoveryService extends AbstractDiscoveryService {
@Override @Override
@Modified @Modified
protected void modified(@Nullable Map<String, @Nullable Object> configProperties) { protected void modified(@Nullable Map<String, Object> configProperties) {
super.modified(configProperties); super.modified(configProperties);
} }

View File

@ -48,7 +48,7 @@ import org.osgi.service.http.HttpService;
@Component(configurationPid = "binding.groheondus", service = ThingHandlerFactory.class) @Component(configurationPid = "binding.groheondus", service = ThingHandlerFactory.class)
public class GroheOndusHandlerFactory extends BaseThingHandlerFactory { public class GroheOndusHandlerFactory extends BaseThingHandlerFactory {
private final Map<ThingUID, @Nullable ServiceRegistration<?>> discoveryServiceRegs = new HashMap<>(); private final Map<ThingUID, ServiceRegistration<?>> discoveryServiceRegs = new HashMap<>();
private HttpService httpService; private HttpService httpService;
private StorageService storageService; private StorageService storageService;

View File

@ -68,7 +68,7 @@ public class HarmonyHubHandlerFactory extends BaseThingHandlerFactory
HarmonyDeviceHandler.SUPPORTED_THING_TYPES_UIDS.stream()) HarmonyDeviceHandler.SUPPORTED_THING_TYPES_UIDS.stream())
.collect(Collectors.toSet()); .collect(Collectors.toSet());
private final Map<ThingUID, @Nullable ServiceRegistration<?>> discoveryServiceRegs = new HashMap<>(); private final Map<ThingUID, ServiceRegistration<?>> discoveryServiceRegs = new HashMap<>();
private final HttpClient httpClient; private final HttpClient httpClient;
private final List<ChannelType> channelTypes = new CopyOnWriteArrayList<>(); private final List<ChannelType> channelTypes = new CopyOnWriteArrayList<>();

View File

@ -79,7 +79,7 @@ public class HueDeviceDiscoveryService extends AbstractDiscoveryService
.flatMap(i -> i).collect(Collectors.toSet())); .flatMap(i -> i).collect(Collectors.toSet()));
// @formatter:off // @formatter:off
private static final Map<String, @Nullable String> TYPE_TO_ZIGBEE_ID_MAP = Map.ofEntries( private static final Map<String, String> TYPE_TO_ZIGBEE_ID_MAP = Map.ofEntries(
new SimpleEntry<>("on_off_light", "0000"), new SimpleEntry<>("on_off_light", "0000"),
new SimpleEntry<>("on_off_plug_in_unit", "0010"), new SimpleEntry<>("on_off_plug_in_unit", "0010"),
new SimpleEntry<>("dimmable_light", "0100"), new SimpleEntry<>("dimmable_light", "0100"),

View File

@ -99,14 +99,14 @@ public class HueBridgeHandler extends ConfigStatusBridgeHandler implements HueCl
private final Logger logger = LoggerFactory.getLogger(HueBridgeHandler.class); private final Logger logger = LoggerFactory.getLogger(HueBridgeHandler.class);
private final HueStateDescriptionOptionProvider stateDescriptionOptionProvider; private final HueStateDescriptionOptionProvider stateDescriptionOptionProvider;
private final Map<String, @Nullable FullLight> lastLightStates = new ConcurrentHashMap<>(); private final Map<String, FullLight> lastLightStates = new ConcurrentHashMap<>();
private final Map<String, @Nullable FullSensor> lastSensorStates = new ConcurrentHashMap<>(); private final Map<String, FullSensor> lastSensorStates = new ConcurrentHashMap<>();
private final Map<String, @Nullable FullGroup> lastGroupStates = new ConcurrentHashMap<>(); private final Map<String, FullGroup> lastGroupStates = new ConcurrentHashMap<>();
private @Nullable HueDeviceDiscoveryService discoveryService; private @Nullable HueDeviceDiscoveryService discoveryService;
private final Map<String, @Nullable LightStatusListener> lightStatusListeners = new ConcurrentHashMap<>(); private final Map<String, LightStatusListener> lightStatusListeners = new ConcurrentHashMap<>();
private final Map<String, @Nullable SensorStatusListener> sensorStatusListeners = new ConcurrentHashMap<>(); private final Map<String, SensorStatusListener> sensorStatusListeners = new ConcurrentHashMap<>();
private final Map<String, @Nullable GroupStatusListener> groupStatusListeners = new ConcurrentHashMap<>(); private final Map<String, GroupStatusListener> groupStatusListeners = new ConcurrentHashMap<>();
final ReentrantLock pollingLock = new ReentrantLock(); final ReentrantLock pollingLock = new ReentrantLock();
@ -182,7 +182,7 @@ public class HueBridgeHandler extends ConfigStatusBridgeHandler implements HueCl
private final Runnable sensorPollingRunnable = new PollingRunnable() { private final Runnable sensorPollingRunnable = new PollingRunnable() {
@Override @Override
protected void doConnectedRun() throws IOException, ApiException { protected void doConnectedRun() throws IOException, ApiException {
Map<String, @Nullable FullSensor> lastSensorStateCopy = new HashMap<>(lastSensorStates); Map<String, FullSensor> lastSensorStateCopy = new HashMap<>(lastSensorStates);
final HueDeviceDiscoveryService discovery = discoveryService; final HueDeviceDiscoveryService discovery = discoveryService;
@ -231,7 +231,7 @@ public class HueBridgeHandler extends ConfigStatusBridgeHandler implements HueCl
} }
private void updateLights() throws IOException, ApiException { private void updateLights() throws IOException, ApiException {
Map<String, @Nullable FullLight> lastLightStateCopy = new HashMap<>(lastLightStates); Map<String, FullLight> lastLightStateCopy = new HashMap<>(lastLightStates);
List<FullLight> lights; List<FullLight> lights;
if (ApiVersionUtils.supportsFullLights(hueBridge.getVersion())) { if (ApiVersionUtils.supportsFullLights(hueBridge.getVersion())) {
@ -279,7 +279,7 @@ public class HueBridgeHandler extends ConfigStatusBridgeHandler implements HueCl
} }
private void updateGroups() throws IOException, ApiException { private void updateGroups() throws IOException, ApiException {
Map<String, @Nullable FullGroup> lastGroupStateCopy = new HashMap<>(lastGroupStates); Map<String, FullGroup> lastGroupStateCopy = new HashMap<>(lastGroupStates);
List<FullGroup> groups = hueBridge.getGroups(); List<FullGroup> groups = hueBridge.getGroups();
@ -379,7 +379,7 @@ public class HueBridgeHandler extends ConfigStatusBridgeHandler implements HueCl
notifyGroupSceneUpdate(scenes); notifyGroupSceneUpdate(scenes);
} }
private void setBridgeSceneChannelStateOptions(List<Scene> scenes, Map<String, @Nullable FullGroup> groups) { private void setBridgeSceneChannelStateOptions(List<Scene> scenes, Map<String, FullGroup> groups) {
Map<String, String> groupNames = groups.entrySet().stream() Map<String, String> groupNames = groups.entrySet().stream()
.collect(Collectors.toMap(Map.Entry::getKey, e -> e.getValue().getName())); .collect(Collectors.toMap(Map.Entry::getKey, e -> e.getValue().getName()));
List<StateOption> stateOptions = scenes.stream().map(scene -> scene.toStateOption(groupNames)) List<StateOption> stateOptions = scenes.stream().map(scene -> scene.toStateOption(groupNames))

View File

@ -44,7 +44,7 @@ import org.osgi.service.component.annotations.Reference;
*/ */
@Component(service = ThingHandlerFactory.class, configurationPid = "binding.icloud") @Component(service = ThingHandlerFactory.class, configurationPid = "binding.icloud")
public class ICloudHandlerFactory extends BaseThingHandlerFactory { public class ICloudHandlerFactory extends BaseThingHandlerFactory {
private final Map<ThingUID, @Nullable ServiceRegistration<?>> discoveryServiceRegistrations = new HashMap<>(); private final Map<ThingUID, ServiceRegistration<?>> discoveryServiceRegistrations = new HashMap<>();
private LocaleProvider localeProvider; private LocaleProvider localeProvider;
private TranslationProvider i18nProvider; private TranslationProvider i18nProvider;

View File

@ -249,8 +249,7 @@ public class InsteonBinding {
handler.updateState(channelUID, state); handler.updateState(channelUID, state);
} }
public InsteonDevice makeNewDevice(InsteonAddress addr, String productKey, public InsteonDevice makeNewDevice(InsteonAddress addr, String productKey, Map<String, Object> deviceConfigMap) {
Map<String, @Nullable Object> deviceConfigMap) {
DeviceType dt = DeviceTypeLoader.instance().getDeviceType(productKey); DeviceType dt = DeviceTypeLoader.instance().getDeviceType(productKey);
InsteonDevice dev = InsteonDevice.makeDevice(dt); InsteonDevice dev = InsteonDevice.makeDevice(dt);
dev.setAddress(addr); dev.setAddress(addr);
@ -296,7 +295,7 @@ public class InsteonBinding {
private int checkIfInModemDatabase(InsteonDevice dev) { private int checkIfInModemDatabase(InsteonDevice dev) {
try { try {
InsteonAddress addr = dev.getAddress(); InsteonAddress addr = dev.getAddress();
Map<InsteonAddress, @Nullable ModemDBEntry> dbes = driver.lockModemDBEntries(); Map<InsteonAddress, ModemDBEntry> dbes = driver.lockModemDBEntries();
if (dbes.containsKey(addr)) { if (dbes.containsKey(addr)) {
if (!dev.hasModemDBEntry()) { if (!dev.hasModemDBEntry()) {
logger.debug("device {} found in the modem database and {}.", addr, getLinkInfo(dbes, addr, true)); logger.debug("device {} found in the modem database and {}.", addr, getLinkInfo(dbes, addr, true));
@ -316,7 +315,7 @@ public class InsteonBinding {
public Map<String, String> getDatabaseInfo() { public Map<String, String> getDatabaseInfo() {
try { try {
Map<String, String> databaseInfo = new HashMap<>(); Map<String, String> databaseInfo = new HashMap<>();
Map<InsteonAddress, @Nullable ModemDBEntry> dbes = driver.lockModemDBEntries(); Map<InsteonAddress, ModemDBEntry> dbes = driver.lockModemDBEntries();
for (InsteonAddress addr : dbes.keySet()) { for (InsteonAddress addr : dbes.keySet()) {
String a = addr.toString(); String a = addr.toString();
databaseInfo.put(a, a + ": " + getLinkInfo(dbes, addr, false)); databaseInfo.put(a, a + ": " + getLinkInfo(dbes, addr, false));
@ -360,7 +359,7 @@ public class InsteonBinding {
return (dev); return (dev);
} }
private String getLinkInfo(Map<InsteonAddress, @Nullable ModemDBEntry> dbes, InsteonAddress a, boolean prefix) { private String getLinkInfo(Map<InsteonAddress, ModemDBEntry> dbes, InsteonAddress a, boolean prefix) {
ModemDBEntry dbe = dbes.get(a); ModemDBEntry dbe = dbes.get(a);
List<Byte> controls = dbe.getControls(); List<Byte> controls = dbe.getControls();
List<Byte> responds = dbe.getRespondsTo(); List<Byte> responds = dbe.getRespondsTo();
@ -454,7 +453,7 @@ public class InsteonBinding {
public void driverCompletelyInitialized() { public void driverCompletelyInitialized() {
List<String> missing = new ArrayList<>(); List<String> missing = new ArrayList<>();
try { try {
Map<InsteonAddress, @Nullable ModemDBEntry> dbes = driver.lockModemDBEntries(); Map<InsteonAddress, ModemDBEntry> dbes = driver.lockModemDBEntries();
logger.debug("modem database has {} entries!", dbes.size()); logger.debug("modem database has {} entries!", dbes.size());
if (dbes.isEmpty()) { if (dbes.isEmpty()) {
logger.warn("the modem link database is empty!"); logger.warn("the modem link database is empty!");

View File

@ -53,8 +53,8 @@ public class InsteonHandlerFactory extends BaseThingHandlerFactory {
private static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Collections private static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Collections
.unmodifiableSet(Stream.of(DEVICE_THING_TYPE, NETWORK_THING_TYPE).collect(Collectors.toSet())); .unmodifiableSet(Stream.of(DEVICE_THING_TYPE, NETWORK_THING_TYPE).collect(Collectors.toSet()));
private final Map<ThingUID, @Nullable ServiceRegistration<?>> discoveryServiceRegs = new HashMap<>(); private final Map<ThingUID, ServiceRegistration<?>> discoveryServiceRegs = new HashMap<>();
private final Map<ThingUID, @Nullable ServiceRegistration<?>> serviceRegs = new HashMap<>(); private final Map<ThingUID, ServiceRegistration<?>> serviceRegs = new HashMap<>();
private @Nullable SerialPortManager serialPortManager; private @Nullable SerialPortManager serialPortManager;

View File

@ -15,7 +15,6 @@ package org.openhab.binding.insteon.internal.config;
import java.util.Map; import java.util.Map;
import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.binding.insteon.internal.device.InsteonAddress; import org.openhab.binding.insteon.internal.device.InsteonAddress;
import org.openhab.core.thing.ChannelUID; import org.openhab.core.thing.ChannelUID;
@ -33,10 +32,10 @@ public class InsteonChannelConfiguration {
private final InsteonAddress address; private final InsteonAddress address;
private final String feature; private final String feature;
private final String productKey; private final String productKey;
private final Map<String, @Nullable String> parameters; private final Map<String, String> parameters;
public InsteonChannelConfiguration(ChannelUID channelUID, String feature, InsteonAddress address, String productKey, public InsteonChannelConfiguration(ChannelUID channelUID, String feature, InsteonAddress address, String productKey,
Map<String, @Nullable String> parameters) { Map<String, String> parameters) {
this.channelUID = channelUID; this.channelUID = channelUID;
this.feature = feature; this.feature = feature;
this.address = address; this.address = address;
@ -66,7 +65,7 @@ public class InsteonChannelConfiguration {
return productKey; return productKey;
} }
public Map<String, @Nullable String> getParameters() { public Map<String, String> getParameters() {
return parameters; return parameters;
} }
} }

View File

@ -49,7 +49,7 @@ public abstract class CommandHandler {
private static final Logger logger = LoggerFactory.getLogger(CommandHandler.class); private static final Logger logger = LoggerFactory.getLogger(CommandHandler.class);
DeviceFeature feature; // related DeviceFeature DeviceFeature feature; // related DeviceFeature
@Nullable @Nullable
Map<String, @Nullable String> parameters = new HashMap<>(); Map<String, String> parameters = new HashMap<>();
/** /**
* Constructor * Constructor
@ -113,7 +113,7 @@ public abstract class CommandHandler {
} }
protected int getMaxLightLevel(InsteonChannelConfiguration conf, int defaultLevel) { protected int getMaxLightLevel(InsteonChannelConfiguration conf, int defaultLevel) {
Map<String, @Nullable String> params = conf.getParameters(); Map<String, String> params = conf.getParameters();
if (conf.getFeature().contains("dimmer") && params.containsKey("dimmermax")) { if (conf.getFeature().contains("dimmer") && params.containsKey("dimmermax")) {
String item = conf.getChannelName(); String item = conf.getChannelName();
String dimmerMax = params.get("dimmermax"); String dimmerMax = params.get("dimmermax");
@ -136,7 +136,7 @@ public abstract class CommandHandler {
return defaultLevel; return defaultLevel;
} }
void setParameters(Map<String, @Nullable String> map) { void setParameters(Map<String, String> map) {
parameters = map; parameters = map;
} }
@ -597,7 +597,7 @@ public abstract class CommandHandler {
} }
@Override @Override
void setParameters(Map<String, @Nullable String> params) { void setParameters(Map<String, String> params) {
super.setParameters(params); super.setParameters(params);
onCmd = (byte) getIntParameter("on", 0x2E); onCmd = (byte) getIntParameter("on", 0x2E);
offCmd = (byte) getIntParameter("off", 0x2F); offCmd = (byte) getIntParameter("off", 0x2F);
@ -877,8 +877,7 @@ public abstract class CommandHandler {
* @return the handler which was created * @return the handler which was created
*/ */
@Nullable @Nullable
public static <T extends CommandHandler> T makeHandler(String name, Map<String, @Nullable String> params, public static <T extends CommandHandler> T makeHandler(String name, Map<String, String> params, DeviceFeature f) {
DeviceFeature f) {
String cname = CommandHandler.class.getName() + "$" + name; String cname = CommandHandler.class.getName() + "$" + name;
try { try {
Class<?> c = Class.forName(cname); Class<?> c = Class.forName(cname);

View File

@ -18,7 +18,6 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.binding.insteon.internal.InsteonBinding; import org.openhab.binding.insteon.internal.InsteonBinding;
import org.openhab.core.library.types.OnOffType; import org.openhab.core.library.types.OnOffType;
import org.openhab.core.library.types.PercentType; import org.openhab.core.library.types.PercentType;
@ -46,8 +45,8 @@ public class DeviceFeatureListener {
private String itemName; private String itemName;
private ChannelUID channelUID; private ChannelUID channelUID;
private Map<String, @Nullable String> parameters = new HashMap<>(); private Map<String, String> parameters = new HashMap<>();
private Map<Class<?>, @Nullable State> state = new HashMap<>(); private Map<Class<?>, State> state = new HashMap<>();
private List<InsteonAddress> relatedDevices = new ArrayList<>(); private List<InsteonAddress> relatedDevices = new ArrayList<>();
private InsteonBinding binding; private InsteonBinding binding;
private static final int TIME_DELAY_POLL_RELATED_MSEC = 5000; private static final int TIME_DELAY_POLL_RELATED_MSEC = 5000;
@ -91,7 +90,7 @@ public class DeviceFeatureListener {
* *
* @param p the parameters to set * @param p the parameters to set
*/ */
public void setParameters(Map<String, @Nullable String> p) { public void setParameters(Map<String, String> p) {
parameters = p; parameters = p;
updateRelatedDevices(); updateRelatedDevices();
} }

View File

@ -24,7 +24,6 @@ import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.ParserConfigurationException;
import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.binding.insteon.internal.utils.Utils; import org.openhab.binding.insteon.internal.utils.Utils;
import org.openhab.binding.insteon.internal.utils.Utils.ParsingException; import org.openhab.binding.insteon.internal.utils.Utils.ParsingException;
import org.openhab.core.library.types.DecimalType; import org.openhab.core.library.types.DecimalType;
@ -111,7 +110,7 @@ public class FeatureTemplateLoader {
} }
NamedNodeMap attributes = e.getAttributes(); NamedNodeMap attributes = e.getAttributes();
Map<String, @Nullable String> params = new HashMap<>(); Map<String, String> params = new HashMap<>();
for (int i = 0; i < attributes.getLength(); i++) { for (int i = 0; i < attributes.getLength(); i++) {
Node n = attributes.item(i); Node n = attributes.item(i);
params.put(n.getNodeName(), n.getNodeValue()); params.put(n.getNodeName(), n.getNodeValue());

View File

@ -15,7 +15,6 @@ package org.openhab.binding.insteon.internal.device;
import java.util.Map; import java.util.Map;
import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
/** /**
* Ugly little helper class to facilitate late instantiation of handlers * Ugly little helper class to facilitate late instantiation of handlers
@ -25,15 +24,15 @@ import org.eclipse.jdt.annotation.Nullable;
*/ */
@NonNullByDefault @NonNullByDefault
public class HandlerEntry { public class HandlerEntry {
Map<String, @Nullable String> params; Map<String, String> params;
String name; String name;
HandlerEntry(String name, Map<String, @Nullable String> params) { HandlerEntry(String name, Map<String, String> params) {
this.name = name; this.name = name;
this.params = params; this.params = params;
} }
Map<String, @Nullable String> getParams() { Map<String, String> getParams() {
return params; return params;
} }

View File

@ -63,7 +63,7 @@ public class InsteonDevice {
private InsteonAddress address = new InsteonAddress(); private InsteonAddress address = new InsteonAddress();
private long pollInterval = -1L; // in milliseconds private long pollInterval = -1L; // in milliseconds
private @Nullable Driver driver = null; private @Nullable Driver driver = null;
private HashMap<String, @Nullable DeviceFeature> features = new HashMap<>(); private Map<String, DeviceFeature> features = new HashMap<>();
private @Nullable String productKey = null; private @Nullable String productKey = null;
private volatile long lastTimePolled = 0L; private volatile long lastTimePolled = 0L;
private volatile long lastMsgReceived = 0L; private volatile long lastMsgReceived = 0L;
@ -73,8 +73,8 @@ public class InsteonDevice {
private long lastQueryTime = 0L; private long lastQueryTime = 0L;
private boolean hasModemDBEntry = false; private boolean hasModemDBEntry = false;
private DeviceStatus status = DeviceStatus.INITIALIZED; private DeviceStatus status = DeviceStatus.INITIALIZED;
private Map<Integer, @Nullable GroupMessageStateMachine> groupState = new HashMap<>(); private Map<Integer, GroupMessageStateMachine> groupState = new HashMap<>();
private Map<String, @Nullable Object> deviceConfigMap = new HashMap<String, @Nullable Object>(); private Map<String, Object> deviceConfigMap = new HashMap<String, Object>();
/** /**
* Constructor * Constructor
@ -121,7 +121,7 @@ public class InsteonDevice {
return features.get(f); return features.get(f);
} }
public HashMap<String, @Nullable DeviceFeature> getFeatures() { public Map<String, DeviceFeature> getFeatures() {
return features; return features;
} }
@ -194,11 +194,11 @@ public class InsteonDevice {
} }
} }
public void setDeviceConfigMap(Map<String, @Nullable Object> deviceConfigMap) { public void setDeviceConfigMap(Map<String, Object> deviceConfigMap) {
this.deviceConfigMap = deviceConfigMap; this.deviceConfigMap = deviceConfigMap;
} }
public Map<String, @Nullable Object> getDeviceConfigMap() { public Map<String, Object> getDeviceConfigMap() {
return deviceConfigMap; return deviceConfigMap;
} }
@ -217,7 +217,7 @@ public class InsteonDevice {
public boolean removeFeatureListener(String aItemName) { public boolean removeFeatureListener(String aItemName) {
boolean removedListener = false; boolean removedListener = false;
synchronized (features) { synchronized (features) {
for (Iterator<Entry<String, @Nullable DeviceFeature>> it = features.entrySet().iterator(); it.hasNext();) { for (Iterator<Entry<String, DeviceFeature>> it = features.entrySet().iterator(); it.hasNext();) {
DeviceFeature f = it.next().getValue(); DeviceFeature f = it.next().getValue();
if (f.removeListener(aItemName)) { if (f.removeListener(aItemName)) {
removedListener = true; removedListener = true;
@ -584,7 +584,7 @@ public class InsteonDevice {
@Override @Override
public String toString() { public String toString() {
String s = address.toString(); String s = address.toString();
for (Entry<String, @Nullable DeviceFeature> f : features.entrySet()) { for (Entry<String, DeviceFeature> f : features.entrySet()) {
s += "|" + f.getKey() + "->" + f.getValue().toString(); s += "|" + f.getKey() + "->" + f.getValue().toString();
} }
return s; return s;

View File

@ -37,7 +37,7 @@ public abstract class MessageDispatcher {
DeviceFeature feature; DeviceFeature feature;
@Nullable @Nullable
Map<String, @Nullable String> parameters = new HashMap<>(); Map<String, String> parameters = new HashMap<>();
/** /**
* Constructor * Constructor
@ -48,7 +48,7 @@ public abstract class MessageDispatcher {
feature = f; feature = f;
} }
public void setParameters(@Nullable Map<String, @Nullable String> map) { public void setParameters(@Nullable Map<String, String> map) {
parameters = map; parameters = map;
} }
@ -397,8 +397,8 @@ public abstract class MessageDispatcher {
* @return the handler which was created * @return the handler which was created
*/ */
@Nullable @Nullable
public static <T extends MessageDispatcher> T makeHandler(String name, public static <T extends MessageDispatcher> T makeHandler(String name, @Nullable Map<String, String> params,
@Nullable Map<String, @Nullable String> params, DeviceFeature f) { DeviceFeature f) {
String cname = MessageDispatcher.class.getName() + "$" + name; String cname = MessageDispatcher.class.getName() + "$" + name;
try { try {
Class<?> c = Class.forName(cname); Class<?> c = Class.forName(cname);

View File

@ -55,7 +55,7 @@ public abstract class MessageHandler {
private static final Logger logger = LoggerFactory.getLogger(MessageHandler.class); private static final Logger logger = LoggerFactory.getLogger(MessageHandler.class);
protected DeviceFeature feature; protected DeviceFeature feature;
protected Map<String, @Nullable String> parameters = new HashMap<>(); protected Map<String, String> parameters = new HashMap<>();
/** /**
* Constructor * Constructor
@ -324,7 +324,7 @@ public abstract class MessageHandler {
* *
* @param map the parameter map for this message handler * @param map the parameter map for this message handler
*/ */
public void setParameters(Map<String, @Nullable String> map) { public void setParameters(Map<String, String> map) {
parameters = map; parameters = map;
} }
@ -457,7 +457,7 @@ public abstract class MessageHandler {
} }
@Override @Override
public void setParameters(Map<String, @Nullable String> params) { public void setParameters(Map<String, String> params) {
super.setParameters(params); super.setParameters(params);
onCmd = getIntParameter("on", 0x2E); onCmd = getIntParameter("on", 0x2E);
offCmd = getIntParameter("off", 0x2F); offCmd = getIntParameter("off", 0x2F);
@ -1342,7 +1342,7 @@ public abstract class MessageHandler {
* @param f the feature for which to create the handler * @param f the feature for which to create the handler
* @return the handler which was created * @return the handler which was created
*/ */
public static @Nullable <T extends MessageHandler> T makeHandler(String name, Map<String, @Nullable String> params, public static @Nullable <T extends MessageHandler> T makeHandler(String name, Map<String, String> params,
DeviceFeature f) { DeviceFeature f) {
String cname = MessageHandler.class.getName() + "$" + name; String cname = MessageHandler.class.getName() + "$" + name;
try { try {

View File

@ -151,8 +151,8 @@ public class ModemDBBuilder implements MsgListener {
private void logModemDB() { private void logModemDB() {
try { try {
logger.debug("MDB ------- start of modem link records ------------------"); logger.debug("MDB ------- start of modem link records ------------------");
Map<InsteonAddress, @Nullable ModemDBEntry> dbes = port.getDriver().lockModemDBEntries(); Map<InsteonAddress, ModemDBEntry> dbes = port.getDriver().lockModemDBEntries();
for (Entry<InsteonAddress, @Nullable ModemDBEntry> db : dbes.entrySet()) { for (Entry<InsteonAddress, ModemDBEntry> db : dbes.entrySet()) {
List<Msg> lrs = db.getValue().getLinkRecords(); List<Msg> lrs = db.getValue().getLinkRecords();
for (Msg m : lrs) { for (Msg m : lrs) {
int recordFlags = m.getByte("RecordFlags") & 0xff; int recordFlags = m.getByte("RecordFlags") & 0xff;
@ -177,7 +177,7 @@ public class ModemDBBuilder implements MsgListener {
public void updateModemDB(InsteonAddress linkAddr, Port port, @Nullable Msg m, boolean isModem) { public void updateModemDB(InsteonAddress linkAddr, Port port, @Nullable Msg m, boolean isModem) {
try { try {
Map<InsteonAddress, @Nullable ModemDBEntry> dbes = port.getDriver().lockModemDBEntries(); Map<InsteonAddress, ModemDBEntry> dbes = port.getDriver().lockModemDBEntries();
ModemDBEntry dbe = dbes.get(linkAddr); ModemDBEntry dbe = dbes.get(linkAddr);
if (dbe == null) { if (dbe == null) {
dbe = new ModemDBEntry(linkAddr, isModem); dbe = new ModemDBEntry(linkAddr, isModem);

View File

@ -37,7 +37,7 @@ import org.slf4j.LoggerFactory;
public abstract class PollHandler { public abstract class PollHandler {
private static final Logger logger = LoggerFactory.getLogger(PollHandler.class); private static final Logger logger = LoggerFactory.getLogger(PollHandler.class);
DeviceFeature feature; DeviceFeature feature;
Map<String, @Nullable String> parameters = new HashMap<>(); Map<String, String> parameters = new HashMap<>();
/** /**
* Constructor * Constructor
@ -57,7 +57,7 @@ public abstract class PollHandler {
*/ */
public abstract @Nullable Msg makeMsg(InsteonDevice device); public abstract @Nullable Msg makeMsg(InsteonDevice device);
public void setParameters(Map<String, @Nullable String> hm) { public void setParameters(Map<String, String> hm) {
parameters = hm; parameters = hm;
} }

View File

@ -13,6 +13,7 @@
package org.openhab.binding.insteon.internal.device; package org.openhab.binding.insteon.internal.device;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map;
import java.util.PriorityQueue; import java.util.PriorityQueue;
import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.NonNullByDefault;
@ -41,7 +42,7 @@ public class RequestQueueManager {
private final Logger logger = LoggerFactory.getLogger(RequestQueueManager.class); private final Logger logger = LoggerFactory.getLogger(RequestQueueManager.class);
private @Nullable Thread queueThread = null; private @Nullable Thread queueThread = null;
private PriorityQueue<RequestQueue> requestQueues = new PriorityQueue<>(); private PriorityQueue<RequestQueue> requestQueues = new PriorityQueue<>();
private HashMap<InsteonDevice, @Nullable RequestQueue> requestQueueHash = new HashMap<>(); private Map<InsteonDevice, RequestQueue> requestQueueHash = new HashMap<>();
private boolean keepRunning = true; private boolean keepRunning = true;
private RequestQueueManager() { private RequestQueueManager() {

View File

@ -13,6 +13,7 @@
package org.openhab.binding.insteon.internal.device; package org.openhab.binding.insteon.internal.device;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.NonNullByDefault;
@ -139,7 +140,7 @@ public class X10 {
return 0xf; return 0xf;
} }
private static @Nullable <T, E> T findKey(HashMap<T, E> map, E value) { private static @Nullable <T, E> T findKey(Map<T, E> map, E value) {
for (Entry<T, E> entry : map.entrySet()) { for (Entry<T, E> entry : map.entrySet()) {
if (value.equals(entry.getValue())) { if (value.equals(entry.getValue())) {
return entry.getKey(); return entry.getKey();
@ -151,11 +152,11 @@ public class X10 {
/** /**
* Map between 4-bit X10 code and the house code. * Map between 4-bit X10 code and the house code.
*/ */
private static HashMap<Integer, @Nullable String> houseCodeToString = new HashMap<>(); private static Map<Integer, String> houseCodeToString = new HashMap<>();
/** /**
* Map between 4-bit X10 code and the unit code. * Map between 4-bit X10 code and the unit code.
*/ */
private static HashMap<Integer, @Nullable Integer> unitCodeToInt = new HashMap<>(); private static Map<Integer, Integer> unitCodeToInt = new HashMap<>();
static { static {
houseCodeToString.put(0x6, "A"); houseCodeToString.put(0x6, "A");

View File

@ -36,7 +36,7 @@ public class Driver {
private Port port; private Port port;
private String portName; private String portName;
private DriverListener listener; private DriverListener listener;
private Map<InsteonAddress, @Nullable ModemDBEntry> modemDBEntries = new HashMap<>(); private Map<InsteonAddress, ModemDBEntry> modemDBEntries = new HashMap<>();
private ReentrantLock modemDBEntriesLock = new ReentrantLock(); private ReentrantLock modemDBEntriesLock = new ReentrantLock();
public Driver(String portName, DriverListener listener, @Nullable SerialPortManager serialPortManager, public Driver(String portName, DriverListener listener, @Nullable SerialPortManager serialPortManager,
@ -51,7 +51,7 @@ public class Driver {
return port.isRunning(); return port.isRunning();
} }
public Map<InsteonAddress, @Nullable ModemDBEntry> lockModemDBEntries() { public Map<InsteonAddress, ModemDBEntry> lockModemDBEntries() {
modemDBEntriesLock.lock(); modemDBEntriesLock.lock();
return modemDBEntries; return modemDBEntries;
} }

View File

@ -152,7 +152,7 @@ public class Port {
*/ */
public void clearModemDB() { public void clearModemDB() {
logger.debug("clearing modem db!"); logger.debug("clearing modem db!");
Map<InsteonAddress, @Nullable ModemDBEntry> dbes = getDriver().lockModemDBEntries(); Map<InsteonAddress, ModemDBEntry> dbes = getDriver().lockModemDBEntries();
for (InsteonAddress addr : dbes.keySet()) { for (InsteonAddress addr : dbes.keySet()) {
if (!dbes.get(addr).isModem()) { if (!dbes.get(addr).isModem()) {
dbes.remove(addr); dbes.remove(addr);

View File

@ -162,7 +162,7 @@ public class InsteonDeviceHandler extends BaseThingHandler {
} }
String deviceConfig = config.getDeviceConfig(); String deviceConfig = config.getDeviceConfig();
Map<String, @Nullable Object> deviceConfigMap; Map<String, Object> deviceConfigMap;
if (deviceConfig != null) { if (deviceConfig != null) {
Type mapType = new TypeToken<Map<String, Object>>() { Type mapType = new TypeToken<Map<String, Object>>() {
}.getType(); }.getType();
@ -368,7 +368,7 @@ public class InsteonDeviceHandler extends BaseThingHandler {
return; return;
} }
Map<String, @Nullable String> params = new HashMap<>(); Map<String, String> params = new HashMap<>();
Channel channel = getThing().getChannel(channelUID.getId()); Channel channel = getThing().getChannel(channelUID.getId());
Map<String, Object> channelProperties = channel.getConfiguration().getProperties(); Map<String, Object> channelProperties = channel.getConfiguration().getProperties();

View File

@ -74,11 +74,11 @@ public class Msg {
} }
// has the structure of all known messages // has the structure of all known messages
private static final Map<String, @Nullable Msg> MSG_MAP = new HashMap<>(); private static final Map<String, Msg> MSG_MAP = new HashMap<>();
// maps between command number and the length of the header // maps between command number and the length of the header
private static final Map<Integer, @Nullable Integer> HEADER_MAP = new HashMap<>(); private static final Map<Integer, Integer> HEADER_MAP = new HashMap<>();
// has templates for all message from modem to host // has templates for all message from modem to host
private static final Map<Integer, @Nullable Msg> REPLY_MAP = new HashMap<>(); private static final Map<Integer, Msg> REPLY_MAP = new HashMap<>();
private int headerLength = -1; private int headerLength = -1;
private byte @Nullable [] data = null; private byte @Nullable [] data = null;

View File

@ -13,6 +13,7 @@
package org.openhab.binding.insteon.internal.message; package org.openhab.binding.insteon.internal.message;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map;
import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable; import org.eclipse.jdt.annotation.Nullable;
@ -28,7 +29,7 @@ import org.eclipse.jdt.annotation.Nullable;
@NonNullByDefault @NonNullByDefault
@SuppressWarnings("null") @SuppressWarnings("null")
public class MsgDefinition { public class MsgDefinition {
private HashMap<String, @Nullable Field> fields = new HashMap<>(); private Map<String, Field> fields = new HashMap<>();
MsgDefinition() { MsgDefinition() {
} }
@ -42,7 +43,7 @@ public class MsgDefinition {
fields = new HashMap<>(m.fields); fields = new HashMap<>(m.fields);
} }
public HashMap<String, @Nullable Field> getFields() { public Map<String, Field> getFields() {
return fields; return fields;
} }

View File

@ -13,9 +13,9 @@
package org.openhab.binding.insteon.internal.message; package org.openhab.binding.insteon.internal.message;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map;
import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
/** /**
* Represents insteon message type flags * Represents insteon message type flags
@ -47,7 +47,7 @@ public enum MsgType {
ALL_LINK_CLEANUP_NACK(0xe0), ALL_LINK_CLEANUP_NACK(0xe0),
INVALID(0xff); // should never happen INVALID(0xff); // should never happen
private static HashMap<Integer, @Nullable MsgType> hash = new HashMap<>(); private static Map<Integer, MsgType> hash = new HashMap<>();
private byte byteValue = 0; private byte byteValue = 0;
@ -73,7 +73,6 @@ public enum MsgType {
public static MsgType fromValue(byte b) throws IllegalArgumentException { public static MsgType fromValue(byte b) throws IllegalArgumentException {
int i = b & 0xe0; int i = b & 0xe0;
@Nullable
MsgType mt = hash.get(i); MsgType mt = hash.get(i);
if (mt == null) { if (mt == null) {
throw new IllegalArgumentException("msg type of byte value " + i + " not found"); throw new IllegalArgumentException("msg type of byte value " + i + " not found");

View File

@ -72,8 +72,8 @@ public class DeviceThingHandler extends AbstractKNXThingHandler {
private final Set<GroupAddress> groupAddresses = new HashSet<>(); private final Set<GroupAddress> groupAddresses = new HashSet<>();
private final Set<GroupAddress> groupAddressesWriteBlockedOnce = new HashSet<>(); private final Set<GroupAddress> groupAddressesWriteBlockedOnce = new HashSet<>();
private final Set<OutboundSpec> groupAddressesRespondingSpec = new HashSet<>(); private final Set<OutboundSpec> groupAddressesRespondingSpec = new HashSet<>();
private final Map<GroupAddress, @Nullable ScheduledFuture<?>> readFutures = new HashMap<>(); private final Map<GroupAddress, ScheduledFuture<?>> readFutures = new HashMap<>();
private final Map<ChannelUID, @Nullable ScheduledFuture<?>> channelFutures = new HashMap<>(); private final Map<ChannelUID, ScheduledFuture<?>> channelFutures = new HashMap<>();
private int readInterval; private int readInterval;
public DeviceThingHandler(Thing thing) { public DeviceThingHandler(Thing thing) {

View File

@ -60,7 +60,7 @@ public class KodiHandlerFactory extends BaseThingHandlerFactory {
private final KodiDynamicStateDescriptionProvider stateDescriptionProvider; private final KodiDynamicStateDescriptionProvider stateDescriptionProvider;
private final WebSocketClient webSocketClient; private final WebSocketClient webSocketClient;
private final Map<String, @Nullable ServiceRegistration<AudioSink>> audioSinkRegistrations = new ConcurrentHashMap<>(); private final Map<String, ServiceRegistration<AudioSink>> audioSinkRegistrations = new ConcurrentHashMap<>();
// url (scheme+server+port) to use for playing notification sounds // url (scheme+server+port) to use for playing notification sounds
private @Nullable String callbackUrl; private @Nullable String callbackUrl;

View File

@ -71,9 +71,9 @@ public class LcnModuleHandler extends BaseThingHandler {
private static final Map<String, Converter> VALUE_CONVERTERS = new HashMap<>(); private static final Map<String, Converter> VALUE_CONVERTERS = new HashMap<>();
private static final InversionConverter INVERSION_CONVERTER = new InversionConverter(); private static final InversionConverter INVERSION_CONVERTER = new InversionConverter();
private @Nullable LcnAddrMod moduleAddress; private @Nullable LcnAddrMod moduleAddress;
private final Map<LcnChannelGroup, @Nullable AbstractLcnModuleSubHandler> subHandlers = new HashMap<>(); private final Map<LcnChannelGroup, AbstractLcnModuleSubHandler> subHandlers = new HashMap<>();
private final List<AbstractLcnModuleSubHandler> metadataSubHandlers = new ArrayList<>(); private final List<AbstractLcnModuleSubHandler> metadataSubHandlers = new ArrayList<>();
private final Map<ChannelUID, @Nullable Converter> converters = new HashMap<>(); private final Map<ChannelUID, Converter> converters = new HashMap<>();
static { static {
VALUE_CONVERTERS.put("temperature", Converters.TEMPERATURE); VALUE_CONVERTERS.put("temperature", Converters.TEMPERATURE);
@ -123,8 +123,9 @@ public class LcnModuleHandler extends BaseThingHandler {
converters.put(channel.getUID(), new S0Converter(parameterObject)); converters.put(channel.getUID(), new S0Converter(parameterObject));
break; break;
default: default:
if (VALUE_CONVERTERS.containsKey(unitObject)) { Converter converter = VALUE_CONVERTERS.get(unitObject);
converters.put(channel.getUID(), VALUE_CONVERTERS.get(unitObject)); if (converter != null) {
converters.put(channel.getUID(), converter);
} }
break; break;
} }

View File

@ -82,7 +82,7 @@ public class ModInfo {
* Variables request status. * Variables request status.
* Lazy initialization: Will be filled once the firmware version is known. * Lazy initialization: Will be filled once the firmware version is known.
*/ */
private final Map<Variable, @Nullable RequestStatus> requestStatusVars = new HashMap<>(); private final Map<Variable, RequestStatus> requestStatusVars = new HashMap<>();
/** /**
* Caches the values of the variables, needed for changing the values. * Caches the values of the variables, needed for changing the values.
@ -291,9 +291,9 @@ public class ModInfo {
} }
} }
// Variables // Variables
for (Map.Entry<Variable, @Nullable RequestStatus> kv : this.requestStatusVars.entrySet()) { for (Map.Entry<Variable, RequestStatus> kv : this.requestStatusVars.entrySet()) {
RequestStatus requestStatus = kv.getValue(); RequestStatus requestStatus = kv.getValue();
if (requestStatus != null && requestStatus.shouldSendNextRequest(timeoutMSec, currTime)) { if (requestStatus.shouldSendNextRequest(timeoutMSec, currTime)) {
// Detect if we can send immediately or if we have to wait for a "typeless" request first // Detect if we can send immediately or if we have to wait for a "typeless" request first
boolean hasTypeInResponse = kv.getKey().hasTypeInResponse(this.firmwareVersion); boolean hasTypeInResponse = kv.getKey().hasTypeInResponse(this.firmwareVersion);
if (hasTypeInResponse || this.lastRequestedVarWithoutTypeInResponse == Variable.UNKNOWN) { if (hasTypeInResponse || this.lastRequestedVarWithoutTypeInResponse == Variable.UNKNOWN) {
@ -351,9 +351,7 @@ public class ModInfo {
// increase poll interval, if the LCN module sends status updates of a variable event-based // increase poll interval, if the LCN module sends status updates of a variable event-based
requestStatusVars.entrySet().stream().filter(e -> e.getKey().isEventBased(firmwareVersion)).forEach(e -> { requestStatusVars.entrySet().stream().filter(e -> e.getKey().isEventBased(firmwareVersion)).forEach(e -> {
RequestStatus value = e.getValue(); RequestStatus value = e.getValue();
if (value != null) { value.setMaxAgeMSec(MAX_STATUS_EVENTBASED_VALUEAGE_MSEC);
value.setMaxAgeMSec(MAX_STATUS_EVENTBASED_VALUEAGE_MSEC);
}
}); });
} }

View File

@ -46,7 +46,7 @@ public class LeapMotionDiscoveryService extends AbstractDiscoveryService {
} }
@Override @Override
protected void activate(@Nullable Map<String, @Nullable Object> configProperties) { protected void activate(@Nullable Map<String, Object> configProperties) {
leapController = new Controller(); leapController = new Controller();
listener = new Listener() { listener = new Listener() {
@Override @Override

View File

@ -42,7 +42,7 @@ import org.slf4j.LoggerFactory;
@NonNullByDefault @NonNullByDefault
public class LauncherApplication extends BaseChannelHandler<AppInfo> { public class LauncherApplication extends BaseChannelHandler<AppInfo> {
private final Logger logger = LoggerFactory.getLogger(LauncherApplication.class); private final Logger logger = LoggerFactory.getLogger(LauncherApplication.class);
private final Map<ThingUID, @Nullable List<AppInfo>> applicationListCache = new HashMap<>(); private final Map<ThingUID, List<AppInfo>> applicationListCache = new HashMap<>();
private final ResponseListener<LaunchSession> launchSessionResponseListener = createResponseListener(); private final ResponseListener<LaunchSession> launchSessionResponseListener = createResponseListener();
@Override @Override

View File

@ -42,7 +42,7 @@ import org.slf4j.LoggerFactory;
@NonNullByDefault @NonNullByDefault
public class TVControlChannel extends BaseChannelHandler<ChannelInfo> { public class TVControlChannel extends BaseChannelHandler<ChannelInfo> {
private final Logger logger = LoggerFactory.getLogger(TVControlChannel.class); private final Logger logger = LoggerFactory.getLogger(TVControlChannel.class);
private final Map<ThingUID, @Nullable List<ChannelInfo>> channelListCache = new HashMap<>(); private final Map<ThingUID, List<ChannelInfo>> channelListCache = new HashMap<>();
private final ResponseListener<CommandConfirmation> objResponseListener = createResponseListener(); private final ResponseListener<CommandConfirmation> objResponseListener = createResponseListener();
@Override @Override

View File

@ -69,7 +69,7 @@ public class LifxLightDiscovery extends AbstractDiscoveryService {
private final Logger logger = LoggerFactory.getLogger(LifxLightDiscovery.class); private final Logger logger = LoggerFactory.getLogger(LifxLightDiscovery.class);
private final Map<MACAddress, @Nullable DiscoveredLight> discoveredLights = new HashMap<>(); private final Map<MACAddress, DiscoveredLight> discoveredLights = new HashMap<>();
private final long sourceId = randomSourceId(); private final long sourceId = randomSourceId();
private final Supplier<Integer> sequenceNumberSupplier = new LifxSequenceNumberSupplier(); private final Supplier<Integer> sequenceNumberSupplier = new LifxSequenceNumberSupplier();
@ -121,13 +121,13 @@ public class LifxLightDiscovery extends AbstractDiscoveryService {
@Activate @Activate
@Override @Override
protected void activate(@Nullable Map<String, @Nullable Object> configProperties) { protected void activate(@Nullable Map<String, Object> configProperties) {
super.activate(configProperties); super.activate(configProperties);
} }
@Modified @Modified
@Override @Override
protected void modified(@Nullable Map<String, @Nullable Object> configProperties) { protected void modified(@Nullable Map<String, Object> configProperties) {
super.modified(configProperties); super.modified(configProperties);
} }
@ -248,9 +248,6 @@ public class LifxLightDiscovery extends AbstractDiscoveryService {
// Iterate through the discovered lights that have to be set up, and the packets that have to be sent // Iterate through the discovered lights that have to be set up, and the packets that have to be sent
// Workaround to avoid a ConcurrentModifictionException on the selector.SelectedKeys() Set // Workaround to avoid a ConcurrentModifictionException on the selector.SelectedKeys() Set
for (DiscoveredLight light : discoveredLights.values()) { for (DiscoveredLight light : discoveredLights.values()) {
if (light == null) {
continue;
}
boolean waitingForLightResponse = System.currentTimeMillis() - light.lastRequestTimeMillis < 200; boolean waitingForLightResponse = System.currentTimeMillis() - light.lastRequestTimeMillis < 200;
if (light.supportedProduct && !light.isDataComplete() && !waitingForLightResponse) { if (light.supportedProduct && !light.isDataComplete() && !waitingForLightResponse) {

View File

@ -85,7 +85,7 @@ public class LifxLightStateChanger implements LifxLightStateListener {
private @Nullable ScheduledFuture<?> sendJob; private @Nullable ScheduledFuture<?> sendJob;
private Map<Integer, @Nullable List<PendingPacket>> pendingPacketsMap = new ConcurrentHashMap<>(); private Map<Integer, List<PendingPacket>> pendingPacketsMap = new ConcurrentHashMap<>();
private class PendingPacket { private class PendingPacket {
@ -230,12 +230,10 @@ public class LifxLightStateChanger implements LifxLightStateListener {
private @Nullable PendingPacket findPacketToSend() { private @Nullable PendingPacket findPacketToSend() {
PendingPacket result = null; PendingPacket result = null;
for (List<PendingPacket> pendingPackets : pendingPacketsMap.values()) { for (List<PendingPacket> pendingPackets : pendingPacketsMap.values()) {
if (pendingPackets != null) { for (PendingPacket pendingPacket : pendingPackets) {
for (PendingPacket pendingPacket : pendingPackets) { if (pendingPacket.hasAcknowledgeIntervalElapsed()
if (pendingPacket.hasAcknowledgeIntervalElapsed() && (result == null || pendingPacket.lastSend < result.lastSend)) {
&& (result == null || pendingPacket.lastSend < result.lastSend)) { result = pendingPacket;
result = pendingPacket;
}
} }
} }
} }
@ -254,15 +252,13 @@ public class LifxLightStateChanger implements LifxLightStateListener {
private void removeFailedPackets() { private void removeFailedPackets() {
for (List<PendingPacket> pendingPackets : pendingPacketsMap.values()) { for (List<PendingPacket> pendingPackets : pendingPacketsMap.values()) {
if (pendingPackets != null) { Iterator<PendingPacket> it = pendingPackets.iterator();
Iterator<PendingPacket> it = pendingPackets.iterator(); while (it.hasNext()) {
while (it.hasNext()) { PendingPacket pendingPacket = it.next();
PendingPacket pendingPacket = it.next(); if (pendingPacket.sendCount > MAX_RETRIES && pendingPacket.hasAcknowledgeIntervalElapsed()) {
if (pendingPacket.sendCount > MAX_RETRIES && pendingPacket.hasAcknowledgeIntervalElapsed()) { logger.warn("{} failed (unacknowledged {} times to light {})",
logger.warn("{} failed (unacknowledged {} times to light {})", pendingPacket.packet.getClass().getSimpleName(), pendingPacket.sendCount, logId);
pendingPacket.packet.getClass().getSimpleName(), pendingPacket.sendCount, logId); it.remove();
it.remove();
}
} }
} }
} }
@ -270,14 +266,12 @@ public class LifxLightStateChanger implements LifxLightStateListener {
private @Nullable PendingPacket removeAcknowledgedPacket(int sequenceNumber) { private @Nullable PendingPacket removeAcknowledgedPacket(int sequenceNumber) {
for (List<PendingPacket> pendingPackets : pendingPacketsMap.values()) { for (List<PendingPacket> pendingPackets : pendingPacketsMap.values()) {
if (pendingPackets != null) { Iterator<PendingPacket> it = pendingPackets.iterator();
Iterator<PendingPacket> it = pendingPackets.iterator(); while (it.hasNext()) {
while (it.hasNext()) { PendingPacket pendingPacket = it.next();
PendingPacket pendingPacket = it.next(); if (pendingPacket.packet.getSequence() == sequenceNumber) {
if (pendingPacket.packet.getSequence() == sequenceNumber) { it.remove();
it.remove(); return pendingPacket;
return pendingPacket;
}
} }
} }
} }

View File

@ -79,7 +79,7 @@ public final class LifxThrottlingUtil {
*/ */
private static List<LifxLightCommunicationTracker> trackers = new CopyOnWriteArrayList<>(); private static List<LifxLightCommunicationTracker> trackers = new CopyOnWriteArrayList<>();
private static Map<MACAddress, @Nullable LifxLightCommunicationTracker> macTrackerMapping = new ConcurrentHashMap<>(); private static Map<MACAddress, LifxLightCommunicationTracker> macTrackerMapping = new ConcurrentHashMap<>();
public static void lock(@Nullable MACAddress mac) { public static void lock(@Nullable MACAddress mac) {
if (mac != null) { if (mac != null) {

View File

@ -131,7 +131,7 @@ public class LutronHandlerFactory extends BaseThingHandlerFactory {
|| HW_DISCOVERABLE_DEVICE_TYPES_UIDS.contains(thingTypeUID); || HW_DISCOVERABLE_DEVICE_TYPES_UIDS.contains(thingTypeUID);
} }
private final Map<ThingUID, @Nullable ServiceRegistration<?>> discoveryServiceRegMap = new HashMap<>(); private final Map<ThingUID, ServiceRegistration<?>> discoveryServiceRegMap = new HashMap<>();
// Marked as Nullable only to fix incorrect redundant null check complaints after adding null annotations // Marked as Nullable only to fix incorrect redundant null check complaints after adding null annotations
@Override @Override

View File

@ -171,7 +171,7 @@ public class LutronMcastBridgeDiscoveryService extends AbstractDiscoveryService
StandardCharsets.US_ASCII); StandardCharsets.US_ASCII);
Matcher matcher = BRIDGE_PROP_PATTERN.matcher(data); Matcher matcher = BRIDGE_PROP_PATTERN.matcher(data);
Map<String, @Nullable String> bridgeProperties = new HashMap<>(); Map<String, String> bridgeProperties = new HashMap<>();
while (matcher.find()) { while (matcher.find()) {
bridgeProperties.put(matcher.group(1), matcher.group(2)); bridgeProperties.put(matcher.group(1), matcher.group(2));

View File

@ -16,6 +16,7 @@ import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map;
import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable; import org.eclipse.jdt.annotation.Nullable;
@ -33,7 +34,7 @@ import org.slf4j.LoggerFactory;
public abstract class KeypadConfig { public abstract class KeypadConfig {
private final Logger logger = LoggerFactory.getLogger(KeypadConfig.class); private final Logger logger = LoggerFactory.getLogger(KeypadConfig.class);
protected final HashMap<String, @Nullable List<KeypadComponent>> modelData = new HashMap<>(); protected final Map<String, List<KeypadComponent>> modelData = new HashMap<>();
public abstract boolean isCCI(int id); public abstract boolean isCCI(int id);

View File

@ -61,7 +61,7 @@ public class MelCloudDiscoveryService extends AbstractDiscoveryService
} }
@Override @Override
protected void activate(Map<String, @Nullable Object> configProperties) { protected void activate(Map<String, Object> configProperties) {
super.activate(configProperties); super.activate(configProperties);
} }
@ -72,7 +72,7 @@ public class MelCloudDiscoveryService extends AbstractDiscoveryService
@Override @Override
@Modified @Modified
protected void modified(Map<String, @Nullable Object> configProperties) { protected void modified(Map<String, Object> configProperties) {
super.modified(configProperties); super.modified(configProperties);
} }

View File

@ -60,7 +60,7 @@ public class MPDHandler extends BaseThingHandler implements MPDEventListener {
private final Logger logger = LoggerFactory.getLogger(MPDHandler.class); private final Logger logger = LoggerFactory.getLogger(MPDHandler.class);
private Map<String, @Nullable State> stateMap = Collections.synchronizedMap(new HashMap<String, @Nullable State>()); private Map<String, State> stateMap = Collections.synchronizedMap(new HashMap<>());
private final MPDConnection connection; private final MPDConnection connection;
private int volume = 0; private int volume = 0;

View File

@ -60,7 +60,7 @@ public class NestHandlerFactory extends BaseThingHandlerFactory {
private final ClientBuilder clientBuilder; private final ClientBuilder clientBuilder;
private final SseEventSourceFactory eventSourceFactory; private final SseEventSourceFactory eventSourceFactory;
private final Map<ThingUID, @Nullable ServiceRegistration<?>> discoveryService = new HashMap<>(); private final Map<ThingUID, ServiceRegistration<?>> discoveryService = new HashMap<>();
@Activate @Activate
public NestHandlerFactory(@Reference ClientBuilder clientBuilder, public NestHandlerFactory(@Reference ClientBuilder clientBuilder,

View File

@ -35,7 +35,7 @@ import org.openhab.binding.nest.internal.listener.NestThingDataListener;
public class NestCompositeUpdateHandler { public class NestCompositeUpdateHandler {
private final Supplier<Set<String>> presentNestIdsSupplier; private final Supplier<Set<String>> presentNestIdsSupplier;
private final Map<Class<?>, @Nullable NestUpdateHandler<?>> updateHandlersMap = new ConcurrentHashMap<>(); private final Map<Class<?>, NestUpdateHandler<?>> updateHandlersMap = new ConcurrentHashMap<>();
public NestCompositeUpdateHandler(Supplier<Set<String>> presentNestIdsSupplier) { public NestCompositeUpdateHandler(Supplier<Set<String>> presentNestIdsSupplier) {
this.presentNestIdsSupplier = presentNestIdsSupplier; this.presentNestIdsSupplier = presentNestIdsSupplier;
@ -104,9 +104,7 @@ public class NestCompositeUpdateHandler {
Set<String> missingNestIds = findMissingNestIds(updates); Set<String> missingNestIds = findMissingNestIds(updates);
if (!missingNestIds.isEmpty()) { if (!missingNestIds.isEmpty()) {
updateHandlersMap.values().forEach(handler -> { updateHandlersMap.values().forEach(handler -> {
if (handler != null) { handler.handleMissingNestIds(missingNestIds);
handler.handleMissingNestIds(missingNestIds);
}
}); });
} }
} }
@ -121,9 +119,7 @@ public class NestCompositeUpdateHandler {
public void resendLastUpdates() { public void resendLastUpdates() {
updateHandlersMap.values().forEach(handler -> { updateHandlersMap.values().forEach(handler -> {
if (handler != null) { handler.resendLastUpdates();
handler.resendLastUpdates();
}
}); });
} }
} }

View File

@ -39,8 +39,8 @@ public class NestUpdateHandler<T> {
*/ */
private static final String ANY_ID = "*"; private static final String ANY_ID = "*";
private final Map<String, @Nullable T> lastUpdates = new ConcurrentHashMap<>(); private final Map<String, T> lastUpdates = new ConcurrentHashMap<>();
private final Map<String, @Nullable Set<NestThingDataListener<T>>> listenersMap = new ConcurrentHashMap<>(); private final Map<String, Set<NestThingDataListener<T>>> listenersMap = new ConcurrentHashMap<>();
public boolean addListener(NestThingDataListener<T> listener) { public boolean addListener(NestThingDataListener<T> listener) {
return addListener(ANY_ID, listener); return addListener(ANY_ID, listener);

View File

@ -68,8 +68,8 @@ import org.slf4j.LoggerFactory;
@Component(service = ThingHandlerFactory.class, configurationPid = "binding.netatmo") @Component(service = ThingHandlerFactory.class, configurationPid = "binding.netatmo")
public class NetatmoHandlerFactory extends BaseThingHandlerFactory { public class NetatmoHandlerFactory extends BaseThingHandlerFactory {
private final Logger logger = LoggerFactory.getLogger(NetatmoHandlerFactory.class); private final Logger logger = LoggerFactory.getLogger(NetatmoHandlerFactory.class);
private final Map<ThingUID, @Nullable ServiceRegistration<?>> discoveryServiceRegs = new HashMap<>(); private final Map<ThingUID, ServiceRegistration<?>> discoveryServiceRegs = new HashMap<>();
private final Map<ThingUID, @Nullable ServiceRegistration<?>> webHookServiceRegs = new HashMap<>(); private final Map<ThingUID, ServiceRegistration<?>> webHookServiceRegs = new HashMap<>();
private final HttpService httpService; private final HttpService httpService;
private final NATherm1StateDescriptionProvider stateDescriptionProvider; private final NATherm1StateDescriptionProvider stateDescriptionProvider;
private final TimeZoneProvider timeZoneProvider; private final TimeZoneProvider timeZoneProvider;
@ -158,7 +158,7 @@ public class NetatmoHandlerFactory extends BaseThingHandlerFactory {
if (bundleContext != null) { if (bundleContext != null) {
NetatmoModuleDiscoveryService discoveryService = new NetatmoModuleDiscoveryService(netatmoBridgeHandler, NetatmoModuleDiscoveryService discoveryService = new NetatmoModuleDiscoveryService(netatmoBridgeHandler,
localeProvider, translationProvider); localeProvider, translationProvider);
Map<String, @Nullable Object> configProperties = new HashMap<>(); Map<String, Object> configProperties = new HashMap<>();
configProperties.put(DiscoveryService.CONFIG_PROPERTY_BACKGROUND_DISCOVERY, configProperties.put(DiscoveryService.CONFIG_PROPERTY_BACKGROUND_DISCOVERY,
Boolean.valueOf(backgroundDiscovery)); Boolean.valueOf(backgroundDiscovery));
discoveryService.activate(configProperties); discoveryService.activate(configProperties);

View File

@ -58,7 +58,7 @@ public class NetatmoModuleDiscoveryService extends AbstractDiscoveryService impl
} }
@Override @Override
public void activate(@Nullable Map<String, @Nullable Object> configProperties) { public void activate(@Nullable Map<String, Object> configProperties) {
super.activate(configProperties); super.activate(configProperties);
netatmoBridgeHandler.registerDataListener(this); netatmoBridgeHandler.registerDataListener(this);
} }

View File

@ -79,14 +79,14 @@ public class NetworkDiscoveryService extends AbstractDiscoveryService implements
@Override @Override
@Activate @Activate
public void activate(@Nullable Map<String, @Nullable Object> config) { public void activate(@Nullable Map<String, Object> config) {
super.activate(config); super.activate(config);
modified(config); modified(config);
} }
@Override @Override
@Modified @Modified
protected void modified(@Nullable Map<String, @Nullable Object> config) { protected void modified(@Nullable Map<String, Object> config) {
super.modified(config); super.modified(config);
// We update instead of replace the configuration object, so that if the user updates the // We update instead of replace the configuration object, so that if the user updates the
// configuration, the values are automatically available in all handlers. Because they all // configuration, the values are automatically available in all handlers. Because they all

View File

@ -64,7 +64,7 @@ public class NUTHandler extends BaseThingHandler {
* Map to cache user configured channels with their configuration. Channels are dynamically created at * Map to cache user configured channels with their configuration. Channels are dynamically created at
* initialization phase of the thing. * initialization phase of the thing.
*/ */
private final Map<ChannelUID, @Nullable NUTDynamicChannelConfiguration> userChannelToNutMap = new HashMap<>(); private final Map<ChannelUID, NUTDynamicChannelConfiguration> userChannelToNutMap = new HashMap<>();
/** /**
* Cache of the UPS status. When expired makes a call to the NUT server is done to get the actual status. Expires at * Cache of the UPS status. When expired makes a call to the NUT server is done to get the actual status. Expires at
* the * the

View File

@ -169,7 +169,7 @@ public abstract class UplinkBaseHandler extends BaseThingHandler implements Nibe
* @param values map containing the data updates * @param values map containing the data updates
*/ */
@Override @Override
public void updateChannelStatus(Map<Channel, @Nullable State> values) { public void updateChannelStatus(Map<Channel, State> values) {
logger.debug("Handling channel update. ({} Channels)", values.size()); logger.debug("Handling channel update. ({} Channels)", values.size());
for (Channel channel : values.keySet()) { for (Channel channel : values.keySet()) {

View File

@ -33,7 +33,6 @@ import com.google.gson.annotations.SerializedName;
public class GenericDataResponse implements DataResponse { public class GenericDataResponse implements DataResponse {
private final Logger logger = LoggerFactory.getLogger(GenericDataResponse.class); private final Logger logger = LoggerFactory.getLogger(GenericDataResponse.class);
@NonNullByDefault
public static class Value { public static class Value {
@SerializedName("VariableId") @SerializedName("VariableId")
private @Nullable String variableId; private @Nullable String variableId;

View File

@ -48,7 +48,7 @@ public class NtpDiscovery extends AbstractDiscoveryService {
@Activate @Activate
public NtpDiscovery(final @Reference LocaleProvider localeProvider, public NtpDiscovery(final @Reference LocaleProvider localeProvider,
final @Reference TranslationProvider i18nProvider, final @Reference TimeZoneProvider timeZoneProvider, final @Reference TranslationProvider i18nProvider, final @Reference TimeZoneProvider timeZoneProvider,
@Nullable Map<String, @Nullable Object> configProperties) throws IllegalArgumentException { @Nullable Map<String, Object> configProperties) throws IllegalArgumentException {
super(SUPPORTED_THING_TYPES_UIDS, 2); super(SUPPORTED_THING_TYPES_UIDS, 2);
this.localeProvider = localeProvider; this.localeProvider = localeProvider;
this.i18nProvider = i18nProvider; this.i18nProvider = i18nProvider;

View File

@ -51,7 +51,7 @@ import org.slf4j.LoggerFactory;
@Component(service = ThingHandlerFactory.class, configurationPid = "binding.onewire") @Component(service = ThingHandlerFactory.class, configurationPid = "binding.onewire")
public class OwHandlerFactory extends BaseThingHandlerFactory { public class OwHandlerFactory extends BaseThingHandlerFactory {
Logger logger = LoggerFactory.getLogger(OwHandlerFactory.class); Logger logger = LoggerFactory.getLogger(OwHandlerFactory.class);
private final Map<ThingUID, @Nullable ServiceRegistration<?>> discoveryServiceRegs = new HashMap<>(); private final Map<ThingUID, ServiceRegistration<?>> discoveryServiceRegs = new HashMap<>();
@NonNullByDefault({}) @NonNullByDefault({})
private OwDynamicStateDescriptionProvider dynamicStateDescriptionProvider; private OwDynamicStateDescriptionProvider dynamicStateDescriptionProvider;

View File

@ -38,7 +38,7 @@ import org.osgi.service.component.annotations.Deactivate;
@Component(service = { DynamicStateDescriptionProvider.class, OnkyoStateDescriptionProvider.class }) @Component(service = { DynamicStateDescriptionProvider.class, OnkyoStateDescriptionProvider.class })
@NonNullByDefault @NonNullByDefault
public class OnkyoStateDescriptionProvider implements DynamicStateDescriptionProvider { public class OnkyoStateDescriptionProvider implements DynamicStateDescriptionProvider {
private final Map<ChannelUID, @Nullable List<StateOption>> channelOptionsMap = new ConcurrentHashMap<>(); private final Map<ChannelUID, List<StateOption>> channelOptionsMap = new ConcurrentHashMap<>();
public void setStateOptions(ChannelUID channelUID, List<StateOption> options) { public void setStateOptions(ChannelUID channelUID, List<StateOption> options) {
channelOptionsMap.put(channelUID, options); channelOptionsMap.put(channelUID, options);

View File

@ -21,7 +21,7 @@ import org.eclipse.jdt.annotation.Nullable;
/** /**
* The {@link GatewayCommand} is used to validate and match commands send through the binding * The {@link GatewayCommand} is used to validate and match commands send through the binding
* to the OpenTherm gateway device. * to the OpenTherm gateway device.
* *
* @author Arjen Korevaar - Initial contribution * @author Arjen Korevaar - Initial contribution
*/ */
@NonNullByDefault @NonNullByDefault

View File

@ -66,7 +66,7 @@ public class OpenWeatherMapDiscoveryService extends AbstractDiscoveryService {
} }
@Override @Override
protected void activate(@Nullable Map<String, @Nullable Object> configProperties) { protected void activate(@Nullable Map<String, Object> configProperties) {
super.activate(configProperties); super.activate(configProperties);
} }

View File

@ -61,7 +61,7 @@ public class OpenWeatherMapHandlerFactory extends BaseThingHandlerFactory {
.unmodifiableSet(Stream.concat(OpenWeatherMapAPIHandler.SUPPORTED_THING_TYPES.stream(), .unmodifiableSet(Stream.concat(OpenWeatherMapAPIHandler.SUPPORTED_THING_TYPES.stream(),
AbstractOpenWeatherMapHandler.SUPPORTED_THING_TYPES.stream()).collect(Collectors.toSet())); AbstractOpenWeatherMapHandler.SUPPORTED_THING_TYPES.stream()).collect(Collectors.toSet()));
private final Map<ThingUID, @Nullable ServiceRegistration<?>> discoveryServiceRegs = new HashMap<>(); private final Map<ThingUID, ServiceRegistration<?>> discoveryServiceRegs = new HashMap<>();
private final HttpClient httpClient; private final HttpClient httpClient;
private final LocaleProvider localeProvider; private final LocaleProvider localeProvider;
private final LocationProvider locationProvider; private final LocationProvider locationProvider;

View File

@ -70,7 +70,7 @@ public class OpenWebNetBridgeHandler extends ConfigStatusBridgeHandler implement
// ConcurrentHashMap of devices registered to this BridgeHandler // ConcurrentHashMap of devices registered to this BridgeHandler
// association is: ownId (String) -> OpenWebNetThingHandler, with ownId = WHO.WHERE // association is: ownId (String) -> OpenWebNetThingHandler, with ownId = WHO.WHERE
private Map<String, @Nullable OpenWebNetThingHandler> registeredDevices = new ConcurrentHashMap<>(); private Map<String, OpenWebNetThingHandler> registeredDevices = new ConcurrentHashMap<>();
protected @Nullable OpenGateway gateway; protected @Nullable OpenGateway gateway;
private boolean isBusGateway = false; private boolean isBusGateway = false;

View File

@ -46,7 +46,7 @@ public class ParadoxAlarmHandlerFactory extends BaseThingHandlerFactory {
private final Logger logger = LoggerFactory.getLogger(ParadoxAlarmHandlerFactory.class); private final Logger logger = LoggerFactory.getLogger(ParadoxAlarmHandlerFactory.class);
private final Map<ThingUID, @Nullable ServiceRegistration<?>> discoveryServiceRegs = new HashMap<>(); private final Map<ThingUID, ServiceRegistration<?>> discoveryServiceRegs = new HashMap<>();
@Override @Override
public boolean supportsThingType(ThingTypeUID thingTypeUID) { public boolean supportsThingType(ThingTypeUID thingTypeUID) {

View File

@ -17,7 +17,6 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.core.thing.ThingTypeUID; import org.openhab.core.thing.ThingTypeUID;
/** /**
@ -82,7 +81,7 @@ public class PLCLogoBindingConstants {
public static final String NI_ANALOG = "NAI"; // Network analog input public static final String NI_ANALOG = "NAI"; // Network analog input
public static final String NQ_ANALOG = "NAQ"; // Network analog output public static final String NQ_ANALOG = "NAQ"; // Network analog output
private static final Map<Integer, @Nullable String> LOGO_STATES_0BA7; private static final Map<Integer, String> LOGO_STATES_0BA7;
static { static {
Map<Integer, String> buffer = new HashMap<>(); Map<Integer, String> buffer = new HashMap<>();
// buffer.put(???, "Network access error"); // Netzwerkzugriffsfehler // buffer.put(???, "Network access error"); // Netzwerkzugriffsfehler
@ -92,7 +91,7 @@ public class PLCLogoBindingConstants {
LOGO_STATES_0BA7 = Collections.unmodifiableMap(buffer); LOGO_STATES_0BA7 = Collections.unmodifiableMap(buffer);
} }
private static final Map<Integer, @Nullable String> LOGO_STATES_0BA8; private static final Map<Integer, String> LOGO_STATES_0BA8;
static { static {
Map<Integer, String> buffer = new HashMap<>(); Map<Integer, String> buffer = new HashMap<>();
buffer.put(1, "Ethernet link error"); // Netzwerk Verbindungsfehler buffer.put(1, "Ethernet link error"); // Netzwerk Verbindungsfehler
@ -104,9 +103,9 @@ public class PLCLogoBindingConstants {
LOGO_STATES_0BA8 = Collections.unmodifiableMap(buffer); LOGO_STATES_0BA8 = Collections.unmodifiableMap(buffer);
} }
public static final Map<String, @Nullable Map<Integer, @Nullable String>> LOGO_STATES; public static final Map<String, Map<Integer, String>> LOGO_STATES;
static { static {
Map<String, @Nullable Map<Integer, @Nullable String>> buffer = new HashMap<>(); Map<String, Map<Integer, String>> buffer = new HashMap<>();
buffer.put(LOGO_0BA7, LOGO_STATES_0BA7); buffer.put(LOGO_0BA7, LOGO_STATES_0BA7);
buffer.put(LOGO_0BA8, LOGO_STATES_0BA8); buffer.put(LOGO_0BA8, LOGO_STATES_0BA8);
LOGO_STATES = Collections.unmodifiableMap(buffer); LOGO_STATES = Collections.unmodifiableMap(buffer);
@ -122,18 +121,18 @@ public class PLCLogoBindingConstants {
} }
} }
public static final Map<String, @Nullable Layout> LOGO_CHANNELS; public static final Map<String, Layout> LOGO_CHANNELS;
static { static {
Map<String, @Nullable Layout> buffer = new HashMap<>(); Map<String, Layout> buffer = new HashMap<>();
buffer.put(DAIGNOSTICS_CHANNEL, new Layout(984, 1)); // Diagnostics starts at 984 for 1 byte buffer.put(DAIGNOSTICS_CHANNEL, new Layout(984, 1)); // Diagnostics starts at 984 for 1 byte
buffer.put(RTC_CHANNEL, new Layout(985, 6)); // RTC starts at 985 for 6 bytes: year month day hour minute second buffer.put(RTC_CHANNEL, new Layout(985, 6)); // RTC starts at 985 for 6 bytes: year month day hour minute second
buffer.put(DAY_OF_WEEK_CHANNEL, new Layout(998, 1)); // Diagnostics starts at 998 for 1 byte buffer.put(DAY_OF_WEEK_CHANNEL, new Layout(998, 1)); // Diagnostics starts at 998 for 1 byte
LOGO_CHANNELS = Collections.unmodifiableMap(buffer); LOGO_CHANNELS = Collections.unmodifiableMap(buffer);
} }
public static final Map<Integer, @Nullable String> DAY_OF_WEEK; public static final Map<Integer, String> DAY_OF_WEEK;
static { static {
Map<Integer, @Nullable String> buffer = new HashMap<>(); Map<Integer, String> buffer = new HashMap<>();
buffer.put(1, "SUNDAY"); buffer.put(1, "SUNDAY");
buffer.put(2, "MONDAY"); buffer.put(2, "MONDAY");
buffer.put(3, "TUEsDAY"); buffer.put(3, "TUEsDAY");
@ -144,9 +143,9 @@ public class PLCLogoBindingConstants {
DAY_OF_WEEK = Collections.unmodifiableMap(buffer); DAY_OF_WEEK = Collections.unmodifiableMap(buffer);
} }
private static final Map<String, @Nullable Layout> LOGO_MEMORY_0BA7; private static final Map<String, Layout> LOGO_MEMORY_0BA7;
static { static {
Map<String, @Nullable Layout> buffer = new HashMap<>(); Map<String, Layout> buffer = new HashMap<>();
buffer.put(MEMORY_BYTE, new Layout(0, 850)); buffer.put(MEMORY_BYTE, new Layout(0, 850));
buffer.put(MEMORY_DWORD, new Layout(0, 850)); buffer.put(MEMORY_DWORD, new Layout(0, 850));
buffer.put(MEMORY_WORD, new Layout(0, 850)); buffer.put(MEMORY_WORD, new Layout(0, 850));
@ -160,9 +159,9 @@ public class PLCLogoBindingConstants {
LOGO_MEMORY_0BA7 = Collections.unmodifiableMap(buffer); LOGO_MEMORY_0BA7 = Collections.unmodifiableMap(buffer);
} }
private static final Map<String, @Nullable Layout> LOGO_MEMORY_0BA8; private static final Map<String, Layout> LOGO_MEMORY_0BA8;
static { static {
Map<String, @Nullable Layout> buffer = new HashMap<>(); Map<String, Layout> buffer = new HashMap<>();
buffer.put(MEMORY_BYTE, new Layout(0, 850)); buffer.put(MEMORY_BYTE, new Layout(0, 850));
buffer.put(MEMORY_DWORD, new Layout(0, 850)); buffer.put(MEMORY_DWORD, new Layout(0, 850));
buffer.put(MEMORY_WORD, new Layout(0, 850)); buffer.put(MEMORY_WORD, new Layout(0, 850));
@ -180,9 +179,9 @@ public class PLCLogoBindingConstants {
LOGO_MEMORY_0BA8 = Collections.unmodifiableMap(buffer); LOGO_MEMORY_0BA8 = Collections.unmodifiableMap(buffer);
} }
public static final Map<String, @Nullable Map<String, @Nullable Layout>> LOGO_MEMORY_BLOCK; public static final Map<String, Map<String, Layout>> LOGO_MEMORY_BLOCK;
static { static {
Map<String, @Nullable Map<String, @Nullable Layout>> buffer = new HashMap<>(); Map<String, Map<String, Layout>> buffer = new HashMap<>();
buffer.put(LOGO_0BA7, LOGO_MEMORY_0BA7); buffer.put(LOGO_0BA7, LOGO_MEMORY_0BA7);
buffer.put(LOGO_0BA8, LOGO_MEMORY_0BA8); buffer.put(LOGO_0BA8, LOGO_MEMORY_0BA8);
LOGO_MEMORY_BLOCK = Collections.unmodifiableMap(buffer); LOGO_MEMORY_BLOCK = Collections.unmodifiableMap(buffer);

View File

@ -22,7 +22,6 @@ import java.util.Set;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.binding.plclogo.internal.PLCLogoClient; import org.openhab.binding.plclogo.internal.PLCLogoClient;
import org.openhab.binding.plclogo.internal.config.PLCAnalogConfiguration; import org.openhab.binding.plclogo.internal.config.PLCAnalogConfiguration;
import org.openhab.core.config.core.Configuration; import org.openhab.core.config.core.Configuration;
@ -59,18 +58,18 @@ public class PLCAnalogHandler extends PLCCommonHandler {
private final Logger logger = LoggerFactory.getLogger(PLCAnalogHandler.class); private final Logger logger = LoggerFactory.getLogger(PLCAnalogHandler.class);
private AtomicReference<PLCAnalogConfiguration> config = new AtomicReference<>(); private AtomicReference<PLCAnalogConfiguration> config = new AtomicReference<>();
private static final Map<String, @Nullable Integer> LOGO_BLOCKS_0BA7; private static final Map<String, Integer> LOGO_BLOCKS_0BA7;
static { static {
Map<String, @Nullable Integer> buffer = new HashMap<>(); Map<String, Integer> buffer = new HashMap<>();
buffer.put(I_ANALOG, 8); // 8 analog inputs buffer.put(I_ANALOG, 8); // 8 analog inputs
buffer.put(Q_ANALOG, 2); // 2 analog outputs buffer.put(Q_ANALOG, 2); // 2 analog outputs
buffer.put(M_ANALOG, 16); // 16 analog markers buffer.put(M_ANALOG, 16); // 16 analog markers
LOGO_BLOCKS_0BA7 = Collections.unmodifiableMap(buffer); LOGO_BLOCKS_0BA7 = Collections.unmodifiableMap(buffer);
} }
private static final Map<String, @Nullable Integer> LOGO_BLOCKS_0BA8; private static final Map<String, Integer> LOGO_BLOCKS_0BA8;
static { static {
Map<String, @Nullable Integer> buffer = new HashMap<>(); Map<String, Integer> buffer = new HashMap<>();
buffer.put(I_ANALOG, 8); // 8 analog inputs buffer.put(I_ANALOG, 8); // 8 analog inputs
buffer.put(Q_ANALOG, 8); // 8 analog outputs buffer.put(Q_ANALOG, 8); // 8 analog outputs
buffer.put(M_ANALOG, 64); // 64 analog markers buffer.put(M_ANALOG, 64); // 64 analog markers
@ -79,9 +78,9 @@ public class PLCAnalogHandler extends PLCCommonHandler {
LOGO_BLOCKS_0BA8 = Collections.unmodifiableMap(buffer); LOGO_BLOCKS_0BA8 = Collections.unmodifiableMap(buffer);
} }
private static final Map<String, @Nullable Map<String, @Nullable Integer>> LOGO_BLOCK_NUMBER; private static final Map<String, Map<String, Integer>> LOGO_BLOCK_NUMBER;
static { static {
Map<String, @Nullable Map<String, @Nullable Integer>> buffer = new HashMap<>(); Map<String, Map<String, Integer>> buffer = new HashMap<>();
buffer.put(LOGO_0BA7, LOGO_BLOCKS_0BA7); buffer.put(LOGO_0BA7, LOGO_BLOCKS_0BA7);
buffer.put(LOGO_0BA8, LOGO_BLOCKS_0BA8); buffer.put(LOGO_0BA8, LOGO_BLOCKS_0BA8);
LOGO_BLOCK_NUMBER = Collections.unmodifiableMap(buffer); LOGO_BLOCK_NUMBER = Collections.unmodifiableMap(buffer);
@ -217,7 +216,7 @@ public class PLCAnalogHandler extends PLCCommonHandler {
String family = getLogoFamily(); String family = getLogoFamily();
logger.debug("Get block number of {} LOGO! for {} blocks.", family, kind); logger.debug("Get block number of {} LOGO! for {} blocks.", family, kind);
Map<?, @Nullable Integer> blocks = LOGO_BLOCK_NUMBER.get(family); Map<?, Integer> blocks = LOGO_BLOCK_NUMBER.get(family);
Integer number = (blocks != null) ? blocks.get(kind) : null; Integer number = (blocks != null) ? blocks.get(kind) : null;
return (number != null) ? number.intValue() : 0; return (number != null) ? number.intValue() : 0;
} }

View File

@ -64,7 +64,7 @@ public class PLCBridgeHandler extends BaseBridgeHandler {
private final Logger logger = LoggerFactory.getLogger(PLCBridgeHandler.class); private final Logger logger = LoggerFactory.getLogger(PLCBridgeHandler.class);
private Map<ChannelUID, @Nullable String> oldValues = new HashMap<>(); private Map<ChannelUID, String> oldValues = new HashMap<>();
@Nullable @Nullable
private volatile PLCLogoClient client; // S7 client used for communication with Logo! private volatile PLCLogoClient client; // S7 client used for communication with Logo!
@ -94,7 +94,7 @@ public class PLCBridgeHandler extends BaseBridgeHandler {
@Override @Override
public void run() { public void run() {
PLCLogoClient localClient = client; PLCLogoClient localClient = client;
Map<?, @Nullable Layout> memory = LOGO_MEMORY_BLOCK.get(getLogoFamily()); Map<?, Layout> memory = LOGO_MEMORY_BLOCK.get(getLogoFamily());
Layout layout = (memory != null) ? memory.get(MEMORY_SIZE) : null; Layout layout = (memory != null) ? memory.get(MEMORY_SIZE) : null;
if ((layout != null) && (localClient != null)) { if ((layout != null) && (localClient != null)) {
try { try {
@ -172,7 +172,7 @@ public class PLCBridgeHandler extends BaseBridgeHandler {
rtc.set(clock); rtc.set(clock);
updateState(channelUID, new DateTimeType(clock)); updateState(channelUID, new DateTimeType(clock));
} else if (DAIGNOSTICS_CHANNEL.equals(channelId)) { } else if (DAIGNOSTICS_CHANNEL.equals(channelId)) {
Map<Integer, @Nullable String> states = LOGO_STATES.get(getLogoFamily()); Map<Integer, String> states = LOGO_STATES.get(getLogoFamily());
if (states != null) { if (states != null) {
for (Integer key : states.keySet()) { for (Integer key : states.keySet()) {
String message = states.get(buffer[0] & key.intValue()); String message = states.get(buffer[0] & key.intValue());

View File

@ -96,7 +96,7 @@ public abstract class PLCCommonHandler extends BaseThingHandler {
String family = getLogoFamily(); String family = getLogoFamily();
logger.debug("Get start address of {} LOGO! for {} blocks.", family, kind); logger.debug("Get start address of {} LOGO! for {} blocks.", family, kind);
Map<?, @Nullable Layout> memory = LOGO_MEMORY_BLOCK.get(family); Map<?, Layout> memory = LOGO_MEMORY_BLOCK.get(family);
Layout layout = (memory != null) ? memory.get(kind) : null; Layout layout = (memory != null) ? memory.get(kind) : null;
return layout != null ? layout.address : INVALID; return layout != null ? layout.address : INVALID;
} }
@ -111,7 +111,7 @@ public abstract class PLCCommonHandler extends BaseThingHandler {
String family = getLogoFamily(); String family = getLogoFamily();
logger.debug("Get data buffer length of {} LOGO! for {} blocks.", family, kind); logger.debug("Get data buffer length of {} LOGO! for {} blocks.", family, kind);
Map<?, @Nullable Layout> memory = LOGO_MEMORY_BLOCK.get(family); Map<?, Layout> memory = LOGO_MEMORY_BLOCK.get(family);
Layout layout = (memory != null) ? memory.get(kind) : null; Layout layout = (memory != null) ? memory.get(kind) : null;
return layout != null ? layout.length : 0; return layout != null ? layout.length : 0;
} }
@ -186,7 +186,7 @@ public abstract class PLCCommonHandler extends BaseThingHandler {
logger.debug("Get base address of {} LOGO! for block {} .", family, name); logger.debug("Get base address of {} LOGO! for block {} .", family, name);
String block = name.split("\\.")[0]; String block = name.split("\\.")[0];
Map<?, @Nullable Layout> memory = LOGO_MEMORY_BLOCK.get(family); Map<?, Layout> memory = LOGO_MEMORY_BLOCK.get(family);
if (isValid(name) && !block.isEmpty() && (memory != null)) { if (isValid(name) && !block.isEmpty() && (memory != null)) {
if (Character.isDigit(block.charAt(1))) { if (Character.isDigit(block.charAt(1))) {
layout = memory.get(block.substring(0, 1)); layout = memory.get(block.substring(0, 1));

View File

@ -22,7 +22,6 @@ import java.util.Set;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.binding.plclogo.internal.PLCLogoClient; import org.openhab.binding.plclogo.internal.PLCLogoClient;
import org.openhab.binding.plclogo.internal.config.PLCDigitalConfiguration; import org.openhab.binding.plclogo.internal.config.PLCDigitalConfiguration;
import org.openhab.core.config.core.Configuration; import org.openhab.core.config.core.Configuration;
@ -61,18 +60,18 @@ public class PLCDigitalHandler extends PLCCommonHandler {
private final Logger logger = LoggerFactory.getLogger(PLCDigitalHandler.class); private final Logger logger = LoggerFactory.getLogger(PLCDigitalHandler.class);
private AtomicReference<PLCDigitalConfiguration> config = new AtomicReference<>(); private AtomicReference<PLCDigitalConfiguration> config = new AtomicReference<>();
private static final Map<String, @Nullable Integer> LOGO_BLOCKS_0BA7; private static final Map<String, Integer> LOGO_BLOCKS_0BA7;
static { static {
Map<String, @Nullable Integer> buffer = new HashMap<>(); Map<String, Integer> buffer = new HashMap<>();
buffer.put(I_DIGITAL, 24); // 24 digital inputs buffer.put(I_DIGITAL, 24); // 24 digital inputs
buffer.put(Q_DIGITAL, 16); // 16 digital outputs buffer.put(Q_DIGITAL, 16); // 16 digital outputs
buffer.put(M_DIGITAL, 27); // 27 digital markers buffer.put(M_DIGITAL, 27); // 27 digital markers
LOGO_BLOCKS_0BA7 = Collections.unmodifiableMap(buffer); LOGO_BLOCKS_0BA7 = Collections.unmodifiableMap(buffer);
} }
private static final Map<String, @Nullable Integer> LOGO_BLOCKS_0BA8; private static final Map<String, Integer> LOGO_BLOCKS_0BA8;
static { static {
Map<String, @Nullable Integer> buffer = new HashMap<>(); Map<String, Integer> buffer = new HashMap<>();
buffer.put(I_DIGITAL, 24); // 24 digital inputs buffer.put(I_DIGITAL, 24); // 24 digital inputs
buffer.put(Q_DIGITAL, 20); // 20 digital outputs buffer.put(Q_DIGITAL, 20); // 20 digital outputs
buffer.put(M_DIGITAL, 64); // 64 digital markers buffer.put(M_DIGITAL, 64); // 64 digital markers
@ -81,9 +80,9 @@ public class PLCDigitalHandler extends PLCCommonHandler {
LOGO_BLOCKS_0BA8 = Collections.unmodifiableMap(buffer); LOGO_BLOCKS_0BA8 = Collections.unmodifiableMap(buffer);
} }
private static final Map<String, @Nullable Map<String, @Nullable Integer>> LOGO_BLOCK_NUMBER; private static final Map<String, Map<String, Integer>> LOGO_BLOCK_NUMBER;
static { static {
Map<String, @Nullable Map<String, @Nullable Integer>> buffer = new HashMap<>(); Map<String, Map<String, Integer>> buffer = new HashMap<>();
buffer.put(LOGO_0BA7, LOGO_BLOCKS_0BA7); buffer.put(LOGO_0BA7, LOGO_BLOCKS_0BA7);
buffer.put(LOGO_0BA8, LOGO_BLOCKS_0BA8); buffer.put(LOGO_0BA8, LOGO_BLOCKS_0BA8);
LOGO_BLOCK_NUMBER = Collections.unmodifiableMap(buffer); LOGO_BLOCK_NUMBER = Collections.unmodifiableMap(buffer);
@ -227,7 +226,7 @@ public class PLCDigitalHandler extends PLCCommonHandler {
String family = getLogoFamily(); String family = getLogoFamily();
logger.debug("Get block number of {} LOGO! for {} blocks.", family, kind); logger.debug("Get block number of {} LOGO! for {} blocks.", family, kind);
Map<?, @Nullable Integer> blocks = LOGO_BLOCK_NUMBER.get(family); Map<?, Integer> blocks = LOGO_BLOCK_NUMBER.get(family);
Integer number = (blocks != null) ? blocks.get(kind) : null; Integer number = (blocks != null) ? blocks.get(kind) : null;
return (number != null) ? number.intValue() : 0; return (number != null) ? number.intValue() : 0;
} }

View File

@ -48,7 +48,7 @@ import org.osgi.service.component.annotations.Reference;
@Component(service = ThingHandlerFactory.class, configurationPid = "binding.plugwise") @Component(service = ThingHandlerFactory.class, configurationPid = "binding.plugwise")
public class PlugwiseHandlerFactory extends BaseThingHandlerFactory { public class PlugwiseHandlerFactory extends BaseThingHandlerFactory {
private final Map<ThingUID, @Nullable ServiceRegistration<?>> discoveryServiceRegistrations = new HashMap<>(); private final Map<ThingUID, ServiceRegistration<?>> discoveryServiceRegistrations = new HashMap<>();
private final SerialPortManager serialPortManager; private final SerialPortManager serialPortManager;

View File

@ -102,7 +102,7 @@ public class PlugwiseThingDiscoveryService extends AbstractDiscoveryService
private @Nullable ScheduledFuture<?> watchJob; private @Nullable ScheduledFuture<?> watchJob;
private CurrentRoleCall currentRoleCall = new CurrentRoleCall(); private CurrentRoleCall currentRoleCall = new CurrentRoleCall();
private final Map<MACAddress, @Nullable DiscoveredNode> discoveredNodes = new ConcurrentHashMap<>(); private final Map<MACAddress, DiscoveredNode> discoveredNodes = new ConcurrentHashMap<>();
public PlugwiseThingDiscoveryService(PlugwiseStickHandler stickHandler) throws IllegalArgumentException { public PlugwiseThingDiscoveryService(PlugwiseStickHandler stickHandler) throws IllegalArgumentException {
super(DISCOVERED_THING_TYPES_UIDS, 1, true); super(DISCOVERED_THING_TYPES_UIDS, 1, true);
@ -309,16 +309,16 @@ public class PlugwiseThingDiscoveryService extends AbstractDiscoveryService
} }
} }
Iterator<Entry<MACAddress, @Nullable DiscoveredNode>> it = discoveredNodes.entrySet().iterator(); Iterator<Entry<MACAddress, DiscoveredNode>> it = discoveredNodes.entrySet().iterator();
while (it.hasNext()) { while (it.hasNext()) {
Entry<MACAddress, @Nullable DiscoveredNode> entry = it.next(); Entry<MACAddress, DiscoveredNode> entry = it.next();
DiscoveredNode node = entry.getValue(); DiscoveredNode node = entry.getValue();
if (node != null && (System.currentTimeMillis() - node.lastRequestMillis) > (MESSAGE_TIMEOUT * 1000) if (System.currentTimeMillis() - node.lastRequestMillis > (MESSAGE_TIMEOUT * 1000)
&& node.attempts < MESSAGE_RETRY_ATTEMPTS) { && node.attempts < MESSAGE_RETRY_ATTEMPTS) {
logger.debug("Resending timed out information request message to node ({})", node.macAddress); logger.debug("Resending timed out information request message to node ({})", node.macAddress);
updateInformation(node.macAddress); updateInformation(node.macAddress);
node.attempts++; node.attempts++;
} else if (node != null && node.attempts >= MESSAGE_RETRY_ATTEMPTS) { } else if (node.attempts >= MESSAGE_RETRY_ATTEMPTS) {
logger.debug("Giving up on information request for node ({})", node.macAddress); logger.debug("Giving up on information request for node ({})", node.macAddress);
it.remove(); it.remove();
} }

View File

@ -49,7 +49,7 @@ import org.osgi.service.component.annotations.Reference;
@Component(service = ThingHandlerFactory.class, configurationPid = "binding.powermax") @Component(service = ThingHandlerFactory.class, configurationPid = "binding.powermax")
public class PowermaxHandlerFactory extends BaseThingHandlerFactory { public class PowermaxHandlerFactory extends BaseThingHandlerFactory {
private final Map<ThingUID, @Nullable ServiceRegistration<?>> discoveryServiceRegs = new HashMap<>(); private final Map<ThingUID, ServiceRegistration<?>> discoveryServiceRegs = new HashMap<>();
private final SerialPortManager serialPortManager; private final SerialPortManager serialPortManager;
private final TimeZoneProvider timeZoneProvider; private final TimeZoneProvider timeZoneProvider;

View File

@ -60,12 +60,12 @@ public class SagerCasterDiscoveryService extends AbstractDiscoveryService {
} }
@Override @Override
protected void activate(@Nullable Map<String, @Nullable Object> configProperties) { protected void activate(@Nullable Map<String, Object> configProperties) {
super.activate(configProperties); super.activate(configProperties);
} }
@Override @Override
protected void modified(@Nullable Map<String, @Nullable Object> configProperties) { protected void modified(@Nullable Map<String, Object> configProperties) {
super.modified(configProperties); super.modified(configProperties);
} }

View File

@ -20,7 +20,6 @@ import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -38,7 +37,7 @@ public class EventDispatcher {
private final Set<SatelEventListener> eventListeners = new CopyOnWriteArraySet<>(); private final Set<SatelEventListener> eventListeners = new CopyOnWriteArraySet<>();
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private final Map<Class<? extends SatelEvent>, @Nullable Method> eventHandlers = Stream private final Map<Class<? extends SatelEvent>, Method> eventHandlers = Stream
.of(SatelEventListener.class.getDeclaredMethods()) .of(SatelEventListener.class.getDeclaredMethods())
.filter(m -> m.getParameterCount() == 1 && SatelEvent.class.isAssignableFrom(m.getParameterTypes()[0])) .filter(m -> m.getParameterCount() == 1 && SatelEvent.class.isAssignableFrom(m.getParameterTypes()[0]))
.collect(Collectors.toMap(m -> (Class<SatelEvent>) m.getParameterTypes()[0], m -> m)); .collect(Collectors.toMap(m -> (Class<SatelEvent>) m.getParameterTypes()[0], m -> m));

View File

@ -70,7 +70,7 @@ public class RdsDataPoints {
* the Map, and b) by pointClass (which we do indirectly "double dereferenced" * the Map, and b) by pointClass (which we do indirectly "double dereferenced"
* via this index * via this index
*/ */
private final Map<String, @Nullable String> indexClassToId = new HashMap<>(); private final Map<String, String> indexClassToId = new HashMap<>();
@SerializedName("totalCount") @SerializedName("totalCount")
private @Nullable String totalCount; private @Nullable String totalCount;
@ -323,11 +323,11 @@ public class RdsDataPoints {
throw new RdsCloudException("existing vs. new point class mismatch"); throw new RdsCloudException("existing vs. new point class mismatch");
} }
myPoint.refreshValueFrom((BasePoint) newPoint); myPoint.refreshValueFrom(newPoint);
if (logger.isDebugEnabled()) { if (logger.isDebugEnabled()) {
logger.debug("refresh {}.{}: {} << {}", getDescription(), myPoint.getPointClass(), logger.debug("refresh {}.{}: {} << {}", getDescription(), myPoint.getPointClass(),
myPoint.getState(), ((BasePoint) newPoint).getState()); myPoint.getState(), newPoint.getState());
} }
} }
} }
@ -349,9 +349,7 @@ public class RdsDataPoints {
if (points != null) { if (points != null) {
indexClassToId.clear(); indexClassToId.clear();
for (Entry<String, @Nullable BasePoint> entry : points.entrySet()) { for (Entry<String, @Nullable BasePoint> entry : points.entrySet()) {
@Nullable
String pointKey = entry.getKey(); String pointKey = entry.getKey();
@Nullable
BasePoint pointValue = entry.getValue(); BasePoint pointValue = entry.getValue();
if (pointValue != null) { if (pointValue != null) {
indexClassToId.put(pointValue.getPointClass(), pointKey); indexClassToId.put(pointValue.getPointClass(), pointKey);

View File

@ -19,7 +19,6 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
/** /**
* The {@link RdsDebouncer} determines if change events should be forwarded to a * The {@link RdsDebouncer} determines if change events should be forwarded to a
@ -30,10 +29,8 @@ import org.eclipse.jdt.annotation.Nullable;
@NonNullByDefault @NonNullByDefault
public class RdsDebouncer { public class RdsDebouncer {
private final Map<String, @Nullable DebounceDelay> channels = new HashMap<>(); private final Map<String, DebounceDelay> channels = new HashMap<>();
@SuppressWarnings("null")
@NonNullByDefault
static class DebounceDelay { static class DebounceDelay {
private long expireTime; private long expireTime;
@ -58,10 +55,9 @@ public class RdsDebouncer {
public Boolean timeExpired(String channelId) { public Boolean timeExpired(String channelId) {
if (channels.containsKey(channelId)) { if (channels.containsKey(channelId)) {
@Nullable
DebounceDelay debounceDelay = channels.get(channelId); DebounceDelay debounceDelay = channels.get(channelId);
if (debounceDelay != null) { if (debounceDelay != null) {
return ((DebounceDelay) debounceDelay).timeExpired(); return debounceDelay.timeExpired();
} }
} }
return true; return true;

View File

@ -47,7 +47,7 @@ public class RdsHandlerFactory extends BaseThingHandlerFactory {
private static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Collections private static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Collections
.unmodifiableSet(new HashSet<>(Arrays.asList(THING_TYPE_CLOUD, THING_TYPE_RDS))); .unmodifiableSet(new HashSet<>(Arrays.asList(THING_TYPE_CLOUD, THING_TYPE_RDS)));
private final Map<ThingUID, @Nullable ServiceRegistration<?>> discos = new HashMap<>(); private final Map<ThingUID, ServiceRegistration<?>> discos = new HashMap<>();
@Override @Override
public boolean supportsThingType(ThingTypeUID thingTypeUID) { public boolean supportsThingType(ThingTypeUID thingTypeUID) {

View File

@ -28,9 +28,9 @@ import org.eclipse.jdt.annotation.Nullable;
@NonNullByDefault @NonNullByDefault
public class Forecast implements Comparable<Forecast> { public class Forecast implements Comparable<Forecast> {
private final ZonedDateTime validTime; private final ZonedDateTime validTime;
private final Map<String, @Nullable BigDecimal> parameters; private final Map<String, BigDecimal> parameters;
public Forecast(ZonedDateTime validTime, Map<String, @Nullable BigDecimal> parameters) { public Forecast(ZonedDateTime validTime, Map<String, BigDecimal> parameters) {
this.validTime = validTime; this.validTime = validTime;
this.parameters = parameters; this.parameters = parameters;
} }
@ -39,7 +39,7 @@ public class Forecast implements Comparable<Forecast> {
return validTime; return validTime;
} }
public Map<String, @Nullable BigDecimal> getParameters() { public Map<String, BigDecimal> getParameters() {
return parameters; return parameters;
} }

Some files were not shown because too many files have changed in this diff Show More