Skip to main content

Object Teams - Features of the OTDT

The OTDT contains a modified version of the JDT core
and several added plugins.

See also:
>>The OTDT user guide
(this is also bundled with the OTDT as online help)

Compiler

The Object Teams Compiler is an incremental compiler, based on the Eclipse Compiler for Java.
Language Definition
The compiler implements the language as defined in the OT/J language definition version 1.3.1 (OTJLD). The language definition has continuously been revised to precisely specify the language including various corner cases and combinations of features.
Language Implementation
The compiler supports all features of OT/J according to the otjld OTJLD v1.3.1 §§1-7,9. Support for the join point sub-language (otjld OTJLD § 8) is not included.

The compiler can be configured using global Preferences or project specific Properties.
  • Configure OT/J-specific compiler diagnostics as "ignore", "warning" or "error".
    Any warnings configured on this property sheet can also be suppressed in the source code using the @SuppressWarnings annotation.
  • Scoped keywords otjld OTJLD § A.0.1 can be disabled (default is enabled).

Wizards

  • The first step to developing with Object Teams in Eclipse is creating an  Object Teams Project. A wizard will guide you through that process. It will also add the Object Teams Runtime Environment (otre.jar) to your project's classpath.
  • Having done that, you can start adding classes — be it regular classes, or team or role classes — wizards will assist you in creating the classes properly.

Editor

  • Editing Object Teams source code is supported by an outline view, showing the structure of the edited source file. This includes the Object Teams specific constructs, teams (), roles (), and method bindings (, , , ).
  • The editor highlights the Object Teams keywords like "team" the same way standard Java keywords are highlighted.
  • All constructs referencing other code elements are navigable. E.g. you can navigate super(), tsuper(), base() calls, as well as callin and callout bindings. The name in a team package declaration lets you navigate from a role file (otjld OTJLD § 1.2.5) to its enclosing team.
  • Classes to which one or more roles are bound using playedBy are annotated with a marker (), that allows navigating to the role declaration(s). Similarly, methods in a base class that are bound with a callin binding are annotated with a marker (), that allows navigating to the method binding declaration(s).
    Because this feature may be resource-consuming in a large workspace the global Object Teams preferences page allows to completely disable the generation of callin markers.
  • Semantic highlighting (checkbox "mark occurrences") is fully supported.
  • Code completion (Ctrl-space) is widely supported. It is, e.g., possible to use completion in order to create a callout binding.
  • Content assist provides quick-fixes (Ctrl-1) for a number of OT/J specific errors and warnings. Also a few templates for specific OT/J language constructs — namely with{} and within (Expression){} — are available.

Binding Editor

  • Supports easy creation of connector definitions using a table based graphical user interface. In this context, a connector is meant to be a team that inherits structure (roles) and functionality (methods) from its super-team, and its main purpose is to bind the inherited structure and functionality using playedBy declarations and callin/callout method bindings.
  • Type bindings (playedBy) can be defined by choosing a provided role type and the desired base type with a type selection dialog.
  • Method bindings (either callin or callout) can be established by choosing a role method and a base method from the provided role and base method list respectively.
    • Only appropriate binding kinds are selectable in the corresponding context (callin or callout).
    • Besides the provided role methods, a new role method can be implemented by selecting a provided base method, thus creating a callout binding.
  • Parameter and result mappings are definable by typing in an expression in the corresponding text field of the parameter mapping configuration tab.
The binding editor can be opened either from the new team wizard or using the package explore's context menu ( Open Binding Editor).

Refactoring

Significant work has been put into supporting the automated refactoring of OT/J code. The following refactorings take into account the Object Teams-specific relationships (implicit role inheritance, team nesting, role-base bindings and method bindings).
  • Extract Method
  • Move Method
  • Pull Up applicable to method or field
  • Push Down applicable to method or field
  • Rename applicable to: project, source folder, package, type, method, field.
    When trying to rename a team package you'll be asked to rename the team class instead.
Additionally, specific refactorings for OT/J are being developed. Currently these are implemented:
  • Extract Callin
  • Inline Callin
  • Move to Role File

Structure Viewers

The Package Explorer
  • provides access to all project artifacts and their structure, i.e. source files, used libraries (jar-files), and other documents. Note that team and role classes are annotated with distinct icons ( for teams and for roles). (The same icons are used throughout the IDE, whenever a team or role is visible.)
  • If "Java Type Indicators" is enabled under general preferences/label decorations, OT-specific decorations will also be applied to compilation units (files) and team packages.
  • By opening the tree-branches, you can peek at the structure of e.g. classes.
  • For team classes, there is special support for role files ( OTJLD § 1.2.5):
    Role files are separate files and can be shown either physically () as (separate) files in the team package or logically () as member types of the enclosing team.
  • Furthermore, the Package Explorer provides the current context for other operations. The Team- and Role-Wizards, for example, have a pre-set source folder, package and enclosing class when a team is selected in the Package Explorer.
The Hierarchy View
  • Object Teams intruduce a new type hierarchy. Besides the normal ("extends") inheritance, there is an additional "implicit" role inheritance, established by role name equality in a team hierarchy. In conjunction with team nesting roles support a controlled form of multiple inheritance.
  • The new implicit inheritance has been integrated completely into the standard JDT Hierarchy View.
Java Structure Compare
  • When comparing versions of an OT/J file, the Java Structure Compare will correctly render Object Teams elements, too.
  • When selecting a callin replace binding, an action "Compare With > Bound Base Method" is available via the context menu, which easily let's you compare the method implementations of role and base.

Search references
  • The Java Search functionality has been extended to include search results of Object Teams code, that is, callin and callout bindings, and playedBy-relationships.
