Bump spotless and fix formatting (#3469)

Signed-off-by: Jan N. Klug <github@klug.nrw>
This commit is contained in:
J-N-K 2023-03-20 23:14:59 +01:00 committed by GitHub
parent 7bad9baa85
commit 9289fd5a78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
65 changed files with 1274 additions and 1310 deletions

View File

@ -177,7 +177,7 @@ public class ScriptTransformationService
// compile the script here _after_ setting context attributes, so that the script engine // compile the script here _after_ setting context attributes, so that the script engine
// can bind the attributes as variables during compilation. This primarily affects jruby. // can bind the attributes as variables during compilation. This primarily affects jruby.
if (compiledScript == null if (compiledScript == null
&& scriptEngineContainer.getScriptEngine()instanceof Compilable scriptEngine) { && scriptEngineContainer.getScriptEngine() instanceof Compilable scriptEngine) {
// no compiled script available but compiling is supported // no compiled script available but compiling is supported
compiledScript = scriptEngine.compile(scriptRecord.script); compiledScript = scriptEngine.compile(scriptRecord.script);
scriptRecord.compiledScript = compiledScript; scriptRecord.compiledScript = compiledScript;

View File

@ -54,18 +54,19 @@ import com.igormaznitsa.jbbp.model.JBBPFieldUShort;
* *
* Parser rules follows Java Binary Block Parser syntax. * Parser rules follows Java Binary Block Parser syntax.
* *
* <p> * <p />
* *
* See details from <a href= * See details from <a href=
* "https://github.com/raydac/java-binary-block-parser">https://github.com/raydac/java-binary-block-parser</a> * "https://github.com/raydac/java-binary-block-parser">https://github.com/raydac/java-binary-block-parser</a>
* *
* <p> * <p />
* Usage example: * Usage example:
* *
* <pre> * <pre>
* {@code * {@code
* JsonObject json = new Bin2Json("byte a; byte b; ubyte c;").convert("03FAFF"); * JsonObject json = new Bin2Json("byte a; byte b; ubyte c;").convert("03FAFF");
* json.toString() = {"a":3,"b":-6,"c":255} * json.toString() = {"a":3,"b":-6,"c":255}
* }
* </pre> * </pre>
* *
* @author Pauli Anttila - Initial contribution * @author Pauli Anttila - Initial contribution

View File

@ -38,5 +38,4 @@ public class ItemRuntimeActivator implements ModelParser {
public String getExtension() { public String getExtension() {
return "items"; return "items";
} }
} }

View File

@ -12,10 +12,10 @@
*/ */
package org.openhab.core.model.internal.valueconverter; package org.openhab.core.model.internal.valueconverter;
import org.openhab.core.model.core.valueconverter.ValueTypeToStringConverter;
import org.eclipse.xtext.common.services.DefaultTerminalConverters; import org.eclipse.xtext.common.services.DefaultTerminalConverters;
import org.eclipse.xtext.conversion.IValueConverter; import org.eclipse.xtext.conversion.IValueConverter;
import org.eclipse.xtext.conversion.ValueConverter; import org.eclipse.xtext.conversion.ValueConverter;
import org.openhab.core.model.core.valueconverter.ValueTypeToStringConverter;
import com.google.inject.Inject; import com.google.inject.Inject;
@ -33,5 +33,4 @@ public class ItemValueConverters extends DefaultTerminalConverters {
public IValueConverter<Object> ValueType() { public IValueConverter<Object> ValueType() {
return valueTypeToStringConverter; return valueTypeToStringConverter;
} }
} }

View File

@ -28,5 +28,4 @@ public class BindingConfigParseException extends Exception {
public BindingConfigParseException(String msg, Exception e) { public BindingConfigParseException(String msg, Exception e) {
super(msg, e); super(msg, e);
} }
} }

View File

@ -517,5 +517,4 @@ public class GenericItemProvider extends AbstractProvider<Item>
public @Nullable StateDescriptionFragment getStateDescriptionFragment(String itemName, @Nullable Locale locale) { public @Nullable StateDescriptionFragment getStateDescriptionFragment(String itemName, @Nullable Locale locale) {
return stateDescriptionFragments.get(itemName); return stateDescriptionFragments.get(itemName);
} }
} }

View File

@ -88,7 +88,8 @@ public class GenericMetadataProvider extends AbstractProvider<Metadata> implemen
* Removes all meta-data for a given item * Removes all meta-data for a given item
* *
* @param itemName the item name * @param itemName the item name
*/public void removeMetadataByItemName(String itemName) { */
public void removeMetadataByItemName(String itemName) {
Set<Metadata> toBeRemoved; Set<Metadata> toBeRemoved;
try { try {
lock.writeLock().lock(); lock.writeLock().lock();
@ -101,6 +102,7 @@ public class GenericMetadataProvider extends AbstractProvider<Metadata> implemen
notifyListenersAboutRemovedElement(m); notifyListenersAboutRemovedElement(m);
} }
} }
@Override @Override
public Collection<Metadata> getAll() { public Collection<Metadata> getAll() {
try { try {
@ -110,5 +112,4 @@ public class GenericMetadataProvider extends AbstractProvider<Metadata> implemen
lock.readLock().unlock(); lock.readLock().unlock();
} }
} }
} }

