EclipseCon 2007 March 5-8, Santa Clara California

Modeling Generics with Ecore

Ed Merks (IBM), Marcelo Paternostro (IBM)

· Long Talk

Tuesday, 11:10, 50 minutes | Grand Ballroom D


Marcelo Paternostro

As part of EMF's 2.3 development cycle, we have begun exploiting Java 5.0 in both the tools and the runtime. Initially, there were two apparent tasks. First, EMF's code generator needed to be updated to produce appropriate 5.0 constructs, such as EList as the type for multi-valued features, and real Java enums instead of the old class-based typesafe enum pattern. Secondly, the EMF runtime supporting these APIs needed to be generified. That is, EList and all its implementations needed to be made into generic types, just like the lists in the Java collection framework.

At first glance, these changes would seem sufficient, but they aren't because they don't allow one to describe generic types and generic methods. This means that these constructs cannot be generated. To fully exploit the promise of modeling, the ability to model these constructs is crucial. For this reason, EMF's meta-model, Ecore, had to be extended to introduce generics.

This long talk will explore in detail the changes in Ecore that allow it to model a generic type system. The approach taken in Ecore mirrors that used in the Java 5.0 reflection API. The result is a direct analog of Java's erasure-based type system: the existing type system in unchanged, while new features are added to support a more powerful, generic view. There are new constructs for modelling generic types and type parameters, but the existing type-related Ecore APIs continue to function as before. Thus, existing code and new, generics-aware code can both access the same Ecore instance. Generic constructs can be added via the new APIs and are erased in the view provided by the old APIs. The net effect of this approach is that, just as with Java 5.0, the option to exploit or ignore generics lies with the client.

We will demonstrate how these new features of Ecore can be used to describe generic types and methods, bounded type parameters, wildcards, and parameterized types, and we will explore the code that's generated from these new constructs. You'll leave with a good understanding of how you can exploit these exciting new capabilities of EMF 2.3. A minimal understanding of Ecore is assumed, but we will introduce the concepts at a high level to appeal to the widest possible audience.

Ed Merks is the project lead of the Eclipse Modeling Framework project and a co-lead of the top-level Modeling project. He has many years of in-depth experience in the design and implementation of languages, frameworks, and application development environments. He holds a Ph.D. in computing science and is a co-author of the authoritative "Eclipse Modeling Framework, A Developer's Guide" (Addison-Wesley 2003). He works for IBM Rational Software at the Toronto Lab.

Marcelo is a software engineer for IBM Rational Software at the Toronto Lab. He has worked with Eclipse technologies since joining the company in 2000. In the last 3 years, he has been a committer on the EMF project, being responsible for numerous changes and new features. Prior to that, he was a committer for the Hyades project which is now known as TPTP. Over the last 6 years, he has presented workshops and tutorials in conferences such as OOPSLA and EclipseCon. Before joining IBM, Marcelo worked for a Rational partner, managing several projects using Rational's tools and processes. As a certified instructor, he taught various courses on object oriented analysis and design; requirement management; and functional testing.

Floor Plan

Gold sponsors

Ingres logo

BEA logo

IBM logo

Business Objects logo

Klocwork logo

Windriver logo

Red Hat logo

Actuate logo

Silver sponsors

Compuware logo

Sybase logo

Google logo






Code Gear




Innoopract logo

Lynux Works

Media sponsors

Eclipse Magazine logo logo

Methods and Tools logo

Eclipsezone logo

Addison-Wesley logo

Eclipse Magazin logo

Embedded Computing logo

SD Times logo

Enterprise Open Source logo

ACM Queue logo

TheServerSide Java Symposium

Eclipse Review logo

Software Test & Performance logo

Eclipse Developers Journal logo

Eclipse Source logo