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:
@@ -499,8 +499,7 @@ public class AccountServlet extends HttpServlet {
|
||||
html.append("<table><tr><th align='left'>Name</th><th align='left'>Value</th></tr>");
|
||||
List<JsonMusicProvider> musicProviders = connection.getMusicProviders();
|
||||
for (JsonMusicProvider musicProvider : musicProviders) {
|
||||
@Nullable
|
||||
List<@Nullable String> properties = musicProvider.supportedProperties;
|
||||
List<String> properties = musicProvider.supportedProperties;
|
||||
String providerId = musicProvider.id;
|
||||
String displayName = musicProvider.displayName;
|
||||
if (properties != null && properties.contains("Alexa.Music.PlaySearchPhrase")
|
||||
@@ -557,7 +556,7 @@ public class AccountServlet extends HttpServlet {
|
||||
}
|
||||
|
||||
if (playLists != null) {
|
||||
Map<String, @Nullable PlayList @Nullable []> playlistMap = playLists.playlists;
|
||||
Map<String, PlayList @Nullable []> playlistMap = playLists.playlists;
|
||||
if (playlistMap != null && !playlistMap.isEmpty()) {
|
||||
html.append("<table><tr><th align='left'>Name</th><th align='left'>Value</th></tr>");
|
||||
|
||||
|
||||
@@ -12,10 +12,7 @@
|
||||
*/
|
||||
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.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 static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@@ -66,7 +63,7 @@ import com.google.gson.Gson;
|
||||
@NonNullByDefault
|
||||
public class AmazonEchoControlHandlerFactory extends BaseThingHandlerFactory {
|
||||
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 HttpService httpService;
|
||||
|
||||
@@ -12,14 +12,7 @@
|
||||
*/
|
||||
package org.openhab.binding.amazonechocontrol.internal;
|
||||
|
||||
import static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.BINDING_ID;
|
||||
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 static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -119,7 +112,7 @@ public class AmazonEchoDynamicStateDescriptionProvider implements DynamicStateDe
|
||||
return null;
|
||||
}
|
||||
|
||||
ArrayList<StateOption> options = new ArrayList<>();
|
||||
List<StateOption> options = new ArrayList<>();
|
||||
options.add(new StateOption("", ""));
|
||||
for (PairedDevice device : pairedDeviceList) {
|
||||
if (device == null) {
|
||||
@@ -144,10 +137,9 @@ public class AmazonEchoDynamicStateDescriptionProvider implements DynamicStateDe
|
||||
return null;
|
||||
}
|
||||
|
||||
ArrayList<StateOption> options = new ArrayList<>();
|
||||
List<StateOption> options = new ArrayList<>();
|
||||
options.add(new StateOption("", ""));
|
||||
@Nullable
|
||||
Map<String, @Nullable PlayList @Nullable []> playlistMap = playLists.playlists;
|
||||
Map<String, PlayList @Nullable []> playlistMap = playLists.playlists;
|
||||
if (playlistMap != null) {
|
||||
for (PlayList[] innerLists : playlistMap.values()) {
|
||||
if (innerLists != null && innerLists.length > 0) {
|
||||
@@ -174,7 +166,7 @@ public class AmazonEchoDynamicStateDescriptionProvider implements DynamicStateDe
|
||||
return null;
|
||||
}
|
||||
|
||||
ArrayList<StateOption> options = new ArrayList<>();
|
||||
List<StateOption> options = new ArrayList<>();
|
||||
options.add(new StateOption("", ""));
|
||||
|
||||
for (JsonNotificationSound notificationSound : notificationSounds) {
|
||||
@@ -202,7 +194,7 @@ public class AmazonEchoDynamicStateDescriptionProvider implements DynamicStateDe
|
||||
return null;
|
||||
}
|
||||
|
||||
ArrayList<StateOption> options = new ArrayList<>();
|
||||
List<StateOption> options = new ArrayList<>();
|
||||
options.add(new StateOption("", ""));
|
||||
for (Device device : devices) {
|
||||
final String value = device.serialNumber;
|
||||
@@ -223,10 +215,9 @@ public class AmazonEchoDynamicStateDescriptionProvider implements DynamicStateDe
|
||||
return null;
|
||||
}
|
||||
|
||||
ArrayList<StateOption> options = new ArrayList<>();
|
||||
List<StateOption> options = new ArrayList<>();
|
||||
for (JsonMusicProvider musicProvider : musicProviders) {
|
||||
@Nullable
|
||||
List<@Nullable String> properties = musicProvider.supportedProperties;
|
||||
List<String> properties = musicProvider.supportedProperties;
|
||||
String providerId = musicProvider.id;
|
||||
String displayName = musicProvider.displayName;
|
||||
if (properties != null && properties.contains("Alexa.Music.PlaySearchPhrase")
|
||||
@@ -252,7 +243,7 @@ public class AmazonEchoDynamicStateDescriptionProvider implements DynamicStateDe
|
||||
return null;
|
||||
}
|
||||
|
||||
ArrayList<StateOption> options = new ArrayList<>();
|
||||
List<StateOption> options = new ArrayList<>();
|
||||
options.addAll(originalStateDescription.getOptions());
|
||||
|
||||
for (FlashBriefingProfileHandler flashBriefing : flashbriefings) {
|
||||
|
||||
@@ -1490,7 +1490,7 @@ public class Connection {
|
||||
JsonArray ttsVolumeNodesToExecute = new JsonArray();
|
||||
for (int i = 0; i < devices.length; 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]);
|
||||
ttsVolumeNodesToExecute
|
||||
.add(createExecutionNode(devices[i], "Alexa.DeviceControls.Volume", volumeParameters));
|
||||
|
||||
@@ -122,7 +122,7 @@ public class AmazonEchoDiscovery extends AbstractDiscoveryService {
|
||||
|
||||
@Override
|
||||
@Activate
|
||||
public void activate(@Nullable Map<String, @Nullable Object> config) {
|
||||
public void activate(@Nullable Map<String, Object> config) {
|
||||
super.activate(config);
|
||||
if (config != null) {
|
||||
modified(config);
|
||||
|
||||
@@ -12,10 +12,7 @@
|
||||
*/
|
||||
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.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 static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.*;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
@@ -63,7 +60,7 @@ public class SmartHomeDevicesDiscovery extends AbstractDiscoveryService {
|
||||
}
|
||||
|
||||
public void activate() {
|
||||
activate(new Hashtable<String, @Nullable Object>());
|
||||
activate(new Hashtable<String, Object>());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -123,7 +120,7 @@ public class SmartHomeDevicesDiscovery extends AbstractDiscoveryService {
|
||||
|
||||
@Override
|
||||
@Activate
|
||||
public void activate(@Nullable Map<String, @Nullable Object> config) {
|
||||
public void activate(@Nullable Map<String, Object> config) {
|
||||
super.activate(config);
|
||||
if (config != null) {
|
||||
modified(config);
|
||||
|
||||
@@ -70,8 +70,8 @@ public class SmartHomeDeviceHandler extends BaseThingHandler {
|
||||
|
||||
private @Nullable SmartHomeBaseDevice smartHomeBaseDevice;
|
||||
private final Gson gson;
|
||||
private final Map<String, @Nullable HandlerBase> handlers = new HashMap<>();
|
||||
private final Map<String, @Nullable JsonArray> lastStates = new HashMap<>();
|
||||
private final Map<String, HandlerBase> handlers = new HashMap<>();
|
||||
private final Map<String, JsonArray> lastStates = new HashMap<>();
|
||||
|
||||
public SmartHomeDeviceHandler(Thing thing, Gson gson) {
|
||||
super(thing);
|
||||
|
||||
@@ -27,7 +27,7 @@ public class JsonAutomation {
|
||||
public @Nullable String automationId;
|
||||
public @Nullable String name;
|
||||
public @Nullable Trigger @Nullable [] triggers;
|
||||
public @Nullable TreeMap<String, @Nullable Object> sequence;
|
||||
public @Nullable TreeMap<String, Object> sequence;
|
||||
public @Nullable String status;
|
||||
public long creationTimeEpochMillis;
|
||||
public long lastUpdatedTimeEpochMillis;
|
||||
|
||||
@@ -25,9 +25,9 @@ import org.eclipse.jdt.annotation.Nullable;
|
||||
@NonNullByDefault
|
||||
public class JsonMusicProvider {
|
||||
public @Nullable String displayName;
|
||||
public @Nullable List<@Nullable Object> @Nullable [] supportedTriggers;
|
||||
public @Nullable List<Object> @Nullable [] supportedTriggers;
|
||||
public @Nullable String icon;
|
||||
public @Nullable List<@Nullable String> supportedProperties;
|
||||
public @Nullable List<String> supportedProperties;
|
||||
public @Nullable String id;
|
||||
public @Nullable String availability;
|
||||
public @Nullable String description;
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.eclipse.jdt.annotation.Nullable;
|
||||
@NonNullByDefault
|
||||
public class JsonPlaylists {
|
||||
|
||||
public @Nullable Map<String, @Nullable PlayList @Nullable []> playlists;
|
||||
public @Nullable Map<String, PlayList @Nullable []> playlists;
|
||||
|
||||
public static class PlayList {
|
||||
public @Nullable String playlistId;
|
||||
|
||||
@@ -18,7 +18,6 @@ import java.util.Set;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
import org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants;
|
||||
import org.openhab.core.thing.type.ChannelTypeUID;
|
||||
|
||||
@@ -27,7 +26,7 @@ import org.openhab.core.thing.type.ChannelTypeUID;
|
||||
*/
|
||||
@NonNullByDefault
|
||||
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 {
|
||||
HANDLER_FACTORY.put(HandlerPowerController.INTERFACE, HandlerPowerController::new);
|
||||
|
||||
Reference in New Issue
Block a user