View File

@ -38,5 +38,4 @@ public class PersistenceRuntimeActivator implements ModelParser {
public String getExtension() { public String getExtension() {
return "persist"; return "persist";
} }
} }

View File

@ -16,17 +16,6 @@ import java.util.LinkedList;
import java.util.List; import java.util.List;
import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EObject;
import org.openhab.core.persistence.PersistenceManager;
import org.openhab.core.persistence.PersistenceService;
import org.openhab.core.persistence.PersistenceServiceConfiguration;
import org.openhab.core.persistence.PersistenceFilter;
import org.openhab.core.persistence.PersistenceItemConfiguration;
import org.openhab.core.persistence.config.PersistenceAllConfig;
import org.openhab.core.persistence.config.PersistenceConfig;
import org.openhab.core.persistence.config.PersistenceGroupConfig;
import org.openhab.core.persistence.config.PersistenceItemConfig;
import org.openhab.core.persistence.strategy.PersistenceCronStrategy;
import org.openhab.core.persistence.strategy.PersistenceStrategy;
import org.openhab.core.model.core.EventType; import org.openhab.core.model.core.EventType;
import org.openhab.core.model.core.ModelRepository; import org.openhab.core.model.core.ModelRepository;
import org.openhab.core.model.core.ModelRepositoryChangeListener; import org.openhab.core.model.core.ModelRepositoryChangeListener;
@ -38,6 +27,17 @@ import org.openhab.core.model.persistence.persistence.ItemConfig;
import org.openhab.core.model.persistence.persistence.PersistenceConfiguration; import org.openhab.core.model.persistence.persistence.PersistenceConfiguration;
import org.openhab.core.model.persistence.persistence.PersistenceModel; import org.openhab.core.model.persistence.persistence.PersistenceModel;
import org.openhab.core.model.persistence.persistence.Strategy; import org.openhab.core.model.persistence.persistence.Strategy;
import org.openhab.core.persistence.PersistenceFilter;
import org.openhab.core.persistence.PersistenceItemConfiguration;
import org.openhab.core.persistence.PersistenceManager;
import org.openhab.core.persistence.PersistenceService;
import org.openhab.core.persistence.PersistenceServiceConfiguration;
import org.openhab.core.persistence.config.PersistenceAllConfig;
import org.openhab.core.persistence.config.PersistenceConfig;
import org.openhab.core.persistence.config.PersistenceGroupConfig;
import org.openhab.core.persistence.config.PersistenceItemConfig;
import org.openhab.core.persistence.strategy.PersistenceCronStrategy;
import org.openhab.core.persistence.strategy.PersistenceStrategy;
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;
@ -170,5 +170,4 @@ public class PersistenceModelManager implements ModelRepositoryChangeListener {
private PersistenceFilter mapFilter(Filter filter) { private PersistenceFilter mapFilter(Filter filter) {
return new PersistenceFilter(); return new PersistenceFilter();
} }
} }

View File

@ -20,12 +20,12 @@ import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.impl.ResourceImpl; import org.eclipse.emf.ecore.resource.impl.ResourceImpl;
import org.openhab.core.model.persistence.persistence.Strategy;
import org.eclipse.xtext.resource.EObjectDescription; import org.eclipse.xtext.resource.EObjectDescription;
import org.eclipse.xtext.resource.IEObjectDescription; import org.eclipse.xtext.resource.IEObjectDescription;
import org.eclipse.xtext.scoping.IScope; import org.eclipse.xtext.scoping.IScope;
import org.eclipse.xtext.scoping.impl.AbstractGlobalScopeProvider; import org.eclipse.xtext.scoping.impl.AbstractGlobalScopeProvider;
import org.eclipse.xtext.scoping.impl.SimpleScope; import org.eclipse.xtext.scoping.impl.SimpleScope;
import org.openhab.core.model.persistence.persistence.Strategy;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
@ -53,5 +53,4 @@ public class PersistenceGlobalScopeProvider extends AbstractGlobalScopeProvider
} }
return new SimpleScope(parentScope, descs); return new SimpleScope(parentScope, descs);
} }
} }

View File

@ -94,7 +94,5 @@ public class RuleContextHelper {
public IEvaluationContext getContext() { public IEvaluationContext getContext() {
return context; return context;
} }
} }
} }

View File

@ -49,5 +49,4 @@ public class RuleEvaluationContext extends DefaultEvaluationContext {
} }
} }
} }
} }

View File

@ -56,12 +56,10 @@ public class RulesClassFinder extends ClassFinder {
cache.put(name, NULL_CLASS); cache.put(name, NULL_CLASS);
throw e; throw e;
} }
} }
@Override @Override
protected Class<?> forName(String name, ClassLoader classLoader) throws ClassNotFoundException { protected Class<?> forName(String name, ClassLoader classLoader) throws ClassNotFoundException {
return Class.forName(name, false, classLoader); return Class.forName(name, false, classLoader);
} }
} }

