Skip to main content
Version: 🚧 Alpha 🚧

Migrating Java plugins from GAMA 2025-06 to 2026-11

This guide is for developers of Java plugins and contributors to GAMA. It describes the changes to the build environment and Java APIs between the stable GAMA 2025-06 release (2025.06.4) and GAMA 2026-11. Changes to GAML models are described in Migrating from GAMA 2025-06. The Changelog lists every change.

At a glance​

ChangeImpact
JDK 25 runtime/build and Eclipse 2026-03Rebuild plugins; the annotation processor remains Java 21-compatible
New gama.api modulePublic interfaces decoupled from gama.core implementation
Some constructors are no longer publicReplace direct GamaPoint and GamaMap construction with factories
Cast utility class reducedCasting delegated to individual IType implementations
AbstractPopulation centralises population logiccreateAgentAt renamed to createAgentAtIndex
IAgent now extends IDelegatingShapeAttribute mutation via containers is restricted
Apache Fory replaces FST for binary serializationFST binary saves must be regenerated; no legacy reader is provided
IType.NEW_TEMP_ID removedUse @facet(declares_new_temp = true) and explicit variable type metadata
Expanded built-in gama platform agentAdditive GAML actions; no migration is required unless you choose to use them
ChangeImpact
New OpenGL 4.1 display plugin (gama.ui.display.opengl4)Shader-based renderer available alongside the existing opengl renderer
New launching overlayVisual improvement only, no code changes needed
Major model-editing addition: Previous versionsBrowse, compare and restore saved workspace versions; no GAML migration required
Improved concurrency supportInternal threading improved; some scheduling APIs changed
Copilot integration extracted to gama.copilotInstall from its dedicated p2 site; no Copilot feature/module in the core reactor

JDK 25 and Eclipse 2026-03​

GAMA's runtime and build use Java 25 and Eclipse 2026-03. The annotation processor and annotations remain compatible with Java 21, the JDK used by Eclipse. Java 25 enables modern language features used throughout the engine:

  • Pattern matching for instanceof β€” eliminates redundant casts:
    // Old
    if (obj instanceof MyClass) { MyClass myVar = (MyClass) obj; ... }
    // New
    if (obj instanceof MyClass myVar) { ... }
  • Records, sealed classes, switch expressions β€” used internally for cleaner data modelling.
  • Superior concurrency β€” virtual threads and structured concurrency improve parallel simulation scheduling.

Action needed: Recompile runtime plugins against JDK 25. Keep the annotation processor compatible with Java 21; source changes may still be necessary for the API changes described below.

Binary serialization​

GAMA 2026 uses Apache Fory exclusively for binary serialization and experiment recording. Existing FST-produced simulation files and serialized objects cannot be read. Regenerate them from their source models using GAMA 2026. If their state must be retained, export the necessary model data in a portable format from the older GAMA version before upgrading.

Remove uses of gama.pref_binary_serializer from models and -Dgama.binary.serializer from launch arguments. Backend selection and the gama.extension.serialize.fst Java packages have been removed. Fory is supplied by gama.dependencies; plugins must not embed a second copy.

Optional Copilot integration and pre-workbench initialization​

GitHub Copilot remains optional, but its wrapper feature, integration plug-in, dependency documentation and publishing workflow now belong to gama.copilot. Packaged GAMA installs gama.feature.copilot through Support > Install GAMA extensions... > Install Copilot extension, using the dedicated p2 site https://gama-platform.org/gama.copilot/; use Support > Check for updates... after installation. Review the normal license and trust prompts. GitHub sign-in and Copilot entitlement are still handled by the upstream extension. The dedicated site contains only GAMA's wrapper and integration plug-in. p2 selects a compatible Copilot version from Microsoft's repository; platform dependencies remain on Eclipse 2026-03. Installation requires access to all three sites, and a newer Copilot requiring a newer Eclipse baseline cannot be installed merely because it is the latest upstream release.

Build migration: remove references to the former core gama.feature.copilot directory and -Pcopilot profile from custom build scripts. Build the standalone repository using its documented Maven procedure. Custom products that explicitly include gama.feature.copilot must resolve it from the dedicated p2 site rather than expecting a feature module in the core reactor. Ordinary GAMA builds have no Copilot dependency. Generic GAML editor support for external providers remains in the core repository; report integration-specific issues in the standalone tracker.

Optional integration API: gama.ui.application.startup accepts contributions of the following form:

<extension point="gama.ui.application.startup">
<startup class="example.integration.StartupPreferences"/>
</extension>

