PEF Structure

Language independent source representation versus Java-specific elements

The PEF types ending in a capital S (sourceFolderS, projectS, fileS) represent the language-independent organisation of Source code in projects, directories and files. All other PEF types represent language-specific elements of the Java AST. Their name ends in T, which is a mnemonic for Tree.

See the Migration guide for a more detailed discussion of language-independent versus language-dependent elements.

Program elements versus attributes, flags and relations

Among the PEF's that represent parts of the AST, we distinguish Program Elements from Attributes by the fact that elements have an own identity whereas attributes don't.

For uniformity (ease of remembering / reading) program elements always have their own identity in their first argument and the identity of their parent element in the second argument. Elements of method bodies (statements and expressions) additionally have the reference to the containing method or field (in case of initialisation blocks) as a third argument. This is actually just a shortcut for navigating up a possibly long path of parent references. It has been included for convenience since most interesting queries relate body level elements to their containing methods. There are no general rules about the structure / contents of other arguments.

Attributes represent information about program elements that is factored out, either because it is optional (which is mostly the case) or because it is multi-valued but unordered (such as the different modifiers of a program element). In the latter case, each value is represented by a separate PEF. Note that properties with multiple, ordered values are represented by lists as arguments of program elements.

We further distinguish several variants of attributes:

  • Flags are attributes that have the identity of the related program element as their only argument. For instance, the flag interfaceT(#class) indicates that a class is actually an interface.
  • Proper attributes are attributes that connect the identity of some program element to some primitive values (but not to identities of other program elements). For instance, modifierT(#element, 'modifier') is a proper attribute.
  • Relations are attributes that connect the identities of different program elements (they may additionally contain primitive values). For instance, extendsT(#class,#class) is a relation that indicates that one class type extends the other.
Last modified: 2014/08/16 21:50
*