View File

@ -165,7 +165,8 @@ public class DSLScriptEngine implements javax.script.ScriptEngine {
} }
} }
Map<String, Object> cachePreset = scriptExtensionAccessor.findPreset("cache", (String) context.getAttribute("oh.engine-identifier", ScriptContext.ENGINE_SCOPE)); Map<String, Object> cachePreset = scriptExtensionAccessor.findPreset("cache",
(String) context.getAttribute("oh.engine-identifier", ScriptContext.ENGINE_SCOPE));
evalContext.newValue(QualifiedName.create("sharedCache"), cachePreset.get("sharedCache")); evalContext.newValue(QualifiedName.create("sharedCache"), cachePreset.get("sharedCache"));
evalContext.newValue(QualifiedName.create("privateCache"), cachePreset.get("privateCache")); evalContext.newValue(QualifiedName.create("privateCache"), cachePreset.get("privateCache"));
// now add specific implicit vars, where we have to map the right content // now add specific implicit vars, where we have to map the right content
@ -211,7 +212,6 @@ public class DSLScriptEngine implements javax.script.ScriptEngine {
@Override @Override
public void put(String key, Object value) { public void put(String key, Object value) {
} }
@Override @Override
@ -240,7 +240,6 @@ public class DSLScriptEngine implements javax.script.ScriptEngine {
@Override @Override
public void setContext(ScriptContext context) { public void setContext(ScriptContext context) {
} }
@Override @Override
@ -308,5 +307,4 @@ public class DSLScriptEngine implements javax.script.ScriptEngine {
} }
}; };
} }
} }

View File

@ -45,7 +45,8 @@ public class DSLScriptEngineFactory implements ScriptEngineFactory {
protected @Nullable DSLScriptContextProvider contextProvider; protected @Nullable DSLScriptContextProvider contextProvider;
@Activate @Activate
public DSLScriptEngineFactory(@Reference ScriptEngine scriptEngine, @Reference ScriptExtensionAccessor scriptExtensionAccessor) { public DSLScriptEngineFactory(@Reference ScriptEngine scriptEngine,
@Reference ScriptExtensionAccessor scriptExtensionAccessor) {
this.scriptEngine = scriptEngine; this.scriptEngine = scriptEngine;
this.scriptExtensionAccessor = scriptExtensionAccessor; this.scriptExtensionAccessor = scriptExtensionAccessor;
} }
@ -63,5 +64,4 @@ public class DSLScriptEngineFactory implements ScriptEngineFactory {
public javax.script.@Nullable ScriptEngine createScriptEngine(String scriptType) { public javax.script.@Nullable ScriptEngine createScriptEngine(String scriptType) {
return new DSLScriptEngine(scriptEngine, contextProvider, scriptExtensionAccessor); return new DSLScriptEngine(scriptEngine, contextProvider, scriptExtensionAccessor);
} }
} }

View File

@ -31,8 +31,8 @@ import org.openhab.core.items.ItemNotFoundException;
import org.openhab.core.items.ItemRegistry; import org.openhab.core.items.ItemRegistry;
import org.openhab.core.library.CoreItemFactory; import org.openhab.core.library.CoreItemFactory;
import org.openhab.core.model.script.internal.engine.action.SemanticsActionService; import org.openhab.core.model.script.internal.engine.action.SemanticsActionService;
import org.openhab.core.semantics.model.equipment.CleaningRobot;
import org.openhab.core.semantics.model.equipment.Battery; import org.openhab.core.semantics.model.equipment.Battery;
import org.openhab.core.semantics.model.equipment.CleaningRobot;
import org.openhab.core.semantics.model.location.Bathroom; import org.openhab.core.semantics.model.location.Bathroom;
import org.openhab.core.semantics.model.location.Indoor; import org.openhab.core.semantics.model.location.Indoor;

View File

@ -31,5 +31,4 @@ public class OptimizingFeatureScopeTrackerProvider2 extends OptimizingFeatureSco
return new FeatureScopeTracker() { return new FeatureScopeTracker() {
}; };
} }
} }

View File

@ -162,5 +162,4 @@ public class ScriptServiceUtil {
// uninjected as a callback from the script engine, not via DS as it is a circular dependency... // uninjected as a callback from the script engine, not via DS as it is a circular dependency...
this.scriptEngine.compareAndSet(scriptEngine, null); this.scriptEngine.compareAndSet(scriptEngine, null);
} }
} }

View File

