A session of compile warning hunt (#4472)

Signed-off-by: Gaël L'hopital <gael@lhopital.org>
This commit is contained in:
Gaël L'hopital 2024-12-07 23:13:45 +01:00 committed by GitHub
parent 297d54ed52
commit ed2d1962f5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
38 changed files with 117 additions and 184 deletions

View File

@ -67,6 +67,7 @@ public class ExpiringCache<V> {
* Returns the value - possibly from the cache, if it is still valid. * Returns the value - possibly from the cache, if it is still valid.
*/ */
public synchronized @Nullable V getValue() { public synchronized @Nullable V getValue() {
@Nullable
V cachedValue = value.get(); V cachedValue = value.get();
if (cachedValue == null || isExpired()) { if (cachedValue == null || isExpired()) {
return refreshValue(); return refreshValue();
@ -98,6 +99,7 @@ public class ExpiringCache<V> {
* @return the new value * @return the new value
*/ */
public synchronized @Nullable V refreshValue() { public synchronized @Nullable V refreshValue() {
@Nullable
V freshValue = action.get(); V freshValue = action.get();
value = new SoftReference<>(freshValue); value = new SoftReference<>(freshValue);
expiresAt = calcExpiresAt(); expiresAt = calcExpiresAt();

View File

@ -132,13 +132,11 @@ public class LRUMediaCache<V> {
// 2 clean orphan (part of a pair (file + metadata) without a corresponding partner) // 2 clean orphan (part of a pair (file + metadata) without a corresponding partner)
// 2-a delete a file without its metadata // 2-a delete a file without its metadata
for (Path path : filesInCacheFolder) { for (Path path : filesInCacheFolder) {
if (path != null) { String fileName = path.getFileName().toString();
String fileName = path.getFileName().toString(); // check corresponding metadata in storage
// check corresponding metadata in storage V metadata = storage.get(fileName);
V metadata = storage.get(fileName); if (metadata == null) {
if (metadata == null) { Files.delete(path);
Files.delete(path);
}
} }
} }
// 2-b delete metadata without corresponding file // 2-b delete metadata without corresponding file

View File

@ -22,7 +22,6 @@ import java.util.concurrent.Callable;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executor; import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import java.util.concurrent.RejectedExecutionException; import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.RunnableFuture; import java.util.concurrent.RunnableFuture;
@ -43,7 +42,7 @@ import org.slf4j.LoggerFactory;
/** /**
* A ScheduledExecutorService that will sequentially perform the tasks like a * A ScheduledExecutorService that will sequentially perform the tasks like a
* {@link Executors#newSingleThreadScheduledExecutor} backed by a thread pool. * {@link java.util.concurrent.Executors#newSingleThreadScheduledExecutor} backed by a thread pool.
* This is a drop in replacement to a ScheduledExecutorService with one thread to avoid a lot of threads created, idling * This is a drop in replacement to a ScheduledExecutorService with one thread to avoid a lot of threads created, idling
* most of the time and wasting memory on low-end devices. * most of the time and wasting memory on low-end devices.
* *

View File

@ -15,8 +15,6 @@ package org.openhab.core.common;
import static java.util.concurrent.Executors.defaultThreadFactory; import static java.util.concurrent.Executors.defaultThreadFactory;
import java.lang.Thread.UncaughtExceptionHandler; import java.lang.Thread.UncaughtExceptionHandler;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory; import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
@ -25,10 +23,12 @@ import org.eclipse.jdt.annotation.Nullable;
/** /**
* A builder for {@link ThreadFactory} instances. This builder is intended to be used for creating thread factories to * A builder for {@link ThreadFactory} instances. This builder is intended to be used for creating thread factories to
* be used, e.g., when creating {@link Executor}s via the {@link Executors} utility methods. * be used, e.g., when creating {@link java.util.concurrent.Executor}s via the {@link java.util.concurrent.Executors}
* utility methods.
* <p> * <p>
* The built {@link ThreadFactory} uses a wrapped {@link ThreadFactory} to create threads (defaulting to * The built {@link ThreadFactory} uses a wrapped {@link ThreadFactory} to create threads (defaulting to
* {@link Executors#defaultThreadFactory()}, and then overwrites thread properties as indicated in the build process. * {@link java.util.concurrent.Executors#defaultThreadFactory()}, and then overwrites thread properties as indicated in
* the build process.
* *
* @author Henning Sudbrock - Initial contribution * @author Henning Sudbrock - Initial contribution
*/ */
@ -60,7 +60,7 @@ public class ThreadFactoryBuilder {
/** /**
* Sets the wrapped thread factory used to create threads. * Sets the wrapped thread factory used to create threads.
* <p> * <p>
* If set to null, {@link Executors#defaultThreadFactory()} is used. * If set to null, {@link java.util.concurrent.Executors#defaultThreadFactory()} is used.
* <p> * <p>
* Defaults to null. * Defaults to null.
* *

View File

@ -442,9 +442,9 @@ public abstract class AbstractRegistry<@NonNull E extends Identifiable<K>, @NonN
} }
elementsAdded.forEach(this::notifyListenersAboutAddedElement); elementsAdded.forEach(this::notifyListenersAboutAddedElement);
if (provider instanceof ManagedProvider && providerClazz != null && readyService != null) { if (provider instanceof ManagedProvider && providerClazz instanceof Class clazz
readyService.markReady( && readyService instanceof ReadyService rs) {
new ReadyMarker("managed", providerClazz.getSimpleName().replace("Provider", "").toLowerCase())); rs.markReady(new ReadyMarker("managed", clazz.getSimpleName().replace("Provider", "").toLowerCase()));
} }
logger.debug("Provider \"{}\" has been added.", provider.getClass().getName()); logger.debug("Provider \"{}\" has been added.", provider.getClass().getName());
} }
@ -688,9 +688,9 @@ public abstract class AbstractRegistry<@NonNull E extends Identifiable<K>, @NonN
* @param event the event * @param event the event
*/ */
protected void postEvent(Event event) { protected void postEvent(Event event) {
if (eventPublisher != null) { if (eventPublisher instanceof EventPublisher ep) {
try { try {
eventPublisher.post(event); ep.post(event);
} catch (RuntimeException ex) { } catch (RuntimeException ex) {
logger.error("Cannot post event of type \"{}\".", event.getType(), ex); logger.error("Cannot post event of type \"{}\".", event.getType(), ex);
} }

View File

@ -61,9 +61,9 @@ public abstract class AbstractEvent implements Event {
public int hashCode() { public int hashCode() {
final int prime = 31; final int prime = 31;
int result = 1; int result = 1;
result = prime * result + ((payload == null) ? 0 : payload.hashCode()); result = prime * result + payload.hashCode();
result = prime * result + ((source == null) ? 0 : source.hashCode()); result = prime * result + (source instanceof String local ? local.hashCode() : 0);
result = prime * result + ((topic == null) ? 0 : topic.hashCode()); result = prime * result + topic.hashCode();
return result; return result;
} }
@ -79,11 +79,7 @@ public abstract class AbstractEvent implements Event {
return false; return false;
} }
AbstractEvent other = (AbstractEvent) obj; AbstractEvent other = (AbstractEvent) obj;
if (payload == null) { if (!payload.equals(other.payload)) {
if (other.payload != null) {
return false;
}
} else if (!payload.equals(other.payload)) {
return false; return false;
} }
if (source == null) { if (source == null) {
@ -93,11 +89,7 @@ public abstract class AbstractEvent implements Event {
} else if (!source.equals(other.source)) { } else if (!source.equals(other.source)) {
return false; return false;
} }
if (topic == null) { if (!topic.equals(other.topic)) {
if (other.topic != null) {
return false;
}
} else if (!topic.equals(other.topic)) {
return false; return false;
} }
return true; return true;

View File

@ -19,7 +19,6 @@ import org.eclipse.jdt.annotation.Nullable;
import org.openhab.core.events.AbstractEventFactory; import org.openhab.core.events.AbstractEventFactory;
import org.openhab.core.events.Event; import org.openhab.core.events.Event;
import org.openhab.core.events.EventFactory; import org.openhab.core.events.EventFactory;
import org.openhab.core.types.Type;
import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Component;
/** /**
@ -38,7 +37,7 @@ public class SystemEventFactory extends AbstractEventFactory {
} }
/** /**
* Creates a trigger event from a {@link Type}. * Creates a trigger event from a {@link org.openhab.core.types.Type}.
* *
* @param startlevel Startlevel of system * @param startlevel Startlevel of system
* @return Created start level event. * @return Created start level event.

View File

@ -46,7 +46,7 @@ public class LocalizedKey {
final int prime = 31; final int prime = 31;
int result = 1; int result = 1;
result = prime * result + key.hashCode(); result = prime * result + key.hashCode();
result = prime * result + ((locale != null) ? locale.hashCode() : 0); result = prime * result + (locale instanceof String string ? string.hashCode() : 0);
return result; return result;
} }

View File

@ -48,9 +48,7 @@ public class AuthenticationManagerImpl implements AuthenticationManager {
unmatched = false; unmatched = false;
try { try {
Authentication authentication = provider.authenticate(credentials); Authentication authentication = provider.authenticate(credentials);
if (authentication != null) { return authentication;
return authentication;
}
} catch (AuthenticationException e) { } catch (AuthenticationException e) {
logger.info("Failed to authenticate credentials {} with provider {}", credentials.getClass(), logger.info("Failed to authenticate credentials {} with provider {}", credentials.getClass(),
provider, e); provider, e);

View File

@ -13,17 +13,15 @@
package org.openhab.core.internal.auth; package org.openhab.core.internal.auth;
import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.core.auth.ManagedUser;
import org.openhab.core.auth.User; import org.openhab.core.auth.User;
import org.openhab.core.common.registry.DefaultAbstractManagedProvider; import org.openhab.core.common.registry.DefaultAbstractManagedProvider;
import org.openhab.core.common.registry.ManagedProvider;
import org.openhab.core.storage.StorageService; import org.openhab.core.storage.StorageService;
import org.osgi.service.component.annotations.Activate; import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference; import org.osgi.service.component.annotations.Reference;
/** /**
* A {@link ManagedProvider} for {@link ManagedUser} entities * A {@link org.openhab.core.common.registry.ManagedProvider} for {@link org.openhab.core.auth.ManagedUser} entities
* *
* @author Yannick Schaus - initial contribution * @author Yannick Schaus - initial contribution
*/ */

View File

@ -117,8 +117,8 @@ abstract class AbstractInvocationHandler<T> {
} else { } else {
logger.debug(MSG_TIMEOUT_Q, timeout, toString(invocation.getInvocationStack())); logger.debug(MSG_TIMEOUT_Q, timeout, toString(invocation.getInvocationStack()));
} }
if (timeoutHandler != null) { if (timeoutHandler instanceof Runnable handler) {
timeoutHandler.run(); handler.run();
} }
} }

View File

@ -17,7 +17,6 @@ import java.util.Set;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArraySet; import java.util.concurrent.CopyOnWriteArraySet;
import org.openhab.core.events.Event;
import org.openhab.core.events.EventFactory; import org.openhab.core.events.EventFactory;
import org.openhab.core.events.EventSubscriber; import org.openhab.core.events.EventSubscriber;
import org.osgi.service.component.ComponentContext; import org.osgi.service.component.ComponentContext;
@ -33,8 +32,8 @@ import org.osgi.service.event.EventHandler;
* The {@link OSGiEventManager} provides an OSGi based default implementation of the openHAB event bus. * The {@link OSGiEventManager} provides an OSGi based default implementation of the openHAB event bus.
* *
* The OSGiEventHandler tracks {@link EventSubscriber}s and {@link EventFactory}s, receives OSGi events (by * The OSGiEventHandler tracks {@link EventSubscriber}s and {@link EventFactory}s, receives OSGi events (by
* implementing the OSGi {@link EventHandler} interface) and dispatches the received OSGi events as OH {@link Event}s * implementing the OSGi {@link EventHandler} interface) and dispatches the received OSGi events
* to the {@link EventSubscriber}s if the provided filter applies. * as OH {@link org.openhab.core.events.Event}s to the {@link EventSubscriber}s if the provided filter applies.
* *
* @author Stefan Bußweiler - Initial contribution * @author Stefan Bußweiler - Initial contribution
* @author Markus Rathgeb - Return on received events as fast as possible (handle event in another thread) * @author Markus Rathgeb - Return on received events as fast as possible (handle event in another thread)

View File

@ -22,7 +22,6 @@ import java.util.HashMap;
import java.util.Locale; import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.Objects; import java.util.Objects;
import java.util.ResourceBundle;
import java.util.Set; import java.util.Set;
import javax.measure.Quantity; import javax.measure.Quantity;
@ -100,7 +99,8 @@ import org.slf4j.LoggerFactory;
* and {@link LocationProvider} service interfaces. * and {@link LocationProvider} service interfaces.
* *
* <p> * <p>
* This implementation uses the i18n mechanism of Java ({@link ResourceBundle}) to translate a given key into text. The * This implementation uses the i18n mechanism of Java ({@link java.util.ResourceBundle}) to translate a
* given key into text. The
* resources must be placed under the specific directory {@link LanguageResourceBundleManager#RESOURCE_DIRECTORY} within * resources must be placed under the specific directory {@link LanguageResourceBundleManager#RESOURCE_DIRECTORY} within
* the certain modules. Each module is tracked in the platform by using the {@link ResourceBundleTracker} and managed by * the certain modules. Each module is tracked in the platform by using the {@link ResourceBundleTracker} and managed by
* using one certain {@link LanguageResourceBundleManager} which is responsible for the translation. * using one certain {@link LanguageResourceBundleManager} which is responsible for the translation.
@ -134,7 +134,6 @@ public class I18nProviderImpl
public static final String REGION = "region"; public static final String REGION = "region";
public static final String VARIANT = "variant"; public static final String VARIANT = "variant";
private @Nullable Locale locale; private @Nullable Locale locale;
private @Nullable String currencyCode;
// TranslationProvider // TranslationProvider
private final ResourceBundleTracker resourceBundleTracker; private final ResourceBundleTracker resourceBundleTracker;
@ -301,7 +300,7 @@ public class I18nProviderImpl
if (oldTimeZone != null && this.timeZone == null) { if (oldTimeZone != null && this.timeZone == null) {
logger.info("Time zone is not set, falling back to the default time zone."); logger.info("Time zone is not set, falling back to the default time zone.");
} else if (this.timeZone != null && !this.timeZone.equals(oldTimeZone)) { } else if (this.timeZone instanceof ZoneId zId && !zId.equals(oldTimeZone)) {
logger.info("Time zone set to '{}'.", this.timeZone); logger.info("Time zone set to '{}'.", this.timeZone);
} }
} }

View File

@ -183,9 +183,7 @@ public class LanguageResourceBundleManager {
ResourceBundle resourceBundle = ResourceBundle.getBundle(resourceName, locale, this.resourceClassLoader, ResourceBundle resourceBundle = ResourceBundle.getBundle(resourceName, locale, this.resourceClassLoader,
Control.getNoFallbackControl(Control.FORMAT_PROPERTIES)); Control.getNoFallbackControl(Control.FORMAT_PROPERTIES));
if (resourceBundle != null) { return resourceBundle.getString(key);
return resourceBundle.getString(key);
}
} catch (Exception ex) { } catch (Exception ex) {
// nothing to do // nothing to do
} }

View File

@ -20,7 +20,6 @@ import org.openhab.core.items.Item;
import org.openhab.core.items.ItemBuilder; import org.openhab.core.items.ItemBuilder;
import org.openhab.core.items.ItemBuilderFactory; import org.openhab.core.items.ItemBuilderFactory;
import org.openhab.core.items.ItemFactory; import org.openhab.core.items.ItemFactory;
import org.openhab.core.library.CoreItemFactory;
import org.osgi.service.component.annotations.Activate; import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference; import org.osgi.service.component.annotations.Reference;
@ -28,8 +27,8 @@ import org.osgi.service.component.annotations.ReferenceCardinality;
import org.osgi.service.component.annotations.ReferencePolicy; import org.osgi.service.component.annotations.ReferencePolicy;
/** /**
* Provides an {@link ItemBuilder} with all available {@link ItemFactory}s set. The {@link CoreItemFactory} will always * Provides an {@link ItemBuilder} with all available {@link ItemFactory}s set.
* be present. * The {@link org.openhab.core.library.CoreItemFactory} will always be present.
* *
* @author Henning Treu - Initial contribution * @author Henning Treu - Initial contribution
*/ */

View File

@ -156,28 +156,24 @@ public class ItemRegistryImpl extends AbstractRegistry<Item, String, ItemProvide
private void addToGroupItems(Item item, List<String> groupItemNames) { private void addToGroupItems(Item item, List<String> groupItemNames) {
for (String groupName : groupItemNames) { for (String groupName : groupItemNames) {
if (groupName != null) { try {
try { if (getItem(groupName) instanceof GroupItem groupItem) {
if (getItem(groupName) instanceof GroupItem groupItem) { groupItem.addMember(item);
groupItem.addMember(item);
}
} catch (ItemNotFoundException e) {
// the group might not yet be registered, let's ignore this
} }
} catch (ItemNotFoundException e) {
// the group might not yet be registered, let's ignore this
} }
} }
} }
private void replaceInGroupItems(Item oldItem, Item newItem, List<String> groupItemNames) { private void replaceInGroupItems(Item oldItem, Item newItem, List<String> groupItemNames) {
for (String groupName : groupItemNames) { for (String groupName : groupItemNames) {
if (groupName != null) { try {
try { if (getItem(groupName) instanceof GroupItem groupItem) {
if (getItem(groupName) instanceof GroupItem groupItem) { groupItem.replaceMember(oldItem, newItem);
groupItem.replaceMember(oldItem, newItem);
}
} catch (ItemNotFoundException e) {
// the group might not yet be registered, let's ignore this
} }
} catch (ItemNotFoundException e) {
// the group might not yet be registered, let's ignore this
} }
} }
} }
@ -229,14 +225,12 @@ public class ItemRegistryImpl extends AbstractRegistry<Item, String, ItemProvide
private void removeFromGroupItems(Item item, List<String> groupItemNames) { private void removeFromGroupItems(Item item, List<String> groupItemNames) {
for (String groupName : groupItemNames) { for (String groupName : groupItemNames) {
if (groupName != null) { try {
try { if (getItem(groupName) instanceof GroupItem groupItem) {
if (getItem(groupName) instanceof GroupItem groupItem) { groupItem.removeMember(item);
groupItem.removeMember(item);
}
} catch (ItemNotFoundException e) {
// the group might not yet be registered, let's ignore this
} }
} catch (ItemNotFoundException e) {
// the group might not yet be registered, let's ignore this
} }
} }
} }

View File

@ -125,34 +125,30 @@ public class MetadataStateDescriptionFragmentProvider implements StateDescriptio
private BigDecimal getBigDecimal(Object value) { private BigDecimal getBigDecimal(Object value) {
BigDecimal ret = null; BigDecimal ret = null;
if (value != null) { if (value instanceof BigDecimal decimal) {
if (value instanceof BigDecimal decimal) { ret = decimal;
ret = decimal; } else if (value instanceof String string) {
} else if (value instanceof String string) { ret = new BigDecimal(string);
ret = new BigDecimal(string); } else if (value instanceof BigInteger integer) {
} else if (value instanceof BigInteger integer) { ret = new BigDecimal(integer);
ret = new BigDecimal(integer); } else if (value instanceof Number number) {
} else if (value instanceof Number number) { ret = new BigDecimal(number.doubleValue());
ret = new BigDecimal(number.doubleValue()); } else {
} else { throw new ClassCastException(
throw new ClassCastException("Not possible to coerce [" + value + "] from class " + value.getClass() "Not possible to coerce [" + value + "] from class " + value.getClass() + " into a BigDecimal.");
+ " into a BigDecimal.");
}
} }
return ret; return ret;
} }
private Boolean getBoolean(Object value) { private Boolean getBoolean(Object value) {
Boolean ret = null; Boolean ret = null;
if (value != null) { if (value instanceof Boolean boolean1) {
if (value instanceof Boolean boolean1) { ret = boolean1;
ret = boolean1; } else if (value instanceof String string) {
} else if (value instanceof String string) { ret = Boolean.parseBoolean(string);
ret = Boolean.parseBoolean(string); } else {
} else { throw new ClassCastException(
throw new ClassCastException( "Not possible to coerce [" + value + "] from class " + value.getClass() + " into a Boolean.");
"Not possible to coerce [" + value + "] from class " + value.getClass() + " into a Boolean.");
}
} }
return ret; return ret;
} }

View File

@ -200,7 +200,6 @@ public class SchedulerImpl implements Scheduler {
*/ */
private static class ScheduledCompletableFutureRecurring<T> extends ScheduledCompletableFutureOnce<T> { private static class ScheduledCompletableFutureRecurring<T> extends ScheduledCompletableFutureOnce<T> {
private @Nullable volatile ScheduledCompletableFuture<T> scheduledPromise; private @Nullable volatile ScheduledCompletableFuture<T> scheduledPromise;
private @Nullable String identifier;
public ScheduledCompletableFutureRecurring(@Nullable String identifier, ZonedDateTime scheduledTime) { public ScheduledCompletableFutureRecurring(@Nullable String identifier, ZonedDateTime scheduledTime) {
super(identifier, scheduledTime); super(identifier, scheduledTime);

View File

@ -21,7 +21,6 @@ import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable; import org.eclipse.jdt.annotation.Nullable;
import org.openhab.core.types.StateDescription; import org.openhab.core.types.StateDescription;
import org.openhab.core.types.StateDescriptionFragment; import org.openhab.core.types.StateDescriptionFragment;
import org.openhab.core.types.StateDescriptionFragmentBuilder;
import org.openhab.core.types.StateOption; import org.openhab.core.types.StateOption;
/** /**
@ -62,7 +61,7 @@ public class StateDescriptionFragmentImpl implements StateDescriptionFragment {
* @param pattern pattern to render the state * @param pattern pattern to render the state
* @param readOnly if the state can be changed by the system * @param readOnly if the state can be changed by the system
* @param options predefined list of options * @param options predefined list of options
* @deprecated use {@link StateDescriptionFragmentBuilder} instead. * @deprecated use {@link org.openhab.core.types.StateDescriptionFragmentBuilder} instead.
*/ */
@Deprecated @Deprecated
public StateDescriptionFragmentImpl(@Nullable BigDecimal minimum, @Nullable BigDecimal maximum, public StateDescriptionFragmentImpl(@Nullable BigDecimal minimum, @Nullable BigDecimal maximum,
@ -81,7 +80,7 @@ public class StateDescriptionFragmentImpl implements StateDescriptionFragment {
* Note: State options will only be set if not empty. * Note: State options will only be set if not empty.
* *
* @param legacy the {@link StateDescription} to initialize from. * @param legacy the {@link StateDescription} to initialize from.
* @deprecated use {@link StateDescriptionFragmentBuilder} instead. * @deprecated use {@link org.openhab.core.types.StateDescriptionFragmentBuilder} instead.
*/ */
@Deprecated @Deprecated
public StateDescriptionFragmentImpl(StateDescription legacy) { public StateDescriptionFragmentImpl(StateDescription legacy) {

View File

@ -294,7 +294,7 @@ public abstract class GenericItem implements ActiveItem {
Set<StateChangeListener> clonedListeners = new CopyOnWriteArraySet<>(listeners); Set<StateChangeListener> clonedListeners = new CopyOnWriteArraySet<>(listeners);
ExecutorService pool = ThreadPoolManager.getPool(ITEM_THREADPOOLNAME); ExecutorService pool = ThreadPoolManager.getPool(ITEM_THREADPOOLNAME);
try { try {
final boolean stateChanged = newState != null && !newState.equals(oldState); final boolean stateChanged = !newState.equals(oldState);
clonedListeners.forEach(listener -> pool.execute(() -> { clonedListeners.forEach(listener -> pool.execute(() -> {
try { try {
listener.stateUpdated(GenericItem.this, newState); listener.stateUpdated(GenericItem.this, newState);
@ -372,7 +372,7 @@ public abstract class GenericItem implements ActiveItem {
public int hashCode() { public int hashCode() {
final int prime = 31; final int prime = 31;
int result = 1; int result = 1;
result = prime * result + ((name == null) ? 0 : name.hashCode()); result = prime * result + name.hashCode();
return result; return result;
} }
@ -388,11 +388,7 @@ public abstract class GenericItem implements ActiveItem {
return false; return false;
} }
GenericItem other = (GenericItem) obj; GenericItem other = (GenericItem) obj;
if (name == null) { if (!name.equals(other.name)) {
if (other.name != null) {
return false;
}
} else if (!name.equals(other.name)) {
return false; return false;
} }
return true; return true;

View File

@ -223,7 +223,6 @@ public class GroupItem extends GenericItem implements StateChangeListener, Metad
* @return the accepted data types of this group item * @return the accepted data types of this group item
*/ */
@Override @Override
@SuppressWarnings("unchecked")
public List<Class<? extends State>> getAcceptedDataTypes() { public List<Class<? extends State>> getAcceptedDataTypes() {
if (baseItem != null) { if (baseItem != null) {
return baseItem.getAcceptedDataTypes(); return baseItem.getAcceptedDataTypes();
@ -249,7 +248,6 @@ public class GroupItem extends GenericItem implements StateChangeListener, Metad
* @return the accepted command types of this group item * @return the accepted command types of this group item
*/ */
@Override @Override
@SuppressWarnings("unchecked")
public List<Class<? extends Command>> getAcceptedCommandTypes() { public List<Class<? extends Command>> getAcceptedCommandTypes() {
if (baseItem != null) { if (baseItem != null) {
return baseItem.getAcceptedCommandTypes(); return baseItem.getAcceptedCommandTypes();
@ -315,9 +313,9 @@ public class GroupItem extends GenericItem implements StateChangeListener, Metad
sb.append("Type="); sb.append("Type=");
sb.append(getClass().getSimpleName()); sb.append(getClass().getSimpleName());
sb.append(", "); sb.append(", ");
if (getBaseItem() != null) { if (getBaseItem() instanceof Item item) {
sb.append("BaseType="); sb.append("BaseType=");
sb.append(baseItem.getClass().getSimpleName()); sb.append(item.getClass().getSimpleName());
sb.append(", "); sb.append(", ");
} }
sb.append("Members="); sb.append("Members=");

View File

@ -19,15 +19,10 @@ import java.util.Set;
import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable; import org.eclipse.jdt.annotation.Nullable;
import org.openhab.core.common.registry.Identifiable; import org.openhab.core.common.registry.Identifiable;
import org.openhab.core.library.types.OnOffType;
import org.openhab.core.library.types.PercentType;
import org.openhab.core.types.Command; import org.openhab.core.types.Command;
import org.openhab.core.types.CommandDescription; import org.openhab.core.types.CommandDescription;
import org.openhab.core.types.CommandOption;
import org.openhab.core.types.State; import org.openhab.core.types.State;
import org.openhab.core.types.StateDescription; import org.openhab.core.types.StateDescription;
import org.openhab.core.types.StateOption;
import org.openhab.core.types.UnDefType;
/** /**
* <p> * <p>
@ -75,14 +70,16 @@ public interface Item extends Identifiable<String> {
* This method provides a list of all data types that can be used to update the item state * This method provides a list of all data types that can be used to update the item state
* *
* <p> * <p>
* Imagine e.g. a dimmer device: It's status could be 0%, 10%, 50%, 100%, but also OFF or ON and maybe UNDEFINED. So * Imagine e.g. a dimmer device: It's status could be 0%, 10%, 50%, 100%, but also OFF or ON and maybe
* the accepted data types would be in this case {@link PercentType}, {@link OnOffType} and {@link UnDefType} * UNDEFINED. So the accepted data types would be in this case {@link org.openhab.core.library.types.PercentType},
* {@linkorg.openhab.core.library.types.OnOffType} and {@link org.openhab.core.types.UnDefType}
* *
* <p> * <p>
* The order of data types denotes the order of preference. So in case a state needs to be converted * The order of data types denotes the order of preference. So in case a state needs to be converted
* in order to be accepted, it will be attempted to convert it to a type from top to bottom. Therefore * in order to be accepted, it will be attempted to convert it to a type from top to bottom. Therefore
* the type with the least information loss should be on top of the list - in the example above the * the type with the least information loss should be on top of the list - in the example above the
* {@link PercentType} carries more information than the {@link OnOffType}, hence it is listed first. * {@link org.openhab.core.library.types.PercentType} carries more information than the
* {@linkorg.openhab.core.library.types.OnOffType}, hence it is listed first.
* *
* @return a list of data types that can be used to update the item state * @return a list of data types that can be used to update the item state
*/ */
@ -93,8 +90,9 @@ public interface Item extends Identifiable<String> {
* This method provides a list of all command types that can be used for this item * This method provides a list of all command types that can be used for this item
* *
* <p> * <p>
* Imagine e.g. a dimmer device: You could ask it to dim to 0%, 10%, 50%, 100%, but also to turn OFF or ON. So the * Imagine e.g. a dimmer device: You could ask it to dim to 0%, 10%, 50%, 100%, but also to turn OFF or ON.
* accepted command types would be in this case {@link PercentType}, {@link OnOffType} * So the accepted command types would be in this case {@link org.openhab.core.library.types.PercentType},
* {@linkorg.openhab.core.library.types.OnOffType}
* *
* *
* @return a list of all command types that can be used for this item * @return a list of all command types that can be used for this item
@ -160,8 +158,8 @@ public interface Item extends Identifiable<String> {
/** /**
* Returns the {@link CommandDescription} for this item. In case no dedicated {@link CommandDescription} is * Returns the {@link CommandDescription} for this item. In case no dedicated {@link CommandDescription} is
* provided the {@link StateOption}s from the {@link StateDescription} will be served as valid * provided the {@link org.openhab.core.types.StateOption}s from the {@link StateDescription} will be served
* {@link CommandOption}s. * as valid {@link org.openhab.core.types.CommandOption}s.
* *
* @return the {@link CommandDescription} for the default locale (can be null). * @return the {@link CommandDescription} for the default locale (can be null).
*/ */
@ -171,8 +169,9 @@ public interface Item extends Identifiable<String> {
/** /**
* Returns the {@link CommandDescription} for the given locale. In case no dedicated {@link CommandDescription} is * Returns the {@link CommandDescription} for the given locale. In case no dedicated {@link CommandDescription} is
* provided the {@link StateOption}s from the {@link StateDescription} will be served as valid * provided the {@link org.openhab.core.types.StateOption}s from the {@link StateDescription} will be served as
* {@link CommandOption}s. * valid
* {@link org.openhab.core.types.CommandOption}s.
* *
* @param locale locale (can be null) * @param locale locale (can be null)
* @return command description (can be null) * @return command description (can be null)

View File

@ -12,7 +12,6 @@
*/ */
package org.openhab.core.items; package org.openhab.core.items;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.core.common.registry.Provider; import org.openhab.core.common.registry.Provider;
@ -24,6 +23,6 @@ import org.openhab.core.common.registry.Provider;
* @author Kai Kreuzer - Initial contribution * @author Kai Kreuzer - Initial contribution
*/ */
@NonNullByDefault @NonNullByDefault
public interface ItemProvider extends Provider<@NonNull Item> { public interface ItemProvider extends Provider<Item> {
} }

View File

@ -14,12 +14,11 @@ package org.openhab.core.items;
import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.core.common.registry.ManagedProvider; import org.openhab.core.common.registry.ManagedProvider;
import org.openhab.core.storage.StorageService;
/** /**
* {@link ManagedMetadataProvider} is an OSGi service interface that allows to add or remove * {@link ManagedMetadataProvider} is an OSGi service interface that allows to add or remove
* metadata for items at runtime. Persistence of added metadata is handled by * metadata for items at runtime. Persistence of added metadata is handled by
* a {@link StorageService}. * a {@link org.openhab.core.storage.StorageService}.
* *
* @author Kai Kreuzer - Initial contribution * @author Kai Kreuzer - Initial contribution
*/ */

View File

@ -46,13 +46,6 @@ public class ItemDTOMapper {
* @return the item object * @return the item object
*/ */
public static @Nullable Item map(ItemDTO itemDTO, ItemBuilderFactory itemBuilderFactory) { public static @Nullable Item map(ItemDTO itemDTO, ItemBuilderFactory itemBuilderFactory) {
if (itemDTO == null) {
throw new IllegalArgumentException("The argument 'itemDTO' must no be null.");
}
if (itemBuilderFactory == null) {
throw new IllegalArgumentException("The argument 'itemBuilderFactory' must no be null.");
}
if (!ItemUtil.isValidItemName(itemDTO.name)) { if (!ItemUtil.isValidItemName(itemDTO.name)) {
throw new IllegalArgumentException("The item name '" + itemDTO.name + "' is invalid."); throw new IllegalArgumentException("The item name '" + itemDTO.name + "' is invalid.");
} }

View File

@ -15,11 +15,11 @@ package org.openhab.core.items.events;
import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable; import org.eclipse.jdt.annotation.Nullable;
import org.openhab.core.events.AbstractEvent; import org.openhab.core.events.AbstractEvent;
import org.openhab.core.items.ItemRegistry;
import org.openhab.core.items.dto.ItemDTO; import org.openhab.core.items.dto.ItemDTO;
/** /**
* Abstract implementation of an item registry event which will be posted by the {@link ItemRegistry} for added, removed * Abstract implementation of an item registry event which will be posted by the
* {@link org.openhab.core.items.ItemRegistry} for added, removed
* and updated items. * and updated items.
* *
* @author Stefan Bußweiler - Initial contribution * @author Stefan Bußweiler - Initial contribution

View File

@ -16,7 +16,6 @@ import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.Objects; import java.util.Objects;
import javax.measure.Dimension;
import javax.measure.Quantity; import javax.measure.Quantity;
import javax.measure.Unit; import javax.measure.Unit;
@ -130,9 +129,9 @@ public class NumberItem extends GenericItem implements MetadataAwareItem {
} }
/** /**
* Returns the {@link Dimension} associated with this {@link NumberItem}, may be null. * Returns the {@link javax.measure.Dimension} associated with this {@link NumberItem}, may be null.
* *
* @return the {@link Dimension} associated with this {@link NumberItem}, may be null. * @return the {@link javax.measure.Dimension} associated with this {@link NumberItem}, may be null.
*/ */
public @Nullable Class<? extends Quantity<?>> getDimension() { public @Nullable Class<? extends Quantity<?>> getDimension() {
return dimension; return dimension;

View File

@ -13,12 +13,11 @@
package org.openhab.core.library.types; package org.openhab.core.library.types;
import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.core.library.items.PlayerItem;
import org.openhab.core.types.Command; import org.openhab.core.types.Command;
import org.openhab.core.types.PrimitiveType; import org.openhab.core.types.PrimitiveType;
/** /**
* This type is used by the {@link PlayerItem}. * This type is used by the {@link org.openhab.core.library.items.PlayerItem}.
* *
* @author Alex Tugarev - Initial contribution * @author Alex Tugarev - Initial contribution
*/ */

View File

@ -13,7 +13,6 @@
package org.openhab.core.library.types; package org.openhab.core.library.types;
import java.util.Arrays; import java.util.Arrays;
import java.util.Formatter;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -72,7 +71,7 @@ public class StringListType implements Command, State {
/** /**
* <p> * <p>
* Formats the value of this type according to a pattern (@see * Formats the value of this type according to a pattern (@see
* {@link Formatter}). One single value of this type can be referenced * {@link java.util.Formatter}). One single value of this type can be referenced
* by the pattern using an index. The item order is defined by the natural * by the pattern using an index. The item order is defined by the natural
* (alphabetical) order of their keys. * (alphabetical) order of their keys.
* *

View File

@ -13,7 +13,6 @@
package org.openhab.core.net; package org.openhab.core.net;
import java.net.InetAddress; import java.net.InetAddress;
import java.net.InterfaceAddress;
import java.util.Objects; import java.util.Objects;
import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.NonNullByDefault;
@ -26,7 +25,7 @@ import org.eclipse.jdt.annotation.Nullable;
* The toString() method will return a CIRDR representation, but the individual * The toString() method will return a CIRDR representation, but the individual
* address and prefix length can be accessed as well. * address and prefix length can be accessed as well.
* *
* Java has a class that exactly provides this {@link InterfaceAddress}, but unfortunately * Java has a class that exactly provides this {@link java.net.InterfaceAddress}, but unfortunately
* no public constructor exists. * no public constructor exists.
* *
* @author David Graeff - Initial contribution * @author David Graeff - Initial contribution

View File

@ -582,9 +582,6 @@ public class NetUtil implements NetworkAddressService {
} }
private boolean getConfigParameter(Map<String, Object> parameters, String parameter, boolean defaultValue) { private boolean getConfigParameter(Map<String, Object> parameters, String parameter, boolean defaultValue) {
if (parameters == null) {
return defaultValue;
}
Object value = parameters.get(parameter); Object value = parameters.get(parameter);
if (value == null) { if (value == null) {
return defaultValue; return defaultValue;
@ -602,7 +599,7 @@ public class NetUtil implements NetworkAddressService {
/** /**
* For all network interfaces (except loopback) all IPv4 addresses are returned. * For all network interfaces (except loopback) all IPv4 addresses are returned.
* This list can for example, be used to scan the network for available devices. * This list can for example, be used to scan the network for available devices.
* *
* @return A full list of IP {@link InetAddress} (except network and broadcast) * @return A full list of IP {@link InetAddress} (except network and broadcast)
*/ */
public static List<InetAddress> getFullRangeOfAddressesToScan() { public static List<InetAddress> getFullRangeOfAddressesToScan() {
@ -619,7 +616,7 @@ public class NetUtil implements NetworkAddressService {
/** /**
* For the given {@link CidrAddress} all IPv4 addresses are returned. * For the given {@link CidrAddress} all IPv4 addresses are returned.
* This list can, for example, be used to scan the network for available devices. * This list can, for example, be used to scan the network for available devices.
* *
* @param iFaceAddress The {@link CidrAddress} of the network interface * @param iFaceAddress The {@link CidrAddress} of the network interface
* @param maxAllowedPrefixLength Control the maximum allowed prefix length of the network (e.g. 24 for class C). * @param maxAllowedPrefixLength Control the maximum allowed prefix length of the network (e.g. 24 for class C).
* iFaceAddress's with a larger prefix are ignored and return an empty result. * iFaceAddress's with a larger prefix are ignored and return an empty result.
@ -659,7 +656,7 @@ public class NetUtil implements NetworkAddressService {
/** /**
* Calculate each IP address within a subnet * Calculate each IP address within a subnet
* *
* @param address IPv4 address in byte array form (i.e. 127.0.0.1 = 01111111 00000000 00000000 00000001) * @param address IPv4 address in byte array form (i.e. 127.0.0.1 = 01111111 00000000 00000000 00000001)
* @param maskLength Network mask length (i.e. the number after the forward-slash, '/', in CIDR notation) * @param maskLength Network mask length (i.e. the number after the forward-slash, '/', in CIDR notation)
* @return A list of all possible IP addresses in byte array form * @return A list of all possible IP addresses in byte array form

View File

@ -16,7 +16,6 @@ import java.time.DayOfWeek;
import java.time.temporal.ChronoField; import java.time.temporal.ChronoField;
import java.time.temporal.ChronoUnit; import java.time.temporal.ChronoUnit;
import java.time.temporal.Temporal; import java.time.temporal.Temporal;
import java.time.temporal.TemporalAdjuster;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -31,7 +30,8 @@ import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable; import org.eclipse.jdt.annotation.Nullable;
/** /**
* This class creates a {@link TemporalAdjuster} that takes a temporal and adjust it to the next deadline based on a * This class creates a {@link java.time.temporal.TemporalAdjuster} that takes a temporal and adjust it to the next
* deadline based on a
* cron specification. * cron specification.
* *
* @See http://www.cronmaker.com/ * @See http://www.cronmaker.com/

View File

@ -17,7 +17,6 @@ import java.time.Instant;
import java.time.temporal.TemporalAdjuster; import java.time.temporal.TemporalAdjuster;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeoutException;
import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable; import org.eclipse.jdt.annotation.Nullable;
@ -79,7 +78,7 @@ public interface Scheduler {
} }
/** /**
* Return a {@link ScheduledCompletableFuture} that fails with a {@link TimeoutException} * Return a {@link ScheduledCompletableFuture} that fails with a {@link java.util.concurrent.TimeoutException}
* when the given {@link CompletableFuture} is not resolved before the given timeout. If the * when the given {@link CompletableFuture} is not resolved before the given timeout. If the
* given {@link CompletableFuture} fails or is resolved before the timeout then the returned * given {@link CompletableFuture} fails or is resolved before the timeout then the returned
* {@link ScheduledCompletableFuture} will be treated accordingly. The cancellation does not influence * {@link ScheduledCompletableFuture} will be treated accordingly. The cancellation does not influence

View File

@ -55,8 +55,8 @@ public final class ReadyMarker {
public int hashCode() { public int hashCode() {
final int prime = 31; final int prime = 31;
int result = 1; int result = 1;
result = prime * result + ((identifier == null) ? 0 : identifier.hashCode()); result = prime * result + identifier.hashCode();
result = prime * result + ((type == null) ? 0 : type.hashCode()); result = prime * result + type.hashCode();
return result; return result;
} }
@ -72,18 +72,10 @@ public final class ReadyMarker {
return false; return false;
} }
ReadyMarker other = (ReadyMarker) obj; ReadyMarker other = (ReadyMarker) obj;
if (identifier == null) { if (!identifier.equals(other.identifier)) {
if (other.identifier != null) {
return false;
}
} else if (!identifier.equals(other.identifier)) {
return false; return false;
} }
if (type == null) { if (!type.equals(other.type)) {
if (other.type != null) {
return false;
}
} else if (!type.equals(other.type)) {
return false; return false;
} }
return true; return true;

View File

@ -12,8 +12,6 @@
*/ */
package org.openhab.core.types; package org.openhab.core.types;
import java.util.Formatter;
import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.NonNullByDefault;
/** /**
@ -31,7 +29,7 @@ import org.eclipse.jdt.annotation.NonNullByDefault;
public interface Type { public interface Type {
/** /**
* Formats the value of this type according to a pattern (see {@link Formatter}). * Formats the value of this type according to a pattern (see {@link java.util.Formatter}).
* *
* @param pattern the pattern to use * @param pattern the pattern to use
* @return the formatted string * @return the formatted string

View File

@ -48,7 +48,6 @@ public class ColorUtil {
private static final BigDecimal BIG_DECIMAL_60 = BigDecimal.valueOf(60); private static final BigDecimal BIG_DECIMAL_60 = BigDecimal.valueOf(60);
private static final BigDecimal BIG_DECIMAL_5 = BigDecimal.valueOf(5); private static final BigDecimal BIG_DECIMAL_5 = BigDecimal.valueOf(5);
private static final BigDecimal BIG_DECIMAL_3 = BigDecimal.valueOf(3); private static final BigDecimal BIG_DECIMAL_3 = BigDecimal.valueOf(3);
private static final BigDecimal BIG_DECIMAL_2 = BigDecimal.valueOf(2);
private static final BigDecimal BIG_DECIMAL_2_POINT_55 = new BigDecimal("2.55"); private static final BigDecimal BIG_DECIMAL_2_POINT_55 = new BigDecimal("2.55");
private static final double[] CORM_COEFFICIENTS = { -0.00616793, 0.0893944, -0.5179722, 1.5317403, -2.4243787, private static final double[] CORM_COEFFICIENTS = { -0.00616793, 0.0893944, -0.5179722, 1.5317403, -2.4243787,
1.925865, -0.471106 }; 1.925865, -0.471106 };
@ -531,7 +530,7 @@ public class ColorUtil {
* *
* Duv describes the distance of a color point from the black body curve. It's useful for calculating * Duv describes the distance of a color point from the black body curve. It's useful for calculating
* if a color is near to "white", at any color temperature. * if a color is near to "white", at any color temperature.
* *
* @param xy array of double with CIE 1931 x,y in the range 0.0000 to 1.0000 * @param xy array of double with CIE 1931 x,y in the range 0.0000 to 1.0000
* @return the calculated Duv metric * @return the calculated Duv metric
* @throws IllegalArgumentException when input array has wrong size or exceeds allowed value range. * @throws IllegalArgumentException when input array has wrong size or exceeds allowed value range.
@ -1599,7 +1598,7 @@ public class ColorUtil {
/** /**
* Search the 'KELVIN_TO_XY_LOOKUP_TABLE' for the XY entry closest to the given colour temperature. * Search the 'KELVIN_TO_XY_LOOKUP_TABLE' for the XY entry closest to the given colour temperature.
* Uses a recursive 'QuickSearch' algorithm. * Uses a recursive 'QuickSearch' algorithm.
* *
* @param kelvin the colour temperature in K to find * @param kelvin the colour temperature in K to find
* @param min the first index in the lookup table * @param min the first index in the lookup table
* @param max the last index in the lookup table * @param max the last index in the lookup table
@ -1625,7 +1624,7 @@ public class ColorUtil {
* Convert a colour temperature in Kelvin to a point in the CIE XY colour space. * Convert a colour temperature in Kelvin to a point in the CIE XY colour space.
* Uses a lookup table as described <a href= * Uses a lookup table as described <a href=
* "https://www.waveformlighting.com/tech/calculate-cie-1931-xy-coordinates-from-cct">here</a>. * "https://www.waveformlighting.com/tech/calculate-cie-1931-xy-coordinates-from-cct">here</a>.
* *
* @param kelvin the colour temperature in K to be converted * @param kelvin the colour temperature in K to be converted
* @return an array with the found CIE colour XY values * @return an array with the found CIE colour XY values
* @throws IndexOutOfBoundsException if the colour temperature is out of range 2000K .. 6500K * @throws IndexOutOfBoundsException if the colour temperature is out of range 2000K .. 6500K
@ -1648,7 +1647,7 @@ public class ColorUtil {
* <p> * <p>
* Note that McCamy's approximation is accurate to better than 1% from 2000 K to 10000 K * Note that McCamy's approximation is accurate to better than 1% from 2000 K to 10000 K
* but below 2000 K the approximation error increases rapidly and exponentially. * but below 2000 K the approximation error increases rapidly and exponentially.
* *
* @param xy an array with the CIE colour XY values to be converted * @param xy an array with the CIE colour XY values to be converted
* @return the colour temperature in K * @return the colour temperature in K
* @throws IllegalArgumentException if the wrong number of arguments is provided * @throws IllegalArgumentException if the wrong number of arguments is provided

View File

@ -24,13 +24,13 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock; import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension; import org.mockito.junit.jupiter.MockitoExtension;
import org.openhab.core.i18n.AbstractI18nException;
import org.openhab.core.i18n.CommunicationException; import org.openhab.core.i18n.CommunicationException;
import org.openhab.core.i18n.TranslationProvider; import org.openhab.core.i18n.TranslationProvider;
import org.osgi.framework.Bundle; import org.osgi.framework.Bundle;
/** /**
* The {@link I18nExceptionTest} tests all the functionalities of the {@link AbstractI18nException} class. * The {@link I18nExceptionTest} tests all the functionalities of the
* {@link org.openhab.core.i18n.AbstractI18nException} class.
* *
* @author Laurent Garnier - Initial contribution * @author Laurent Garnier - Initial contribution
*/ */

View File

@ -19,10 +19,9 @@ import java.util.function.Consumer;
import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.NonNullByDefault;
import org.hamcrest.core.IsEqual; import org.hamcrest.core.IsEqual;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.openhab.core.common.AbstractUID;
/** /**
* Tests for {@link AbstractUID}. * Tests for {@link org.openhab.core.common.AbstractUID}.
* *
* @author Markus Rathgeb - Initial contribution * @author Markus Rathgeb - Initial contribution
*/ */