Fork me on GitHub

Deprecated API and Major Changes

This page provides the major changes into the SARL API that needs to update your source code (deprecated API, major changes, etc.).

This page is divided into two parts: the deprecated features from the SARL API, and the deprecated features from the SARL Run-time Environment (SRE).

1. Changes in the SARL API

1.1. Since 0.12

Deprecated TypeDeprecated FeatureRemoval?Replacement
io.sarl.lang.util.UtilscompareVersions(String, String)Yes Replace with compareMajorMinorVersions(String, String).
io.sarl.docs.validator.DocumentationLoggersetLogger(Logger)Yes No replacement.

1.2. Since 0.12

Deprecated Type or ModuleDeprecated FeatureReplacement
AbstractDocumentationMojogetBootClassPath No replacement.
AbstractSARLLaunchConfigurationgetClasspath Replace getClasspath(...) by getClasspathAndModulepath(...).
AddressgetUUID Replace getUUID by getID.
Module io.sarl.eclipse-slf4jall No replacement.
OpenEventSpaceregister Replace register(listener, true) by registerWeakParticipant(listener), and register(listener, false) by registerStrongParticipant(listener).
ReflectExtensionsgetDefaultNameFormatter Replace getDefaultNameFormatter by getDefaultMethodNameFormatter.
ReflectExtensionssetDefaultNameFormatter Replace setDefaultNameFormatter by setDefaultMethodNameFormatter.
SarlBatchCompilergetJavaBootClasspath No replacement.
SarlBatchCompilersetJavaBootClasspath No replacement.
SarlcConfiggetJavaBootClasspath No replacement.
SarlcConfigsetJavaBootClasspath No replacement.
SARLClasspathProvidergetJavaBootClasspath No replacement.
SARLClasspathProvidersetJavaBootClasspath No replacement.
ScriptExecutorsetBootClassPath No replacement.
SREBootstrapsetOffline No replacement.

1.3. Since 0.11

Deprecated TypeDeprecated FeatureReplacement
DefaultContextInteractionswillReceive Replace receiver.willReceive(new MyEvent) by emit(new MyEvent) [it.ID == receiver]. The number of functions in the API should be limited. This function is assumed to be redundant with emit.
Lifecyclereturn type of spawn In SRE 2.x, we could spawn an agent and get their assigned UUID code via the spawn method the Lifecycle capacity, e.g.:
val agent_UUID = spawn(typeof(MyAgent))
Because of problems and inconsistencies caused by the parallel execution of the spawn function, the return value of this method has been deprecated. The spawn function replies nothing since version 0.11 of the API. To spawn an agent and grab its UUID code, we first generate the identifier and then spawn the agent with it: ```sarl val agent_UUID = UUID::randomUUID spawnInContextWithID(typeof(MyAgent), agent_UUID, defaultContext) ``` (defaultContext is the short for getDefaultContext provided by DefaultContextInteractions)
or, with the version 0.12 of the API: ```sarl val agent_UUID = UUID::randomUUID spawnWithID(typeof(MyAgent), agent_UUID) ```
OpenEventSpaceregister Replace space.register(participant, isWeak) by registerStrongParticipant(participant) if isWeak is true, or registerWeakParticipant(participant) if isWeak is false. This change is applied by internal design on the space implementation.

1.4. Since 0.10

Deprecated TypeDeprecated FeatureRemoval VersionReplacement
DefaultContextInteractionsspawn Replace spawn(type, args) by Lifecycle.spawn(type, args). The definition of the spawn into DefaultContextInteractions is not expected by SARL users since this capacity seems to be dedicated to interactions. Lifecycle capacity is a better place for defining the spawn functions.
Loggingprintln Replace println(msg) by info(msg). The semantic of println is linked to the system console. Agents are supposed to log their messages on the agent console.
SarlSpecificationCheckergetSarlSpecificationVersion Replaced by getSarlSpecificationVersionObject. Change due to the change of the return type that is now of type Version.

1.5. Since 0.5

Deprecated TypeDeprecated FeatureRemoval VersionReplacement
DefaultContextInteractionsreceive0.10 Replace receiver.receive(new Event) by emit(new Event) [it.ID == receiver]. The number of functions in the API should be limited. This function is assumed to be redundant with emit.

2. Changes in the SARL Run-time Environment

3. Since 0.10 (Janus 3.0.10.0)

Deprecated TypeDeprecated FeatureRemoval VersionReplacement
BootsetOffline(boolean)0.10 This parameter is not any more needed in the kernel of Janus v3. Indeed, the Janus v3 kernel is now based on a new plugin architecture (based on the Bootique API). With this plugin API, we could write a core software (the kernel) with a minimum set of features and that could be extended with plugins by only adding these plugins on the classpath of the application. In the context of Janus, the network features were moved into a plugin. One could easily add the network feature by adding the corresponding plugin jar file in the classpath (equivalent to the old Boot.offline = false) or remove it from the classpath (equivalent to Boot.offline = true), or even add another networking plugin that is based on another technology (e.g. MQTT, etc.). So, Boot.offline function is not any more into the Janus kernel (i.e. the Boot class, see below) but into the configuration of the networking plugin. This plugin is under validation and is planned to be back in SARL 0.12.
BootsetVerboseLevel(level)0.10 This function is removed from Boot. The SRE utility class provides the replacing function. Note that it must be called before any launch of agent since the configuration level of Janus is set at start up.
BootstartJanus(type)0.10 In the old SRE 2.x, one would start an agent from Java by directly using the Boot class in Janus:
import io.janusproject.Boot
Boot.startJanus(typeof(MyAgent))
	
In order to avoid any problems due to changes into the Janus implementation, in SRE 3.x it is preferable to use the SRE utility class as follows: ```sarl var sre = SRE::bootstrap sre.startAgent(typeof(MyAgent)) ```

Copyright © 2014-2024 SARL.io, the Original Authors and Main Authors.

Documentation text and medias are licensed under the Creative Common CC-BY-SA-4.0; you may not use this file except in compliance with CC-BY-SA-4.0. You may obtain a copy of CC-BY-4.0.

Examples of SARL code are licensed under the Apache License, Version 2.0; you may not use this file except in compliance with the Apache License. You may obtain a copy of the Apache License.

You are free to reproduce the content of this page on copyleft websites such as Wikipedia.

Generated with the translator docs.generator 0.14.0.