diff --git a/bundles/org.openhab.core.addon.marketplace/src/main/java/org/openhab/core/addon/marketplace/internal/automation/MarketplaceRuleTemplateProvider.java b/bundles/org.openhab.core.addon.marketplace/src/main/java/org/openhab/core/addon/marketplace/internal/automation/MarketplaceRuleTemplateProvider.java index f4d8e6889..efcdc5db8 100644 --- a/bundles/org.openhab.core.addon.marketplace/src/main/java/org/openhab/core/addon/marketplace/internal/automation/MarketplaceRuleTemplateProvider.java +++ b/bundles/org.openhab.core.addon.marketplace/src/main/java/org/openhab/core/addon/marketplace/internal/automation/MarketplaceRuleTemplateProvider.java @@ -137,7 +137,7 @@ public class MarketplaceRuleTemplateProvider extends AbstractManagedProvider((dto.tags != null) ? dto.tags : new HashSet()); + dto.tags = new HashSet<@Nullable String>((dto.tags != null) ? dto.tags : new HashSet<>()); dto.tags.add(uid); RuleTemplate entry = RuleTemplateDTOMapper.map(dto); RuleTemplate template = new RuleTemplate(entry.getUID(), entry.getLabel(), entry.getDescription(), diff --git a/bundles/org.openhab.core.auth.jaas/src/main/java/org/openhab/core/auth/jaas/internal/ManagedUserLoginConfiguration.java b/bundles/org.openhab.core.auth.jaas/src/main/java/org/openhab/core/auth/jaas/internal/ManagedUserLoginConfiguration.java index 520143ff5..2696f7a9b 100644 --- a/bundles/org.openhab.core.auth.jaas/src/main/java/org/openhab/core/auth/jaas/internal/ManagedUserLoginConfiguration.java +++ b/bundles/org.openhab.core.auth.jaas/src/main/java/org/openhab/core/auth/jaas/internal/ManagedUserLoginConfiguration.java @@ -28,6 +28,6 @@ public class ManagedUserLoginConfiguration extends Configuration { @Override public AppConfigurationEntry[] getAppConfigurationEntry(String name) { return new AppConfigurationEntry[] { new AppConfigurationEntry(ManagedUserLoginModule.class.getCanonicalName(), - LoginModuleControlFlag.SUFFICIENT, new HashMap()) }; + LoginModuleControlFlag.SUFFICIENT, new HashMap<>()) }; } } diff --git a/bundles/org.openhab.core.io.transport.modbus/src/main/java/org/openhab/core/io/transport/modbus/internal/ModbusLibraryWrapper.java b/bundles/org.openhab.core.io.transport.modbus/src/main/java/org/openhab/core/io/transport/modbus/internal/ModbusLibraryWrapper.java index b8a155042..e008160f9 100644 --- a/bundles/org.openhab.core.io.transport.modbus/src/main/java/org/openhab/core/io/transport/modbus/internal/ModbusLibraryWrapper.java +++ b/bundles/org.openhab.core.io.transport.modbus/src/main/java/org/openhab/core/io/transport/modbus/internal/ModbusLibraryWrapper.java @@ -190,7 +190,7 @@ public class ModbusLibraryWrapper { */ public static ModbusTransaction createTransactionForEndpoint(ModbusSlaveEndpoint endpoint, ModbusSlaveConnection connection) { - ModbusTransaction transaction = endpoint.accept(new ModbusSlaveEndpointVisitor() { + ModbusTransaction transaction = endpoint.accept(new ModbusSlaveEndpointVisitor<>() { @Override public @NonNull ModbusTransaction visit(ModbusTCPSlaveEndpoint modbusIPSlavePoolingKey) { diff --git a/bundles/org.openhab.core.io.transport.modbus/src/main/java/org/openhab/core/io/transport/modbus/internal/ModbusManagerImpl.java b/bundles/org.openhab.core.io.transport.modbus/src/main/java/org/openhab/core/io/transport/modbus/internal/ModbusManagerImpl.java index 59cdd050f..85d7cfae8 100644 --- a/bundles/org.openhab.core.io.transport.modbus/src/main/java/org/openhab/core/io/transport/modbus/internal/ModbusManagerImpl.java +++ b/bundles/org.openhab.core.io.transport.modbus/src/main/java/org/openhab/core/io/transport/modbus/internal/ModbusManagerImpl.java @@ -488,7 +488,7 @@ public class ModbusManagerImpl implements ModbusManager { try { logger.trace("Calling error response callback {} for request {}. Error was {} {}", callback, request, error.getClass().getName(), error.getMessage()); - callback.handle(new AsyncModbusFailure(request, error)); + callback.handle(new AsyncModbusFailure<>(request, error)); } finally { logger.trace("Called write response callback {} for request {}. Error was {} {}", callback, request, error.getClass().getName(), error.getMessage()); diff --git a/bundles/org.openhab.core.io.transport.modbus/src/test/java/org/openhab/core/io/transport/modbus/test/SmokeTest.java b/bundles/org.openhab.core.io.transport.modbus/src/test/java/org/openhab/core/io/transport/modbus/test/SmokeTest.java index b8336bada..e82036869 100644 --- a/bundles/org.openhab.core.io.transport.modbus/src/test/java/org/openhab/core/io/transport/modbus/test/SmokeTest.java +++ b/bundles/org.openhab.core.io.transport.modbus/src/test/java/org/openhab/core/io/transport/modbus/test/SmokeTest.java @@ -952,7 +952,7 @@ public class SmokeTest extends IntegrationTestSupport { */ private static class SpyingSocketFactory implements SocketImplFactory { - Queue sockets = new ConcurrentLinkedQueue(); + Queue sockets = new ConcurrentLinkedQueue<>(); @Override public SocketImpl createSocketImpl() { diff --git a/bundles/org.openhab.core.karaf/src/main/java/org/openhab/core/karaf/internal/jaas/ManagedUserBackingEngine.java b/bundles/org.openhab.core.karaf/src/main/java/org/openhab/core/karaf/internal/jaas/ManagedUserBackingEngine.java index 4e15e89e7..d05c34fe5 100644 --- a/bundles/org.openhab.core.karaf/src/main/java/org/openhab/core/karaf/internal/jaas/ManagedUserBackingEngine.java +++ b/bundles/org.openhab.core.karaf/src/main/java/org/openhab/core/karaf/internal/jaas/ManagedUserBackingEngine.java @@ -42,7 +42,7 @@ public class ManagedUserBackingEngine implements BackingEngine { @Override public void addUser(String username, String password) { - userRegistry.register(username, password, new HashSet(Set.of(Role.USER))); + userRegistry.register(username, password, new HashSet<>(Set.of(Role.USER))); } @Override diff --git a/bundles/org.openhab.core.model.sitemap/src/org/openhab/core/model/sitemap/valueconverter/SitemapConverters.java b/bundles/org.openhab.core.model.sitemap/src/org/openhab/core/model/sitemap/valueconverter/SitemapConverters.java index 8b50586fc..891978324 100644 --- a/bundles/org.openhab.core.model.sitemap/src/org/openhab/core/model/sitemap/valueconverter/SitemapConverters.java +++ b/bundles/org.openhab.core.model.sitemap/src/org/openhab/core/model/sitemap/valueconverter/SitemapConverters.java @@ -28,7 +28,7 @@ public class SitemapConverters extends DefaultTerminalConverters { @ValueConverter(rule = "Icon") public IValueConverter Icon() { - return new IValueConverter() { + return new IValueConverter<>() { @Override public String toValue(String string, INode node) throws ValueConverterException { @@ -50,7 +50,7 @@ public class SitemapConverters extends DefaultTerminalConverters { @ValueConverter(rule = "Command") public IValueConverter Command() { - return new AbstractNullSafeConverter() { + return new AbstractNullSafeConverter<>() { @Override protected String internalToValue(String string, INode node) { if ((string.startsWith("'") && string.endsWith("'")) diff --git a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/profiles/SystemProfileFactory.java b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/profiles/SystemProfileFactory.java index c5ffdc4b6..fe3fd87e9 100644 --- a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/profiles/SystemProfileFactory.java +++ b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/profiles/SystemProfileFactory.java @@ -106,29 +106,29 @@ public class SystemProfileFactory implements ProfileFactory, ProfileAdvisor, Pro } else if (RANGE.equals(profileTypeUID)) { return new SystemRangeStateProfile(callback, context); } else if (BUTTON_TOGGLE_SWITCH.equals(profileTypeUID)) { - return new ToggleProfile(callback, context, BUTTON_TOGGLE_SWITCH, + return new ToggleProfile<>(callback, context, BUTTON_TOGGLE_SWITCH, DefaultSystemChannelTypeProvider.SYSTEM_BUTTON, OnOffType.ON, OnOffType.OFF, CommonTriggerEvents.SHORT_PRESSED); } else if (BUTTON_TOGGLE_PLAYER.equals(profileTypeUID)) { - return new ToggleProfile(callback, context, BUTTON_TOGGLE_PLAYER, + return new ToggleProfile<>(callback, context, BUTTON_TOGGLE_PLAYER, DefaultSystemChannelTypeProvider.SYSTEM_BUTTON, PlayPauseType.PLAY, PlayPauseType.PAUSE, CommonTriggerEvents.SHORT_PRESSED); } else if (BUTTON_TOGGLE_ROLLERSHUTTER.equals(profileTypeUID)) { - return new ToggleProfile(callback, context, BUTTON_TOGGLE_ROLLERSHUTTER, + return new ToggleProfile<>(callback, context, BUTTON_TOGGLE_ROLLERSHUTTER, DefaultSystemChannelTypeProvider.SYSTEM_BUTTON, UpDownType.UP, UpDownType.DOWN, CommonTriggerEvents.SHORT_PRESSED); } else if (RAWBUTTON_ON_OFF_SWITCH.equals(profileTypeUID)) { return new RawButtonOnOffSwitchProfile(callback); } else if (RAWBUTTON_TOGGLE_SWITCH.equals(profileTypeUID)) { - return new ToggleProfile(callback, context, RAWBUTTON_TOGGLE_SWITCH, + return new ToggleProfile<>(callback, context, RAWBUTTON_TOGGLE_SWITCH, DefaultSystemChannelTypeProvider.SYSTEM_RAWBUTTON, OnOffType.ON, OnOffType.OFF, CommonTriggerEvents.PRESSED); } else if (RAWBUTTON_TOGGLE_PLAYER.equals(profileTypeUID)) { - return new ToggleProfile(callback, context, RAWBUTTON_TOGGLE_PLAYER, + return new ToggleProfile<>(callback, context, RAWBUTTON_TOGGLE_PLAYER, DefaultSystemChannelTypeProvider.SYSTEM_RAWBUTTON, PlayPauseType.PLAY, PlayPauseType.PAUSE, CommonTriggerEvents.PRESSED); } else if (RAWBUTTON_TOGGLE_ROLLERSHUTTER.equals(profileTypeUID)) { - return new ToggleProfile(callback, context, RAWBUTTON_TOGGLE_ROLLERSHUTTER, + return new ToggleProfile<>(callback, context, RAWBUTTON_TOGGLE_ROLLERSHUTTER, DefaultSystemChannelTypeProvider.SYSTEM_RAWBUTTON, UpDownType.UP, UpDownType.DOWN, CommonTriggerEvents.PRESSED); } else if (RAWROCKER_DIMMER.equals(profileTypeUID)) { diff --git a/bundles/org.openhab.core.ui/src/main/java/org/openhab/core/ui/components/RootUIComponent.java b/bundles/org.openhab.core.ui/src/main/java/org/openhab/core/ui/components/RootUIComponent.java index 59665ea74..ac5bde77c 100644 --- a/bundles/org.openhab.core.ui/src/main/java/org/openhab/core/ui/components/RootUIComponent.java +++ b/bundles/org.openhab.core.ui/src/main/java/org/openhab/core/ui/components/RootUIComponent.java @@ -36,7 +36,7 @@ import org.openhab.core.config.core.dto.ConfigDescriptionDTO; public class RootUIComponent extends UIComponent implements Identifiable { String uid; - Set tags = new HashSet(); + Set tags = new HashSet<>(); ConfigDescriptionDTO props; diff --git a/bundles/org.openhab.core.ui/src/main/java/org/openhab/core/ui/components/UIComponent.java b/bundles/org.openhab.core.ui/src/main/java/org/openhab/core/ui/components/UIComponent.java index 8c3aa8636..a0987753c 100644 --- a/bundles/org.openhab.core.ui/src/main/java/org/openhab/core/ui/components/UIComponent.java +++ b/bundles/org.openhab.core.ui/src/main/java/org/openhab/core/ui/components/UIComponent.java @@ -52,7 +52,7 @@ public class UIComponent { public UIComponent(String componentType) { super(); this.component = componentType; - this.config = new HashMap(); + this.config = new HashMap<>(); } /** @@ -136,9 +136,9 @@ public class UIComponent { */ public List addSlot(String slotName) { if (slots == null) { - slots = new HashMap>(); + slots = new HashMap<>(); } - List newSlot = new ArrayList(); + List newSlot = new ArrayList<>(); this.slots.put(slotName, newSlot); return newSlot; diff --git a/bundles/org.openhab.core.voice/src/main/java/org/openhab/core/voice/internal/cache/TTSLRUCacheImpl.java b/bundles/org.openhab.core.voice/src/main/java/org/openhab/core/voice/internal/cache/TTSLRUCacheImpl.java index 96e4d9bc5..0f46dc9a4 100644 --- a/bundles/org.openhab.core.voice/src/main/java/org/openhab/core/voice/internal/cache/TTSLRUCacheImpl.java +++ b/bundles/org.openhab.core.voice/src/main/java/org/openhab/core/voice/internal/cache/TTSLRUCacheImpl.java @@ -122,7 +122,7 @@ public class TTSLRUCacheImpl implements TTSCache { fileAndMetadata = lruMediaCacheLocal.get(key, () -> { try { AudioStream audioInputStream = tts.synthesizeForCache(text, voice, requestedFormat); - return new LRUMediaCacheEntry(key, audioInputStream, + return new LRUMediaCacheEntry<>(key, audioInputStream, new AudioFormatInfo(audioInputStream.getFormat())); } catch (TTSException e) { throw new IllegalStateException(e); diff --git a/bundles/org.openhab.core/src/main/java/org/openhab/core/internal/common/SafeCallerImpl.java b/bundles/org.openhab.core/src/main/java/org/openhab/core/internal/common/SafeCallerImpl.java index 65f09f231..fcc5b4cd2 100644 --- a/bundles/org.openhab.core/src/main/java/org/openhab/core/internal/common/SafeCallerImpl.java +++ b/bundles/org.openhab.core/src/main/java/org/openhab/core/internal/common/SafeCallerImpl.java @@ -63,7 +63,7 @@ public class SafeCallerImpl implements SafeCaller { @Override public SafeCallerBuilder create(T target, Class interfaceType) { - return new SafeCallerBuilderImpl(target, new Class[] { interfaceType }, manager); + return new SafeCallerBuilderImpl<>(target, new Class[] { interfaceType }, manager); } protected ExecutorService getScheduler() { diff --git a/bundles/org.openhab.core/src/main/java/org/openhab/core/internal/service/StateDescriptionServiceImpl.java b/bundles/org.openhab.core/src/main/java/org/openhab/core/internal/service/StateDescriptionServiceImpl.java index 87d5cf9c7..98f881477 100644 --- a/bundles/org.openhab.core/src/main/java/org/openhab/core/internal/service/StateDescriptionServiceImpl.java +++ b/bundles/org.openhab.core/src/main/java/org/openhab/core/internal/service/StateDescriptionServiceImpl.java @@ -40,8 +40,8 @@ import org.osgi.service.component.annotations.ReferencePolicy; @Component public class StateDescriptionServiceImpl implements StateDescriptionService { - private final Set stateDescriptionFragmentProviders = Collections.synchronizedSet( - new TreeSet(new Comparator() { + private final Set stateDescriptionFragmentProviders = Collections + .synchronizedSet(new TreeSet<>(new Comparator<>() { @Override public int compare(StateDescriptionFragmentProvider provider1, StateDescriptionFragmentProvider provider2) { diff --git a/bundles/org.openhab.core/src/main/java/org/openhab/core/library/unit/ImperialUnits.java b/bundles/org.openhab.core/src/main/java/org/openhab/core/library/unit/ImperialUnits.java index c2fde0dcf..cf058b857 100644 --- a/bundles/org.openhab.core/src/main/java/org/openhab/core/library/unit/ImperialUnits.java +++ b/bundles/org.openhab.core/src/main/java/org/openhab/core/library/unit/ImperialUnits.java @@ -92,7 +92,7 @@ public final class ImperialUnits extends CustomUnits { new TransformedUnit<>("gal", CUBIC_INCH, MultiplyConverter.of(231.0))); public static final Unit GALLON_PER_MINUTE = addUnit( - new ProductUnit(GALLON_LIQUID_US.divide(tech.units.indriya.unit.Units.MINUTE))); + new ProductUnit<>(GALLON_LIQUID_US.divide(tech.units.indriya.unit.Units.MINUTE))); /** * Add unit symbols for imperial units. diff --git a/bundles/org.openhab.core/src/main/java/org/openhab/core/library/unit/Units.java b/bundles/org.openhab.core/src/main/java/org/openhab/core/library/unit/Units.java index c49f8bbef..7b723f937 100644 --- a/bundles/org.openhab.core/src/main/java/org/openhab/core/library/unit/Units.java +++ b/bundles/org.openhab.core/src/main/java/org/openhab/core/library/unit/Units.java @@ -95,10 +95,10 @@ public final class Units extends CustomUnits { public static final Unit DEGREE_ANGLE = addUnit(NonSI.DEGREE_ANGLE); public static final Unit RADIAN = addUnit(tech.units.indriya.unit.Units.RADIAN); public static final Unit DOBSON_UNIT = addUnit( - new ProductUnit(MetricPrefix.MILLI(tech.units.indriya.unit.Units.MOLE).multiply(0.4462) + new ProductUnit<>(MetricPrefix.MILLI(tech.units.indriya.unit.Units.MOLE).multiply(0.4462) .divide(tech.units.indriya.unit.Units.SQUARE_METRE))); public static final Unit KATAL = addUnit(tech.units.indriya.unit.Units.KATAL); - public static final Unit KILOGRAM_PER_CUBICMETRE = addUnit(new ProductUnit( + public static final Unit KILOGRAM_PER_CUBICMETRE = addUnit(new ProductUnit<>( tech.units.indriya.unit.Units.KILOGRAM.divide(tech.units.indriya.unit.Units.CUBIC_METRE))); public static final Unit MICROGRAM_PER_CUBICMETRE = addUnit(new TransformedUnit<>(KILOGRAM_PER_CUBICMETRE, MultiplyConverter.ofRational(BigInteger.ONE, BigInteger.valueOf(1000000000)))); @@ -117,8 +117,8 @@ public final class Units extends CustomUnits { tech.units.indriya.unit.Units.COULOMB.multiply(3600)); public static final Unit MILLIAMPERE_HOUR = addUnit(MetricPrefix.MILLI(AMPERE_HOUR)); public static final Unit SIEMENS = addUnit(tech.units.indriya.unit.Units.SIEMENS); - public static final Unit SIEMENS_PER_METRE = addUnit(new ProductUnit( - tech.units.indriya.unit.Units.SIEMENS.divide(tech.units.indriya.unit.Units.METRE))); + public static final Unit SIEMENS_PER_METRE = addUnit( + new ProductUnit<>(tech.units.indriya.unit.Units.SIEMENS.divide(tech.units.indriya.unit.Units.METRE))); public static final Unit HENRY = addUnit(tech.units.indriya.unit.Units.HENRY); public static final Unit VOLT = addUnit(tech.units.indriya.unit.Units.VOLT); public static final Unit OHM = addUnit(tech.units.indriya.unit.Units.OHM); @@ -193,16 +193,16 @@ public final class Units extends CustomUnits { public static final Unit