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.
*/
public synchronized @Nullable V getValue() {
@Nullable
V cachedValue = value.get();
if (cachedValue == null || isExpired()) {
return refreshValue();
@ -98,6 +99,7 @@ public class ExpiringCache<V> {
* @return the new value
*/
public synchronized @Nullable V refreshValue() {
@Nullable
V freshValue = action.get();
value = new SoftReference<>(freshValue);
expiresAt = calcExpiresAt();

View File

@ -132,7 +132,6 @@ public class LRUMediaCache<V> {
// 2 clean orphan (part of a pair (file + metadata) without a corresponding partner)
// 2-a delete a file without its metadata
for (Path path : filesInCacheFolder) {
if (path != null) {
String fileName = path.getFileName().toString();
// check corresponding metadata in storage
V metadata = storage.get(fileName);
@ -140,7 +139,6 @@ public class LRUMediaCache<V> {
Files.delete(path);
}
}
}
// 2-b delete metadata without corresponding file
for (Entry<String, @Nullable V> entry : storage.stream().toList()) {
Path correspondingFile = cacheFolder.resolve(entry.getKey());

View File

@ -22,7 +22,6 @@ import java.util.concurrent.Callable;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.RunnableFuture;
@ -43,7 +42,7 @@ import org.slf4j.LoggerFactory;
/**
* 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
* 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 java.lang.Thread.UncaughtExceptionHandler;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory;
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
* 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>
* 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
*/
@ -60,7 +60,7 @@ public class ThreadFactoryBuilder {
/**
* Sets the wrapped thread factory used to create threads.
* <p>
* If set to null, {@link Executors#defaultThreadFactory()} is used.
* If set to null, {@link java.util.concurrent.Executors#defaultThreadFactory()} is used.
* <p>
* Defaults to null.
*

View File

@ -442,9 +442,9 @@ public abstract class AbstractRegistry<@NonNull E extends Identifiable<K>, @NonN
}
elementsAdded.forEach(this::notifyListenersAboutAddedElement);
if (provider instanceof ManagedProvider && providerClazz != null && readyService != null) {
readyService.markReady(
new ReadyMarker("managed", providerClazz.getSimpleName().replace("Provider", "").toLowerCase()));
if (provider instanceof ManagedProvider && providerClazz instanceof Class clazz
&& readyService instanceof ReadyService rs) {
rs.markReady(new ReadyMarker("managed", clazz.getSimpleName().replace("Provider", "").toLowerCase()));
}
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
*/
protected void postEvent(Event event) {
if (eventPublisher != null) {
if (eventPublisher instanceof EventPublisher ep) {
try {
eventPublisher.post(event);
ep.post(event);
} catch (RuntimeException 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() {
final int prime = 31;
int result = 1;
result = prime * result + ((payload == null) ? 0 : payload.hashCode());
result = prime * result + ((source == null) ? 0 : source.hashCode());
result = prime * result + ((topic == null) ? 0 : topic.hashCode());
result = prime * result + payload.hashCode();
result = prime * result + (source instanceof String local ? local.hashCode() : 0);
result = prime * result + topic.hashCode();
return result;
}
@ -79,11 +79,7 @@ public abstract class AbstractEvent implements Event {
return false;
}
AbstractEvent other = (AbstractEvent) obj;
if (payload == null) {
if (other.payload != null) {
return false;
}
} else if (!payload.equals(other.payload)) {
if (!payload.equals(other.payload)) {
return false;
}
if (source == null) {
@ -93,11 +89,7 @@ public abstract class AbstractEvent implements Event {
} else if (!source.equals(other.source)) {
return false;
}
if (topic == null) {
if (other.topic != null) {
return false;
}
} else if (!topic.equals(other.topic)) {
if (!topic.equals(other.topic)) {
return false;
}
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.Event;
import org.openhab.core.events.EventFactory;
import org.openhab.core.types.Type;
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
* @return Created start level event.

View File

@ -46,7 +46,7 @@ public class LocalizedKey {
final int prime = 31;
int result = 1;
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;
}

View File

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

View File

@ -13,17 +13,15 @@
package org.openhab.core.internal.auth;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.core.auth.ManagedUser;
import org.openhab.core.auth.User;
import org.openhab.core.common.registry.DefaultAbstractManagedProvider;
import org.openhab.core.common.registry.ManagedProvider;
import org.openhab.core.storage.StorageService;
import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
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
*/

View File

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

View File

@ -17,7 +17,6 @@ import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArraySet;
import org.openhab.core.events.Event;
import org.openhab.core.events.EventFactory;
import org.openhab.core.events.EventSubscriber;
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 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
* to the {@link EventSubscriber}s if the provided filter applies.
* implementing the OSGi {@link EventHandler} interface) and dispatches the received OSGi events
* 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 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.Map;
import java.util.Objects;
import java.util.ResourceBundle;
import java.util.Set;
import javax.measure.Quantity;
@ -100,7 +99,8 @@ import org.slf4j.LoggerFactory;
* and {@link LocationProvider} service interfaces.
*
* <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
* 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.
@ -134,7 +134,6 @@ public class I18nProviderImpl
public static final String REGION = "region";
public static final String VARIANT = "variant";
private @Nullable Locale locale;
private @Nullable String currencyCode;
// TranslationProvider
private final ResourceBundleTracker resourceBundleTracker;
@ -301,7 +300,7 @@ public class I18nProviderImpl
if (oldTimeZone != null && this.timeZone == null) {
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);
}
}

View File

@ -183,9 +183,7 @@ public class LanguageResourceBundleManager {
ResourceBundle resourceBundle = ResourceBundle.getBundle(resourceName, locale, this.resourceClassLoader,
Control.getNoFallbackControl(Control.FORMAT_PROPERTIES));
if (resourceBundle != null) {
return resourceBundle.getString(key);
}
} catch (Exception ex) {
// 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.ItemBuilderFactory;
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.Component;
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;
/**
* Provides an {@link ItemBuilder} with all available {@link ItemFactory}s set. The {@link CoreItemFactory} will always
* be present.
* Provides an {@link ItemBuilder} with all available {@link ItemFactory}s set.
* The {@link org.openhab.core.library.CoreItemFactory} will always be present.
*
* @author Henning Treu - Initial contribution
*/

View File

@ -156,7 +156,6 @@ public class ItemRegistryImpl extends AbstractRegistry<Item, String, ItemProvide
private void addToGroupItems(Item item, List<String> groupItemNames) {
for (String groupName : groupItemNames) {
if (groupName != null) {
try {
if (getItem(groupName) instanceof GroupItem groupItem) {
groupItem.addMember(item);
@ -166,11 +165,9 @@ public class ItemRegistryImpl extends AbstractRegistry<Item, String, ItemProvide
}
}
}
}
private void replaceInGroupItems(Item oldItem, Item newItem, List<String> groupItemNames) {
for (String groupName : groupItemNames) {
if (groupName != null) {
try {
if (getItem(groupName) instanceof GroupItem groupItem) {
groupItem.replaceMember(oldItem, newItem);
@ -180,7 +177,6 @@ public class ItemRegistryImpl extends AbstractRegistry<Item, String, ItemProvide
}
}
}
}
/**
* An item should be initialized, which means that the event publisher is
@ -229,7 +225,6 @@ public class ItemRegistryImpl extends AbstractRegistry<Item, String, ItemProvide
private void removeFromGroupItems(Item item, List<String> groupItemNames) {
for (String groupName : groupItemNames) {
if (groupName != null) {
try {
if (getItem(groupName) instanceof GroupItem groupItem) {
groupItem.removeMember(item);
@ -239,7 +234,6 @@ public class ItemRegistryImpl extends AbstractRegistry<Item, String, ItemProvide
}
}
}
}
@Override
protected void onAddElement(Item element) throws IllegalArgumentException {

View File

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

View File

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

View File

@ -21,7 +21,6 @@ import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.core.types.StateDescription;
import org.openhab.core.types.StateDescriptionFragment;
import org.openhab.core.types.StateDescriptionFragmentBuilder;
import org.openhab.core.types.StateOption;
/**
@ -62,7 +61,7 @@ public class StateDescriptionFragmentImpl implements StateDescriptionFragment {
* @param pattern pattern to render the state
* @param readOnly if the state can be changed by the system
* @param options predefined list of options
* @deprecated use {@link StateDescriptionFragmentBuilder} instead.
* @deprecated use {@link org.openhab.core.types.StateDescriptionFragmentBuilder} instead.
*/
@Deprecated
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.
*
* @param legacy the {@link StateDescription} to initialize from.
* @deprecated use {@link StateDescriptionFragmentBuilder} instead.
* @deprecated use {@link org.openhab.core.types.StateDescriptionFragmentBuilder} instead.
*/
@Deprecated
public StateDescriptionFragmentImpl(StateDescription legacy) {

View File

@ -294,7 +294,7 @@ public abstract class GenericItem implements ActiveItem {
Set<StateChangeListener> clonedListeners = new CopyOnWriteArraySet<>(listeners);
ExecutorService pool = ThreadPoolManager.getPool(ITEM_THREADPOOLNAME);
try {
final boolean stateChanged = newState != null && !newState.equals(oldState);
final boolean stateChanged = !newState.equals(oldState);
clonedListeners.forEach(listener -> pool.execute(() -> {
try {
listener.stateUpdated(GenericItem.this, newState);
@ -372,7 +372,7 @@ public abstract class GenericItem implements ActiveItem {
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((name == null) ? 0 : name.hashCode());
result = prime * result + name.hashCode();
return result;
}
@ -388,11 +388,7 @@ public abstract class GenericItem implements ActiveItem {
return false;
}
GenericItem other = (GenericItem) obj;
if (name == null) {
if (other.name != null) {
return false;
}
} else if (!name.equals(other.name)) {
if (!name.equals(other.name)) {
return false;
}
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
*/
@Override
@SuppressWarnings("unchecked")
public List<Class<? extends State>> getAcceptedDataTypes() {
if (baseItem != null) {
return baseItem.getAcceptedDataTypes();
@ -249,7 +248,6 @@ public class GroupItem extends GenericItem implements StateChangeListener, Metad
* @return the accepted command types of this group item
*/
@Override
@SuppressWarnings("unchecked")
public List<Class<? extends Command>> getAcceptedCommandTypes() {
if (baseItem != null) {
return baseItem.getAcceptedCommandTypes();
@ -315,9 +313,9 @@ public class GroupItem extends GenericItem implements StateChangeListener, Metad
sb.append("Type=");
sb.append(getClass().getSimpleName());
sb.append(", ");
if (getBaseItem() != null) {
if (getBaseItem() instanceof Item item) {
sb.append("BaseType=");
sb.append(baseItem.getClass().getSimpleName());
sb.append(item.getClass().getSimpleName());
sb.append(", ");
}
sb.append("Members=");

View File

@ -19,15 +19,10 @@ import java.util.Set;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
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.CommandDescription;
import org.openhab.core.types.CommandOption;
import org.openhab.core.types.State;
import org.openhab.core.types.StateDescription;
import org.openhab.core.types.StateOption;
import org.openhab.core.types.UnDefType;
/**
* <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
*
* <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
* the accepted data types would be in this case {@link PercentType}, {@link OnOffType} and {@link UnDefType}
* Imagine e.g. a dimmer device: It's status could be 0%, 10%, 50%, 100%, but also OFF or ON and maybe
* 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>
* 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
* 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
*/
@ -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
*
* <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
* accepted command types would be in this case {@link PercentType}, {@link OnOffType}
* 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 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
@ -160,8 +158,8 @@ public interface Item extends Identifiable<String> {
/**
* 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
* {@link CommandOption}s.
* provided the {@link org.openhab.core.types.StateOption}s from the {@link StateDescription} will be served
* as valid {@link org.openhab.core.types.CommandOption}s.
*
* @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
* provided the {@link StateOption}s from the {@link StateDescription} will be served as valid
* {@link CommandOption}s.
* provided the {@link org.openhab.core.types.StateOption}s from the {@link StateDescription} will be served as
* valid
* {@link org.openhab.core.types.CommandOption}s.
*
* @param locale locale (can be null)
* @return command description (can be null)

View File

@ -12,7 +12,6 @@
*/
package org.openhab.core.items;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.core.common.registry.Provider;
@ -24,6 +23,6 @@ import org.openhab.core.common.registry.Provider;
* @author Kai Kreuzer - Initial contribution
*/
@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.openhab.core.common.registry.ManagedProvider;
import org.openhab.core.storage.StorageService;
/**
* {@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
* a {@link StorageService}.
* a {@link org.openhab.core.storage.StorageService}.
*
* @author Kai Kreuzer - Initial contribution
*/

View File

@ -46,13 +46,6 @@ public class ItemDTOMapper {
* @return the item object
*/
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)) {
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.Nullable;
import org.openhab.core.events.AbstractEvent;
import org.openhab.core.items.ItemRegistry;
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.
*
* @author Stefan Bußweiler - Initial contribution

View File

@ -16,7 +16,6 @@ import java.util.List;
import java.util.Locale;
import java.util.Objects;
import javax.measure.Dimension;
import javax.measure.Quantity;
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() {
return dimension;

View File

@ -13,12 +13,11 @@
package org.openhab.core.library.types;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.core.library.items.PlayerItem;
import org.openhab.core.types.Command;
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
*/

View File

@ -13,7 +13,6 @@
package org.openhab.core.library.types;
import java.util.Arrays;
import java.util.Formatter;
import java.util.List;
import java.util.stream.Collectors;
@ -72,7 +71,7 @@ public class StringListType implements Command, State {
/**
* <p>
* 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
* (alphabetical) order of their keys.
*

View File

@ -13,7 +13,6 @@
package org.openhab.core.net;
import java.net.InetAddress;
import java.net.InterfaceAddress;
import java.util.Objects;
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
* 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.
*
* @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) {
if (parameters == null) {
return defaultValue;
}
Object value = parameters.get(parameter);
if (value == null) {
return defaultValue;

View File

@ -16,7 +16,6 @@ import java.time.DayOfWeek;
import java.time.temporal.ChronoField;
import java.time.temporal.ChronoUnit;
import java.time.temporal.Temporal;
import java.time.temporal.TemporalAdjuster;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@ -31,7 +30,8 @@ import org.eclipse.jdt.annotation.NonNullByDefault;
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.
*
* @See http://www.cronmaker.com/

View File

@ -17,7 +17,6 @@ import java.time.Instant;
import java.time.temporal.TemporalAdjuster;
import java.util.concurrent.Callable;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeoutException;
import org.eclipse.jdt.annotation.NonNullByDefault;
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
* given {@link CompletableFuture} fails or is resolved before the timeout then the returned
* {@link ScheduledCompletableFuture} will be treated accordingly. The cancellation does not influence

View File

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

View File

@ -12,8 +12,6 @@
*/
package org.openhab.core.types;
import java.util.Formatter;
import org.eclipse.jdt.annotation.NonNullByDefault;
/**
@ -31,7 +29,7 @@ import org.eclipse.jdt.annotation.NonNullByDefault;
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
* @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_5 = BigDecimal.valueOf(5);
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 double[] CORM_COEFFICIENTS = { -0.00616793, 0.0893944, -0.5179722, 1.5317403, -2.4243787,
1.925865, -0.471106 };

View File

@ -24,13 +24,13 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
import org.openhab.core.i18n.AbstractI18nException;
import org.openhab.core.i18n.CommunicationException;
import org.openhab.core.i18n.TranslationProvider;
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
*/

View File

@ -19,10 +19,9 @@ import java.util.function.Consumer;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.hamcrest.core.IsEqual;
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
*/