@ -13,7 +13,6 @@
package org.openhab.core.model.script; package org.openhab.core.model.script;
import org.openhab.core.items.ItemRegistry; import org.openhab.core.items.ItemRegistry;
import org.openhab.core.thing.ThingRegistry;
import org.openhab.core.model.core.ModelRepository; import org.openhab.core.model.core.ModelRepository;
import org.openhab.core.model.script.engine.IActionServiceProvider; import org.openhab.core.model.script.engine.IActionServiceProvider;
import org.openhab.core.model.script.engine.IThingActionsProvider; import org.openhab.core.model.script.engine.IThingActionsProvider;
@ -22,6 +21,7 @@ import org.openhab.core.model.script.internal.engine.ServiceTrackerActionService
import org.openhab.core.model.script.internal.engine.ServiceTrackerThingActionsProvider; import org.openhab.core.model.script.internal.engine.ServiceTrackerThingActionsProvider;
import org.openhab.core.model.script.script.Script; import org.openhab.core.model.script.script.Script;
import org.openhab.core.model.script.script.impl.ScriptImpl; import org.openhab.core.model.script.script.impl.ScriptImpl;
import org.openhab.core.thing.ThingRegistry;
import com.google.inject.Binder; import com.google.inject.Binder;
import com.google.inject.Module; import com.google.inject.Module;
@ -52,5 +52,4 @@ public class ServiceModule implements Module {
binder.bind(IThingActionsProvider.class).toInstance(new ServiceTrackerThingActionsProvider(scriptServiceUtil)); binder.bind(IThingActionsProvider.class).toInstance(new ServiceTrackerThingActionsProvider(scriptServiceUtil));
binder.bind(Script.class).to(ScriptImpl.class); binder.bind(Script.class).to(ScriptImpl.class);
} }
} }

View File