The class must implement java.lang.Runnable and have a public no-argument constructor. GAMA invokes it synchronously on the UI thread after creating the display, before workspace selection or workbench creation. Keep initialization brief and independent of contribution order; do not access the workspace or workbench at this stage. Contribution failures are logged without preventing other contributions from running. The Copilot integration uses this hook to seed its configuration preferences without overwriting existing user settings.

The gama.api module​

The introduction of gama.api separates many shared contracts and types from gama.core.

Before (GAMA 2025 and earlier):

  • Public interfaces and their implementations lived side by side in gama.core.
  • Plugin developers ended up importing implementation classes directly.

After (GAMA 2026):

  • gama.api contains interfaces (IAgent, IPoint, IList, …), as well as implementation classes and factories needed by the shared API.
  • Other runtime implementations remain in gama.core. Plugins can depend on gama.api for shared contracts and also on gama.core when they need its implementation classes.

Update imports and bundle dependencies according to the classes the plugin actually uses.

See Package mapping for the full import mapping.

Java Annotations - Import Path Changed​

All GAML-related Java annotations have moved to top-level interfaces in gama.annotations. Update your imports accordingly.

// Before
import gama.annotations.precompiler.GamlAnnotations.operator;
import gama.annotations.precompiler.GamlAnnotations.skill;

// After
import gama.annotations.operator;
import gama.annotations.skill;

Complete list of affected annotations:

@action, @arg, @constant, @display, @doc, @example, @experiment, @facet, @facets, @file, @getter, @inside, @listener, @no_test, @operator, @setter, @skill, @species, @symbol, @test, @type, @usage, @variable, @vars

Also note: IKeyword has moved:

// Before
import gama.core.common.interfaces.IKeyword;

// After
import gama.annotations.constants.IKeyword;

Temporary-declaring facets: replacing NEW_TEMP_ID​

IType.NEW_TEMP_ID has been removed. Declaring a temporary identifier and describing its type are now independent: set declares_new_temp = true on the @facet, then use type, of (container contents), and index (container keys) to describe the variable.

// Before: the compiler needed statement-specific rules to determine the variable type.
@facet(name = IKeyword.RETURNS, type = IType.NEW_TEMP_ID, optional = true)

// After: a fixed list<float>, as used by benchmark returns:.
@facet(name = IKeyword.RETURNS, declares_new_temp = true,
type = IType.LIST, of = IType.FLOAT, optional = true)

// After: a list of the statement's selected species, as used by create returns:.
@facet(name = IKeyword.RETURNS, declares_new_temp = true,
type = IType.LIST, of = ITypeProvider.STATEMENT_TYPE, optional = true)

Use gama.api.gaml.types.IType and gama.annotations.support.ITypeProvider. Every declaring facet must specify exactly one outer type. of alone does not imply a list: use type = IType.LIST explicitly. A fixed map, for example, uses type = IType.MAP, index = IType.STRING, of = IType.FLOAT.

Two contextual providers can be used in any of type, of, and index:

ProviderMeaningExisting uses
STATEMENT_TYPEThe computed type of the statement, including its species/target facetsContents of the result lists from create, capture, release, and migrate
INFERRED_TYPEThe statement's declared type, or its existing value/iteration inference when no type is declaredlet, loop, arg, and user_input temporary variables

INFERRED_TYPE retains nested container parameters, such as list<list<int>> or map<string, list<float>>. Do not substitute OWNER_TYPE: that existing provider refers to an owning species/operand, not the statement's computed type. Other negative provider IDs are not supported on temporary-declaring facets.

The annotation controls identifier handling and static typing, not runtime assignment. A statement implementation must still create and populate its temporary in the matching runtime scope. For a result that must remain visible after a sequence, initialize the variable in the enclosing frame before entering the sequence's own scope.

Action needed: migrate affected annotations, rebuild gama.annotations and gama.processor, then clean/rebuild dependent bundles so their generated GamlAdditions use the new metadata. Custom implementations/callers of IArtefactFactory.createFacetArtefact must pass the new declaresNewTemp boolean; custom facet artefacts must expose their raw content/key descriptors through getContentTypeProvider() and getKeyTypeProvider(). Ordinary expression facets keep declares_new_temp = false (the default).


Facet compilation contexts for plugin developers​

The context member of @facet declares where an expression is compiled:

import gama.annotations.facet;
import gama.annotations.constants.IKeyword;
import gama.api.gaml.types.IType;

@facet(name = IKeyword.MINIMIZE, type = IType.FLOAT, optional = true,
context = facet.Context.MODEL)