Call hierarchy
  • Also the call hierarchy has been extended for browsing control flows passing through method bindings (callin and callout).
  • The OTDT introduced support for call hierarchies regarding field accesses (read, write, any) and class instantiations. As of version 3.4 this functionality has been adopted by Eclipse.
  • OT/J constructs that may cause role creation due to lifting are considered by the call hierarchy as calling the role's lifting constructor.

Execution Environment

Aspect weaving
  • All aspect oriented languages have some kind of weaving process, where the aspect code is combined with the other (base) code.
  • Object Teams programs perform the weaving at application startup time, i.e. at the moment, the program is launched. In order to do this, there is the so-called Object Teams Runtime Environment (OTRE), that hooks into the class-loading process.
  • All this is handled transparently using the standard Eclipse "Run" feature. Running any main class of an Object Teams project automatically includes the OTRE.
Weaving schemes
  • Since version 2.3, the OTDT ships with two distinct weavers with the properties mentioned below. Since the OT/J compiler performs some preparation for the respective weaver, it has to generate different byte code formats, depending on the targeted weaving scheme. As a result, switching from one weaving scheme to the other requires a full recompilation of all OT/J code involved.
    • OTRE: This is the traditional load-time weaver. This weaver has matured over many years, but unfortunately, the underlying library BCEL has been lagging behind the evolution of Java itself. As a result this weaver is not currently maintained (it may still work using Java 7 and below, though).
    • OTDRE: The newer Object Teams Dynamic Runtime Environment has been developed to enable even runtime weaving. To work around limitations of the JVM this weaver has to insert a few general hooks into every weavable class. This weaver is also interesting for weaving into class files of recent Java versions, as it is based on the library ASM, for which timely updates are provided to match the latest Java version. Starting with OTDT version 2.5, this new weaver is considered mature for productive work (and constantly improved since).
Aspect deployment/activation
  • A new "Team Activation" tab in the "Run-Configuration" allows to instantiate and activate teams without modifying the program's source code.
  • Teams that cause aspect code to be woven into an application can be added to a program
    • by explicit reference within the program source code or
    • by a configuration file which is mentioned as a parameter to the VM or
    • by adding them via the aforementioned "Team Activation" tab.
    No such configuration is needed for compilation.
Technology used
  • Integrating the weaver into the JVM leverages the Java-agent concept of Java 5 (JPLIS). (The original implementation using the JMangler framework is no longer maintained).

OT/Equinox

Starting with the OTDT version 0.9.9 (2006) it is possible to develop Eclipse plugins using OT/J as the implementation language.
  • Using the plugin org.eclipse.objectteams.otequinox, a plugin ("aspect plugin") may declare that it adapts classes from a specified other plugin ("base plugin").
  • By an integration of the Object Teams Runtime Environment with hooks in the Equinox implementation a team class from an aspect plugin can trigger byte-code aspect weaving into its base plugin at load-time. As a result an aspect plugin can indeed adapt the behaviour of another plugin. These bindings are declared using the extension point aspectBindings from the mentioned plugin org.eclipse.objectteams.otequinox.
  • The initial client of the OT/Equinox technology is a tiny plugin which extends Eclipse's "about plugins" dialog by additionally displaying which plugins are being adapted by which aspect plugins. This information is found in the version column of the mentioned dialog. This way a user of the OTDT can always check whether a given plugin performs as shipped, or whether it has been adapted by another plugin.
  • The OTDT uses the capabilities of OT/Equinox for its own implementation. The technology is mainly used for making the JDT-UI aware of Object Teams without having to copy source code or modifying source code of the JDT-UI in place.
  • A new project nature Object Teams Plugin Project is provided, supporting the development of plugins written in OT/J.
  • Support for OT/Equinox is added to the run/debug dialogs for all Equinox related launches.
  • If desired the load-time weaver can be disabled by adding the following line to the file eclipse.ini after a -vmargs line:
    -Dot.equinox=false
    .

Debugging

The debugger has been enhanced to support debugging of OT/J programs at the source code level. It is possible to set breakpoints and step through Object Teams code.
Stepping through Code
The following language features produce byte codes for which a standard Java debugger is not able to display appropriate source locations: The OTDT-Debugger re-maps the byte codes produced by all this constructs to the appropriate source locations. As a result stepping through these sections of a program completely hides the internal translations from the user.

The following features are not yet fully supported by the debugger:
Setting Breakpoints
Use double click on ruler or context menu Toggle Breakpoint to set breakpoints in OT/J-Code. Setting breakpoint in role files is supported, too.
New View: "Team Monitor"
The team monitor () view helps to debug issues related to team activation ( OTJLD § 5). For this purpose it displays all known team instances and shows their activation status as one of
  • inactive ,
  • active (either globally or for the thread selected in the debug view), or
  • implicitly active (temporarily active because the team or one of its roles is currently executing code).
Also, a selected team can be (de)activated interactively via the context menu.
Filtering variables
The OT/J compiler and the loadtime weaver both add some internal variables to the code. By default such internal variables are hidden within the Team Monitor as well as in the standard variables view. Both views can be configured to also show these internal variables if so desired.
Known Issues and Limitations
  • Dynamic code evaluation is not supported yet, make sure to clear the Expression view.

Help and additional Information

The following sources for help and for further information are bundled with the release:
  • A Tutorial (available via the welcome page) guiding through the first steps of using the OTDT.
  • Example programs demonstrating key features of Object Teams (also via the welcome page).
  • A detailed guide on using the OTDT via the Help Index, including a link to the language definition (which is also bundled).
  • Problems that are listed in the problem view are linked (when possible) to a corresponding explanatory entry in the language definition. (Context menu ->  Go to Language Definition).

Back to the top