@ -167,6 +167,7 @@ public class Audio {
/** /**
* Converts a float volume to a {@link PercentType} volume and checks if float volume is in the [0;1] range. * Converts a float volume to a {@link PercentType} volume and checks if float volume is in the [0;1] range.
*
* @param volume * @param volume
* @return * @return
*/ */

View File

@ -24,10 +24,10 @@ import org.openhab.core.items.Item;
import org.openhab.core.items.ItemNotFoundException; import org.openhab.core.items.ItemNotFoundException;
import org.openhab.core.items.ItemRegistry; import org.openhab.core.items.ItemRegistry;
import org.openhab.core.items.events.ItemEventFactory; import org.openhab.core.items.events.ItemEventFactory;
import org.openhab.core.model.script.ScriptServiceUtil;
import org.openhab.core.types.Command; import org.openhab.core.types.Command;
import org.openhab.core.types.State; import org.openhab.core.types.State;
import org.openhab.core.types.TypeParser; import org.openhab.core.types.TypeParser;
import org.openhab.core.model.script.ScriptServiceUtil;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
/** /**

View File

@ -194,5 +194,4 @@ public class Ephemeris {
return -1; return -1;
} }
} }
} }

View File

@ -56,5 +56,4 @@ public class Exec {
public static String executeCommandLine(Duration timeout, String... commandLine) { public static String executeCommandLine(Duration timeout, String... commandLine) {
return ExecUtil.executeCommandLineAndWaitResponse(timeout, commandLine); return ExecUtil.executeCommandLineAndWaitResponse(timeout, commandLine);
} }
} }

View File

@ -80,5 +80,4 @@ public class Log {
static public void logError(String loggerName, String format, Object... args) { static public void logError(String loggerName, String format, Object... args) {
LoggerFactory.getLogger(LOGGER_NAME_PREFIX.concat(loggerName)).error(format, args); LoggerFactory.getLogger(LOGGER_NAME_PREFIX.concat(loggerName)).error(format, args);
} }
} }

View File

@ -62,5 +62,4 @@ public class Ping {
return success; return success;
} }
} }

View File

@ -12,6 +12,8 @@
*/ */
package org.openhab.core.model.script.actions; package org.openhab.core.model.script.actions;
import java.time.ZonedDateTime;
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.eclipse.xtext.xbase.XExpression; import org.eclipse.xtext.xbase.XExpression;
@ -26,8 +28,6 @@ import org.openhab.core.model.script.internal.engine.action.ScriptExecutionActio
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.time.ZonedDateTime;
/** /**
* The {@link ScriptExecution} is a wrapper for the ScriptExecution actions * The {@link ScriptExecution} is a wrapper for the ScriptExecution actions
* *
@ -78,17 +78,23 @@ public class ScriptExecution {
} }
@ActionDoc(text = "create an identifiable timer ") @ActionDoc(text = "create an identifiable timer ")
public static Timer createTimer(@Nullable String identifier, ZonedDateTime zonedDateTime, Procedures.Procedure0 closure) { public static Timer createTimer(@Nullable String identifier, ZonedDateTime zonedDateTime,
return new Timer(ScriptExecutionActionService.getScriptExecution().createTimer(identifier, zonedDateTime, closure::apply)); Procedures.Procedure0 closure) {
return new Timer(ScriptExecutionActionService.getScriptExecution().createTimer(identifier, zonedDateTime,
closure::apply));
} }
@ActionDoc(text = "create a timer with argument") @ActionDoc(text = "create a timer with argument")
public static Timer createTimerWithArgument(ZonedDateTime zonedDateTime, Object arg1, Procedures.Procedure1 closure) { public static Timer createTimerWithArgument(ZonedDateTime zonedDateTime, Object arg1,
return new Timer(ScriptExecutionActionService.getScriptExecution().createTimerWithArgument(zonedDateTime, arg1, closure::apply)); Procedures.Procedure1 closure) {
return new Timer(ScriptExecutionActionService.getScriptExecution().createTimerWithArgument(zonedDateTime, arg1,
closure::apply));
} }
@ActionDoc(text = "create an identifiable timer with argument") @ActionDoc(text = "create an identifiable timer with argument")
public static Timer createTimerWithArgument(@Nullable String identifier, ZonedDateTime zonedDateTime, Object arg1, Procedures.Procedure1 closure) { public static Timer createTimerWithArgument(@Nullable String identifier, ZonedDateTime zonedDateTime, Object arg1,
return new Timer(ScriptExecutionActionService.getScriptExecution().createTimerWithArgument(identifier, zonedDateTime, arg1, closure::apply)); Procedures.Procedure1 closure) {
return new Timer(ScriptExecutionActionService.getScriptExecution().createTimerWithArgument(identifier,
zonedDateTime, arg1, closure::apply));
} }
} }

View File

@ -110,7 +110,6 @@ public class Semantics {
public static @Nullable Class<? extends Equipment> getEquipmentType(Item item) { public static @Nullable Class<? extends Equipment> getEquipmentType(Item item) {
Item equipmentItem = isEquipment(item) ? item : getEquipment(item); Item equipmentItem = isEquipment(item) ? item : getEquipment(item);
return equipmentItem != null ? SemanticTags.getEquipment(equipmentItem) : null; return equipmentItem != null ? SemanticTags.getEquipment(equipmentItem) : null;
} }
/** /**

View File

@ -12,9 +12,9 @@
*/ */
package org.openhab.core.model.script.actions; package org.openhab.core.model.script.actions;
import org.openhab.core.model.script.internal.engine.action.ThingActionService;
import org.openhab.core.thing.ThingStatusInfo; import org.openhab.core.thing.ThingStatusInfo;
import org.openhab.core.thing.binding.ThingActions; import org.openhab.core.thing.binding.ThingActions;
import org.openhab.core.model.script.internal.engine.action.ThingActionService;
/** /**
* This class provides static methods that can be used in automation rules for * This class provides static methods that can be used in automation rules for

View File

@ -12,11 +12,11 @@
*/ */
package org.openhab.core.model.script.actions; package org.openhab.core.model.script.actions;
import java.time.ZonedDateTime;
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 java.time.ZonedDateTime;
/** /**
* The {@link Timer} is a wrapper for the {@link org.openhab.core.automation.module.script.action.Timer} * The {@link Timer} is a wrapper for the {@link org.openhab.core.automation.module.script.action.Timer}
* interface. This is necessary because the implementation methods of an interface can't be called from * interface. This is necessary because the implementation methods of an interface can't be called from

View File

@ -33,5 +33,4 @@ public class TransformationException extends Exception {
public TransformationException(@Nullable String message, @Nullable Throwable cause) { public TransformationException(@Nullable String message, @Nullable Throwable cause) {
super(message, cause); super(message, cause);
} }
} }

View File

@ -104,15 +104,13 @@ public class Voice {
* @param volume The volume to be used * @param volume The volume to be used
*/ */
@ActionDoc(text = "says a given text with a given voice and the given volume") @ActionDoc(text = "says a given text with a given voice and the given volume")
public static void say(@ParamDoc(name = "text") Object text, public static void say(@ParamDoc(name = "text") Object text, @ParamDoc(name = "voice") @Nullable String voice,
@ParamDoc(name = "voice") @Nullable String voice,
@ParamDoc(name = "volume", text = "the volume to be used") PercentType volume) { @ParamDoc(name = "volume", text = "the volume to be used") PercentType volume) {
say(text, voice, null, volume); say(text, voice, null, volume);
} }
@ActionDoc(text = "says a given text with a given voice and the given volume") @ActionDoc(text = "says a given text with a given voice and the given volume")
public static void say(@ParamDoc(name = "text") Object text, public static void say(@ParamDoc(name = "text") Object text, @ParamDoc(name = "voice") @Nullable String voice,
@ParamDoc(name = "voice") @Nullable String voice,
@ParamDoc(name = "volume", text = "volume in the range [0;1]") float volume) { @ParamDoc(name = "volume", text = "volume in the range [0;1]") float volume) {
say(text, voice, null, floatVolumeToPercentType(volume)); say(text, voice, null, floatVolumeToPercentType(volume));
} }
@ -128,8 +126,7 @@ public class Voice {
* be used * be used
*/ */
@ActionDoc(text = "says a given text with a given voice through the given sink") @ActionDoc(text = "says a given text with a given voice through the given sink")
public static void say(@ParamDoc(name = "text") Object text, public static void say(@ParamDoc(name = "text") Object text, @ParamDoc(name = "voice") @Nullable String voice,
@ParamDoc(name = "voice") @Nullable String voice,
@ParamDoc(name = "sink") @Nullable String sink) { @ParamDoc(name = "sink") @Nullable String sink) {
say(text, voice, sink, null); say(text, voice, sink, null);
} }
@ -209,8 +206,7 @@ public class Voice {
*/ */
@ActionDoc(text = "interprets a given text by given human language interpreter(s) and using the given sink", returns = "human language response") @ActionDoc(text = "interprets a given text by given human language interpreter(s) and using the given sink", returns = "human language response")
public static String interpret(@ParamDoc(name = "text") Object text, public static String interpret(@ParamDoc(name = "text") Object text,
@ParamDoc(name = "interpreters") String interpreters, @ParamDoc(name = "interpreters") String interpreters, @ParamDoc(name = "sink") @Nullable String sink) {
@ParamDoc(name = "sink") @Nullable String sink) {
String response; String response;
try { try {
response = VoiceActionService.voiceManager.interpret(text.toString(), interpreters); response = VoiceActionService.voiceManager.interpret(text.toString(), interpreters);
@ -476,6 +472,7 @@ public class Voice {
/** /**
* Converts a float volume to a {@link PercentType} volume and checks if float volume is in the [0;1] range. * Converts a float volume to a {@link PercentType} volume and checks if float volume is in the [0;1] range.
*
* @param volume * @param volume
* @return * @return
*/ */

View File

@ -19,5 +19,4 @@ import org.openhab.core.model.script.engine.action.ActionService;
public interface IActionServiceProvider { public interface IActionServiceProvider {
List<ActionService> get(); List<ActionService> get();
} }

View File

@ -19,5 +19,4 @@ import org.openhab.core.thing.binding.ThingActions;
public interface IThingActionsProvider { public interface IThingActionsProvider {
List<ThingActions> get(); List<ThingActions> get();
} }

View File

@ -53,11 +53,9 @@ public class ScriptParsingException extends ScriptException {
public ScriptParsingException addValidationIssues(Iterable<Issue> validationErrors) { public ScriptParsingException addValidationIssues(Iterable<Issue> validationErrors) {
for (Issue validationError : validationErrors) { for (Issue validationError : validationErrors) {
this.getErrors().add( this.getErrors().add(new ScriptError(validationError.getMessage(), validationError.getLineNumber(),
new ScriptError(validationError.getMessage(), validationError.getLineNumber(), validationError validationError.getOffset(), validationError.getLength()));
.getOffset(), validationError.getLength()));
} }
return this; return this;
} }
} }

View File

@ -37,5 +37,4 @@ public interface ActionService {
* @return the action class * @return the action class
*/ */
Class<?> getActionClass(); Class<?> getActionClass();
} }

View File

@ -112,5 +112,4 @@ public class RuleHumanLanguageInterpreter implements HumanLanguageInterpreter {
public Set<String> getSupportedGrammarFormats() { public Set<String> getSupportedGrammarFormats() {
return Collections.emptySet(); return Collections.emptySet();
} }
} }

View File

@ -35,5 +35,4 @@ public class ScriptEncodingProvider implements IEncodingProvider {
} }
return Charset.defaultCharset().name(); return Charset.defaultCharset().name();
} }
} }