ENCLOSING is the default and preserves the ordinary enclosing context. MODEL resolves names and species-relative types against the enclosing model while retaining the declaration's structural parent. It is per facet: do not switch an entire batch method to the model context, because its configuration facets are experiment expressions. MODEL does not mean β€œwhatever simulation is currently selected”, and is not an implicit ask or a runtime scope switch. CALLER and CALLEE are not currently supported values.

The annotation processor passes non-default context metadata through AbstractGamlAdditions and IArtefactFactory into IArtefact.Facet; the compiler's SymbolDescription.getFacetCompilationContext uses it when compiling ordinary expression facets. Labels are handled as labels, not as ordinary compiled expressions. IDescription.getEnclosingDescription() is still the structural parent; getEnclosingContext() controls expression lookup and typing. Do not change structural ancestry merely to resolve a facet against a model. remote_context is a different mechanism: it describes the target of a remote statement and its self/myself relationship.

The symbol implementation is responsible for matching runtime evaluation to the declared compilation context. For result facets, use the scope of the specific simulation whose result is being collected, not the experiment scope or a global/frontmost scope. The batch implementation evaluates fitness and reads tracked attributes on the completed simulation's thread and scope. outputs: extracts names from its list entries; it is not a general expression evaluator. The experiment's until: and record: use the same MODEL metadata, but are evaluated at their respective stop and recording points.

Optimization configuration is initialized with the batch experiment scope through initializeFor, rather than the globally current scope during construction. This occurs before the experiment's GAML init behavior; do not rely on values assigned there when initializing those configuration facets. Overrides of initializeFor must preserve the superclass initialization.

Rebuild the annotation processor and regenerate the declaring bundle's GAML contributions after changing facet metadata. Existing factories and facet artefacts default to ENCLOSING; a custom IArtefactFactory must implement the context-aware overload and return a facet whose getCompilationContext() reports MODEL when it supports that context. The default overload explicitly rejects unsupported non-default contexts instead of silently compiling them as ENCLOSING. Inspect generated contributions when diagnosing incremental annotation processing.

Experiment user_command ownership is a separate, dynamic-by-declaration rule: of: changes the command description's enclosing lookup context, its body and its passed arguments. Its structural parent stays the experiment. At runtime, dispatch on the selected owner and use that owner's scope; preserve caller arguments when crossing scopes. The parameters panel dispatches on the selected experiment or simulation executor. A simulation-scoped invocation retains that simulation; an experiment-scoped invocation resolves the current simulation. Do not iterate over all simulations as an implicit fallback.

The experiment's actions_context: is distinct from facet metadata and command ownership. IExperimentDescription.actionsUseSimulation identifies eligible direct user-action declarations; ActionDescription.getEnclosingContext selects model lookup while the structural parent remains the experiment. ActionStatement dispatches on the receiving experiment's current simulation using that simulation's scope. Caller arguments must be evaluated before the scope change; defaults are evaluated in the action context. Preserve synthetic callbacks, built-in actions and inherited declaration contexts.

Likewise, ExperimentAgent.getPopulationFor no longer forwards ordinary model-species requests to its current simulation or fabricates an empty population. It still handles its simulation population and directly imported comodel-experiment populations. Resolve an ordinary population through the intended simulation agent; SimulationAgent.getPopulationFor preserves the simulation's species resolution. A known invalid create is rejected by CreateStatement validation, but dynamic requests still need the runtime guard. See the experiment guide for model-facing behavior and compatibility.

IAgent Interface Changes​

IAgent has been redesigned and moved to the gama.api module.

What changed​

AspectBeforeAfter
Packagegama.core.metamodel.agent.IAgentgama.api.kernel.agent.IAgent
ExtendsIShape, IAttributedIDelegatingShape
Container typeIContainer.Addressable<String, Object>IContainer.ToGet<String, Object>
getLocation() return typeGamaPointIPoint
setPeers()Abstract interface methodEmpty default method

Practical impact​

  • Do not mutate agent attributes through the container interface. Use proper variable evaluation via scope.evaluate(expression, agent).
  • Location access is now interface-typed. If you need a concrete GamaPoint, cast explicitly β€” but prefer working with IPoint.
  • getGeometry() already returned IShape in 2025-06. getPeers() still returns an IList; the usual agent implementation returns a copy. Do not rely on the default setPeers() to change peers.

Population API Changes (AbstractPopulation)​

New base class​

Population implementations can extend gama.core.population.AbstractPopulation, which centralises common logic that was previously duplicated.

IPopulation API changes​

