Location Types


The concurrency model of the ABS language is based on COGs (concurrent object groups). This means that every object belongs to a certain COG at runtime. Statically, Core ABS does not provide static information to which COG an object belongs to. However, this is important, because synchronous calls are only allowed on objects of the current COG.

From the perspective of an object, other objects are either near, if they belong to the same COG, or far if they belong to a different COG. Synchronous calls are only allowed on near objects. Location types are a way to statically ensure that synchronous calls can never be done on far objects.

Location Types

Types can be annotated with the following annotations to specify where the object at runtime has to be located. Near means that the object lives in the same COG as the current receiver object, Far means that it lives in a different COG, and Somewhere means that it can live in any COG, but we do not know exactly in which one. It is also possible to automatically infer the location type by using the Infer annotation (which is the default annotation and can thus be omitted). The following example shows how these annotations can be used:

module LocationTypes.Example;
interface I {}
class C implements I{};

  [Near] I n = new C();
  [Far] I f = new cog C();
  [Somewhere] I s = f;
  I i = n; // will infer Near

The location type system now statically guarantees that variable n can only refer to near objects, variable f can only refer to far objects, and variable s can refer to any object. The type system ensures this, by restricting the possible assignments of types with location annotations. Assignments are restricted by the following subtyping relation:

Subtyping Relation

       /    \
     Near   Far

Improved type checking

In order to improve the precision of the analysis, aliasing information is gathered by the inference tool. This allows the type checker to distinguish different far locations. The scope of this aliasing analysis has an impact on performance and can be configured (see below).


Enable location type checking

By default, location type checking is disabled. To enable it using the command line, the parameter -loctypes has to be provided. To enable it in the Eclipse plug-in, the project ABS settings dialog has to be used.

Default location type

If a type is not annotated with a location type, the location type checker assumes that it is annotated by the [Infer] annotation. However, it is possible to change this default to another annotation (e.g. [Somewhere]) using either the command line option -locdefault=Somewhere or setting it in the project ABS settings dialog when using the Eclipse plug-in.


To set the scope for the aliasing analysis, the command line option -locscope=scope can be used. To get a list of possible values, -h can be used. The scope can also be set in the Eclipse plug-in. The default value for this setting is CLASS_LOCAL_FAR.

Technical Details


This is realized by introducing a type annotation TypeLocation, which can be used to annotated types. TypeLocation is defined as followed:

data TypeLocation = Near | Far | Somewhere | Infer;

View-Point Adaption

The view-point adaption is defined as follows:

View-Point Adaption
TargetTypeAdapted Type