View File

@ -12,6 +12,8 @@
*/ */
package org.openhab.core.model.script.internal.engine.action; package org.openhab.core.model.script.internal.engine.action;
import java.util.Objects;
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.automation.module.script.action.ScriptExecution; import org.openhab.core.automation.module.script.action.ScriptExecution;
@ -20,8 +22,6 @@ 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;
import java.util.Objects;
/** /**
* This class registers an OSGi service for the ScriptExecution action. * This class registers an OSGi service for the ScriptExecution action.
* *

View File

@ -116,5 +116,4 @@ public class ThingActionService implements ActionService {
ThingActionsScope scopeAnnotation = actions.getClass().getAnnotation(ThingActionsScope.class); ThingActionsScope scopeAnnotation = actions.getClass().getAnnotation(ThingActionsScope.class);
return scopeAnnotation.name(); return scopeAnnotation.name();
} }
} }

View File

@ -97,7 +97,6 @@ public class ScriptItemRefresher implements ItemRegistryChangeListener {
@Override @Override
public void updated(Item oldElement, Item element) { public void updated(Item oldElement, Item element) {
} }
@Override @Override

View File

@ -12,15 +12,15 @@
*/ */
package org.openhab.core.model.script.jvmmodel; package org.openhab.core.model.script.jvmmodel;
import org.openhab.core.library.types.QuantityType;
import org.openhab.core.types.Command;
import org.openhab.core.types.State;
import org.openhab.core.model.script.script.QuantityLiteral;
import org.eclipse.xtext.xbase.XExpression; import org.eclipse.xtext.xbase.XExpression;
import org.eclipse.xtext.xbase.typesystem.computation.ITypeComputationState; import org.eclipse.xtext.xbase.typesystem.computation.ITypeComputationState;
import org.eclipse.xtext.xbase.typesystem.computation.ITypeExpectation; import org.eclipse.xtext.xbase.typesystem.computation.ITypeExpectation;
import org.eclipse.xtext.xbase.typesystem.computation.XbaseTypeComputer; import org.eclipse.xtext.xbase.typesystem.computation.XbaseTypeComputer;
import org.eclipse.xtext.xbase.typesystem.references.LightweightTypeReference; import org.eclipse.xtext.xbase.typesystem.references.LightweightTypeReference;
import org.openhab.core.library.types.QuantityType;
import org.openhab.core.model.script.script.QuantityLiteral;
import org.openhab.core.types.Command;
import org.openhab.core.types.State;
/** /**
* Calculates the type information used by Xbase to select the correct method during script execution. * Calculates the type information used by Xbase to select the correct method during script execution.
@ -61,5 +61,4 @@ public class ScriptTypeComputer extends XbaseTypeComputer {
} }
state.acceptActualType(qt); state.acceptActualType(qt);
} }
} }

View File

@ -395,5 +395,4 @@ public class NumberExtensions {
private static boolean isAbstractUnitOne(QuantityType<?> left) { private static boolean isAbstractUnitOne(QuantityType<?> left) {
return Units.ONE.equals(left.getUnit()); return Units.ONE.equals(left.getUnit());
} }
} }

View File

@ -50,5 +50,4 @@ public class ScriptImportSectionNamespaceScopeProvider extends XImportSectionNam
implicitImports.add(doCreateImportNormalizer(QUANTITY_PACKAGE, true, false)); implicitImports.add(doCreateImportNormalizer(QUANTITY_PACKAGE, true, false));
return implicitImports; return implicitImports;
} }
} }

View File

@ -90,5 +90,4 @@ public class StateAndCommandProvider {
public Iterable<State> getAllStates() { public Iterable<State> getAllStates() {
return STATES; return STATES;
} }
} }

View File

@ -38,5 +38,4 @@ public class SitemapRuntimeActivator implements ModelParser {
public String getExtension() { public String getExtension() {
return "sitemap"; return "sitemap";
} }
} }

View File

@ -14,7 +14,6 @@ package org.openhab.core.model.sitemap;
import java.util.Set; 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.model.core.ModelRepositoryChangeListener; import org.openhab.core.model.core.ModelRepositoryChangeListener;
@ -52,5 +51,4 @@ public interface SitemapProvider {
* @param listener * @param listener
*/ */
void removeModelChangeListener(ModelRepositoryChangeListener listener); void removeModelChangeListener(ModelRepositoryChangeListener listener);
} }