MemberChange
IsLiving (nested predicate class)Removed β€” inline the predicate in your own code
createAgentAt(...)Renamed to createAgentAtIndex(...)
createOneAgent(...)Added as a default method
fireAgentsAdded(...)No longer a default method β€” must be implemented explicitly

Package Mapping: gama.api Module​

General rule: Update imports for classes moved to gama.api using the tables below. Classes that remain in gama.core retain that dependency; replacing every package prefix mechanically is unsafe.

GAML Types β†’ gama.api.gaml.types.*​

IType, ITyped, ITypesManager, Signature, GamaActionType, GamaAgentType, GamaBoolType, GamaColorType, GamaContainerType, GamaDateType, GamaDirectoryType, GamaFieldType, GamaFileType, GamaFloatType, GamaFontType, and all other Gama*Type classes.

Java Data Structures β†’ gama.api.types.*​

CategoryInterfaces & Classes
ColorsIColor, GamaColor, GamaColorFactory
DatesIDate, GamaDate, GamaDateInterval, GamaDateFactory
FilesIGamaFile, GamaFile, GenericFile
FontsIFont, GamaFont, GamaFontFactory
GeometryIShape, IPoint, IDelegatingShape, GamaPoint, GamaPointFactory, GamaShapeFactory, IShapeFactory
GraphsIGraph, IPath, GraphObject, GamaGraphFactory, GamaPathFactory
ListsIList, GamaList, GamaPairList, GamaListFactory
MapsIMap, GamaMap, GamaMapFactory
MatricesIMatrix, IField, GamaMatrixFactory
MessagesIMessage, GamaMessageFactory
PairsIPair, GamaPairFactory
TopologyITopology, AmorphousTopology, GamaTopologyFactory

Expressions and AST β†’ gama.api.gaml.* & gama.api.compilation.*​

IExpression, IStatement, IDescription, ISymbolDescriptionFactory, IExpressionFactory, ISyntacticFactory

UI and Displays β†’ gama.api.ui.*​

IGui, IDialogFactory, IStatusDisplayer, IConsoleListener, IDisplaySurface, IGraphics, IDisplayData, IChart, ILayer, ICameraDefinition, IDrawingAttributes

Core Utilities β†’ gama.api.utils.*​

FileUtils, GamaPreferences, StringUtils, JavaUtils, MathUtils, CsvReader, CsvWriter, IJson, IJsonObject, GamaRNG, RandomUtils


Factory Pattern - Replace Inaccessible Constructors​

Some formerly public constructors are no longer accessible outside their packages. Use the corresponding factories where a constructor has become inaccessible.

Why? Factories enforce correct type metadata and scope-awareness that constructors cannot guarantee.

TypeBeforeAfter
IMapnew GamaMap(10, Types.STRING, Types.INT)GamaMapFactory.create(Types.STRING, Types.INT, 10)
IPointnew GamaPoint(1.0, 2.0)GamaPointFactory.create(1.0, 2.0)

GamaList constructors were already protected in 2025-06, and GamaListFactory already existed. For typed collections, supply the appropriate element types, e.g. GamaListFactory.create(Types.STRING).


Casting - From Cast to IType​

The static Cast utility class has been significantly reduced. Type-specific casting methods have been removed and are now handled by the IType implementations directly.

What remains in Cast: Primitive conversions β€” asInt, asFloat, asString, asAgent β€” are still available at gama.api.gaml.types.Cast.

TypeBeforeAfter
IPointCast.asPoint(scope, obj)Types.POINT.cast(scope, obj, null, false)
IListCast.asList(scope, obj)Types.LIST.cast(scope, obj, null, false)
IMapCast.asMap(scope, obj, copy)Types.MAP.cast(scope, obj, null, copy)
IShapeCast.asGeometry(scope, obj)Types.GEOMETRY.cast(scope, obj, null, false)
IMatrixCast.asMatrix(scope, obj)Types.MATRIX.cast(scope, obj, null, false)

Parameter guide for IType.cast(scope, obj, param, copy):

ParameterMeaning
scopeThe current execution scope
objThe object to cast
paramAn optional type parameter (usually null)
copytrue to return a copy, false to allow returning the original

Java-backed built-in classes​

Plugins can contribute non-agent GAML classes using @gaml_class. Unlike an ordinary operator, a class constructor accepts zero arguments: counter c <- counter();.

import gama.annotations.*;
import gama.api.gaml.types.IType;
import gama.api.kernel.object.IClass;
import gama.api.runtime.scope.IScope;
import gama.core.object.GamlObject;