View File

@ -127,5 +127,4 @@ public class SitemapProviderImpl implements SitemapProvider, ModelRepositoryChan
public void removeModelChangeListener(ModelRepositoryChangeListener listener) { public void removeModelChangeListener(ModelRepositoryChangeListener listener) {
modelChangeListeners.remove(listener); modelChangeListeners.remove(listener);
} }
} }

View File

@ -45,7 +45,6 @@ public class SitemapConverters extends DefaultTerminalConverters {
} }
return value; return value;
} }
}; };
} }

View File

@ -38,5 +38,4 @@ public class ThingRuntimeActivator implements ModelParser {
public String getExtension() { public String getExtension() {
return "things"; return "things";
} }
} }

View File

@ -141,5 +141,4 @@ public class GenericItemChannelLinkProvider extends AbstractProvider<ItemChannel
public Collection<ItemChannelLink> getAll() { public Collection<ItemChannelLink> getAll() {
return itemChannelLinkMap.values().stream().flatMap(Collection::stream).collect(Collectors.toList()); return itemChannelLinkMap.values().stream().flatMap(Collection::stream).collect(Collectors.toList());
} }
} }

View File

@ -28,11 +28,12 @@ import org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider.ISyn
public class ThingSyntacticSequencerExtension extends ThingSyntacticSequencer { public class ThingSyntacticSequencerExtension extends ThingSyntacticSequencer {
@Override @Override
protected void emit_ModelThing_ThingKeyword_0_q(EObject semanticObject, ISynNavigable transition, List<INode> nodes) { protected void emit_ModelThing_ThingKeyword_0_q(EObject semanticObject, ISynNavigable transition,
ILeafNode node = nodes != null && nodes.size() == 1 && nodes.get(0) instanceof ILeafNode ? (ILeafNode) nodes List<INode> nodes) {
.get(0) : null; ILeafNode node = nodes != null && nodes.size() == 1 && nodes.get(0) instanceof ILeafNode
? (ILeafNode) nodes.get(0)
: null;
Keyword keyword = grammarAccess.getModelThingAccess().getThingKeyword_0(); Keyword keyword = grammarAccess.getModelThingAccess().getThingKeyword_0();
acceptUnassignedKeyword(keyword, keyword.getValue(), node); acceptUnassignedKeyword(keyword, keyword.getValue(), node);
} }
} }

View File

@ -12,10 +12,10 @@
*/ */
package org.openhab.core.model.thing.valueconverter; package org.openhab.core.model.thing.valueconverter;
import org.openhab.core.model.core.valueconverter.ValueTypeToStringConverter;
import org.eclipse.xtext.common.services.DefaultTerminalConverters; import org.eclipse.xtext.common.services.DefaultTerminalConverters;
import org.eclipse.xtext.conversion.IValueConverter; import org.eclipse.xtext.conversion.IValueConverter;
import org.eclipse.xtext.conversion.ValueConverter; import org.eclipse.xtext.conversion.ValueConverter;
import org.openhab.core.model.core.valueconverter.ValueTypeToStringConverter;
import com.google.inject.Inject; import com.google.inject.Inject;
@ -36,5 +36,4 @@ public class ThingValueConverters extends DefaultTerminalConverters {
public IValueConverter<String> UID() { public IValueConverter<String> UID() {
return uidToStringConverter; return uidToStringConverter;
} }
} }

View File

@ -15,11 +15,11 @@ package org.openhab.core.model.thing.valueconverter;
import java.util.Arrays; import java.util.Arrays;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.openhab.core.thing.UID;
import org.eclipse.xtext.conversion.IValueConverter; import org.eclipse.xtext.conversion.IValueConverter;
import org.eclipse.xtext.conversion.ValueConverterException; import org.eclipse.xtext.conversion.ValueConverterException;
import org.eclipse.xtext.nodemodel.INode; import org.eclipse.xtext.nodemodel.INode;
import org.eclipse.xtext.util.Strings; import org.eclipse.xtext.util.Strings;
import org.openhab.core.thing.UID;
/** /**
* A {@link UIDtoStringConverter} is used to create {@link UID} string * A {@link UIDtoStringConverter} is used to create {@link UID} string

View File

@ -119,7 +119,7 @@ public class TTSLRUCacheImpl implements TTSCache {
} }
}); });
} catch (RuntimeException re) { } catch (RuntimeException re) {
if (re.getCause() != null && re.getCause()instanceof TTSException ttse) { if (re.getCause() != null && re.getCause() instanceof TTSException ttse) {
throw ttse; throw ttse;
} else { } else {
throw re; throw re;

View File

@ -370,8 +370,8 @@ public class ItemRegistryImpl extends AbstractRegistry<Item, String, ItemProvide
@Override @Override
public @Nullable Item remove(String itemName, boolean recursive) { public @Nullable Item remove(String itemName, boolean recursive) {
return ((ManagedItemProvider) getManagedProvider() return ((ManagedItemProvider) getManagedProvider()
.orElseThrow(() -> new IllegalStateException("ManagedProvider is not available"))).remove(itemName, .orElseThrow(() -> new IllegalStateException("ManagedProvider is not available")))
recursive); .remove(itemName, recursive);
} }
@Override @Override

11
pom.xml
View File

@ -77,8 +77,9 @@
<sat.version>0.13.0</sat.version> <sat.version>0.13.0</sat.version>
<slf4j.version>1.7.32</slf4j.version> <slf4j.version>1.7.32</slf4j.version>
<xtext.version>2.29.0</xtext.version> <xtext.version>2.29.0</xtext.version>
<spotless.version>2.28.0</spotless.version> <spotless.version>2.35.0</spotless.version>
<spotless.eclipse.version>4.21.0</spotless.eclipse.version> <spotless.eclipse.version>4.26</spotless.eclipse.version>
<spotless.eclipse.wtp.version>4.21.0</spotless.eclipse.wtp.version>
</properties> </properties>
<dependencyManagement> <dependencyManagement>
@ -561,7 +562,7 @@ Import-Package: \\
<files> <files>
<file>openhab_wst_xml_files.prefs</file> <file>openhab_wst_xml_files.prefs</file>
</files> </files>
<version>${spotless.eclipse.version}</version> <version>${spotless.eclipse.wtp.version}</version>
</eclipseWtp> </eclipseWtp>
<trimTrailingWhitespace/> <trimTrailingWhitespace/>
<endWithNewline/> <endWithNewline/>
@ -576,7 +577,7 @@ Import-Package: \\
<files> <files>
<file>openhab_wst_feature_file.prefs</file> <file>openhab_wst_feature_file.prefs</file>
</files> </files>
<version>${spotless.eclipse.version}</version> <version>${spotless.eclipse.wtp.version}</version>
</eclipseWtp> </eclipseWtp>
<trimTrailingWhitespace/> <trimTrailingWhitespace/>
<endWithNewline/> <endWithNewline/>
@ -591,7 +592,7 @@ Import-Package: \\
<files> <files>
<file>openhab_wst_pom_file.prefs</file> <file>openhab_wst_pom_file.prefs</file>
</files> </files>
<version>${spotless.eclipse.version}</version> <version>${spotless.eclipse.wtp.version}</version>
</eclipseWtp> </eclipseWtp>
<trimTrailingWhitespace/> <trimTrailingWhitespace/>
<endWithNewline/> <endWithNewline/>