@gaml_class(name = "counter", doc = @doc("A non-agent counter."))
@vars(@variable(name = "value", type = IType.INT, init = "0",
doc = @doc("The current count.")))
public class Counter extends GamlObject {
private int value;

public Counter(final IScope scope, final IClass clazz) {
super(clazz);
}

@getter("value")
public int getValue() { return value; }

@setter("value")
public void setValue(final int value) { this.value = value; }

@action(name = "increment", doc = @doc("Increment this counter."))
public Integer increment(final IScope scope) { return ++value; }
}

The existing annotation processor generates the registration and factory; the plugin must contribute its generated additions through gaml.extension, as for species. Concrete implementations must be public, implement IObject, and provide a public (IScope, IClass) constructor. Nested implementations must be static. Extending GamlObject requires a dependency on gama.core; implementing IObject directly requires only gama.api.

Java construction finishes before GAML attributes are initialized. Call super(clazz), not the older initializing GamlObject(IScope, IClass, Map) constructor, and do not initialize GAML attributes yourself. Named arguments, init expressions, and type defaults are applied afterward through the annotated setters. A getter marked initializer = true can provide the initial Java value when no argument or init expression is given.

counter c <- counter();
counter initialized <- counter(value: 10);
int result <- initialized.increment();

class labeled_counter parent: counter {
string label <- "example";
}

The nearest registered Java superclass becomes the GAML parent; otherwise it is object. Attributes, actions, and the Java instance factory are inherited by model-defined subclasses. Abstract Java implementations can be registered without a factory, but cannot be instantiated, including through a GAML-only subclass. A concrete Java subclass must supply the implementation. Native classes can also be used directly as Java operator parameter and return types without a separate @type declaration.

Java class and species descriptions now expose their factory through the same getConstructor() accessor, replacing getObjectConstructor() and getAgentConstructor(). Both factories implement IConstructor<T, A, B>: IObjectConstructor creates an object from (IScope, IClass), while IAgentConstructor creates an agent from (IPopulation<?>, Integer). Species descriptions narrow the return type to IAgentConstructor; its existing primitive-index createOneAgent(population, index) method and constructor method references remain supported.

Asynchronous save delegates​

save has an opt-in async: true facet (#740). The first implementation covers images and display snapshots: the value is computed synchronously, then encoded and written on a background thread. The same mechanism can be used to speed up other file formats.

No migration is required. To support asynchronous saves in an extension's save delegate:

@Override
public boolean supportsAsync() { return true; }

@Override
public void save(IScope scope, IExpression item, Object value, File file, SaveOptions options)
throws IOException {
if (!options.async()) { writeNow(value, file); return; }
MyData copy = copyMutableState(scope, value); // synchronous, while the scope is valid
MyAsyncWriter.enqueue(copy, file); // ordered, bounded, reports its own errors
}

The background task must not use IScope and must not read agents or other mutable model values. Preserve write order, bound queued work, and report failures explicitly. save rejects async: true when supportsAsync() returns false, which is the default. SaveOptions.withAsync(boolean) creates options with the flag set; the former canonical constructor remains available and keeps saves synchronous. See gama.extension.image.AsyncImageWriter for a reference implementation and the changelog for the requirements.

Default values of lists and maps​

Java contributors: use IType.createDefaultValue(scope) for omitted initialization, not cast(scope, null, ...). getDefault() remains the type's fallback/nullability value. The Java construction helpers GamaListFactory.castToList and GamaMapFactory.castToMap still

See Lists and maps: absence is not emptiness for the GAML behavior.

New OpenGL 4.1 Display Plugin​

The new gama.ui.display.opengl4 plugin provides an OpenGL 4.1 Core Profile renderer:

  • opengl4 uses shaders, VAOs and VBOs instead of fixed-function APIs.
  • The existing opengl renderer remains available; displays do not have to switch to opengl4.

Action needed for display plugin authors: Review renderer-specific code if integrating with opengl4; code targeting the existing opengl renderer is not automatically required to use it.

Contributing models from a plugin​

The gama.models extension point has been removed. A plugin now contributes models by shipping GAMA projects in a conventional folder structure; the category is given by the folder, not by the project nature:

my.plugin/
models/
Library/<GAMA project>/...
Recipes/<GAMA project>/...
Tests/<GAMA project>/... (also Data, Demos, Tutorials)

Remove the gama.models contribution from plugin.xml, move the projects under the matching models/<category>/ folder, and make sure build.properties includes models/. The GAMA project nature is now gama.workspace.nature; former nature ids are still recognised and migrated.