blob: 85497e1706ca8673a0ca7fd039da7eeefc0f9022 [file] [log] [blame]
--
-- *******************************************************************************
-- Copyright (c) 2009 Mia-Software.
-- All rights reserved. This program and the accompanying materials
-- are made available under the terms of the Eclipse Public License v1.0
-- which accompanies this distribution, and is available at
-- http://www.eclipse.org/legal/epl-v10.html
--
-- Contributors:
--
-- Fabien Giquel (Mia-Software) - initial API and implementation
-- *******************************************************************************
--
--
-- @nsURI http://www.eclipse.org/MoDisco/Java/0.2.incubation/java
-- @nsPrefix java
package java {
abstract class AbstractMethodDeclaration extends BodyDeclaration {
reference body[0-1] container : Block;
reference parameters[*] ordered container : SingleVariableDeclaration oppositeOf methodDeclaration;
reference thrownExceptions[*] ordered container : TypeAccess;
reference typeParameters[*] ordered container : TypeParameter;
reference usagesInDocComments[*] : MethodRef oppositeOf method; -- NamedElementRef substitute opposite
reference usages[*] : AbstractMethodInvocation oppositeOf method; -- NamedElementRef substitute opposite
}
abstract class AbstractMethodInvocation extends ASTNode {
reference method : AbstractMethodDeclaration oppositeOf usages; -- NamedElementRef substitute
reference arguments[*] ordered container : Expression;
reference typeArguments[*] ordered container : TypeAccess;
}
abstract class AbstractTypeDeclaration extends BodyDeclaration, Type {
reference bodyDeclarations[*] ordered container : BodyDeclaration oppositeOf abstractTypeDeclaration;
reference commentsBeforeBody[*] ordered container : Comment;
reference commentsAfterBody[*] ordered container : Comment;
reference "package"[0-1] : Package oppositeOf ownedElements;
reference superInterfaces[*] ordered container : TypeAccess;
}
abstract class AbstractTypeQualifiedExpression extends Expression {
reference qualifier[0-1] container : TypeAccess;
}
abstract class AbstractVariablesContainer extends ASTNode {
reference type[0-1] container : TypeAccess;
reference fragments[*] ordered container : VariableDeclarationFragment oppositeOf variablesContainer;
}
class Annotation extends Expression {
reference type container : TypeAccess;
reference values[*] ordered container : AnnotationMemberValuePair;
}
class Archive extends NamedElement {
attribute originalFilePath : String;
reference classFiles[*] container : ClassFile;
reference manifest[0-1] container : Manifest;
}
class AssertStatement extends Statement {
reference message[0-1] container : Expression;
reference expression container : Expression;
}
abstract class ASTNode {
reference comments[*] ordered container : Comment;
reference originalCompilationUnit[0-1] : CompilationUnit;
reference originalClassFile[0-1] : ClassFile;
}
class AnnotationMemberValuePair extends NamedElement {
reference member[0-1] : AnnotationTypeMemberDeclaration oppositeOf usages; -- NamedElementRef substitute
reference value container : Expression;
}
class AnnotationTypeDeclaration extends AbstractTypeDeclaration {
}
class AnnotationTypeMemberDeclaration extends BodyDeclaration {
reference default[0-1] container : Expression;
reference type container : TypeAccess;
reference usages[*] : AnnotationMemberValuePair oppositeOf member; -- NamedElementRef substitute opposite
}
class AnonymousClassDeclaration extends ASTNode {
reference bodyDeclarations[*] ordered container : BodyDeclaration oppositeOf anonymousClassDeclarationOwner;
reference classInstanceCreation[0-1] : ClassInstanceCreation oppositeOf anonymousClassDeclaration;
}
class ArrayAccess extends Expression {
reference array container : Expression;
reference index container : Expression;
}
class ArrayCreation extends Expression {
reference dimensions[*] ordered container : Expression;
reference initializer[0-1] container : ArrayInitializer;
reference type container : TypeAccess ;
}
class ArrayInitializer extends Expression {
reference expressions[*] ordered container : Expression;
}
class ArrayLengthAccess extends Expression {
reference array container : Expression;
}
class ArrayType extends Type {
attribute dimensions : Integer;
reference elementType container : TypeAccess ;
}
class Assignment extends Expression {
reference leftHandSide container : Expression;
attribute operator : AssignmentKind;
reference rightHandSide container : Expression;
}
enumeration AssignmentKind {
-- @literalValue "="
literal ASSIGN;
-- @literalValue "+="
literal PLUS_ASSIGN;
-- @literalValue "-="
literal MINUS_ASSIGN;
-- @literalValue "*="
literal TIMES_ASSIGN;
-- @literalValue "/="
literal DIVIDE_ASSIGN;
-- @literalValue "&="
literal BIT_AND_ASSIGN;
-- @literalValue "|="
literal BIT_OR_ASSIGN;
-- @literalValue "^="
literal BIT_XOR_ASSIGN;
-- @literalValue "%="
literal REMAINDER_ASSIGN;
-- @literalValue "<<="
literal LEFT_SHIFT_ASSIGN;
-- @literalValue ">>="
literal RIGHT_SHIFT_SIGNED_ASSIGN;
-- @literalValue ">>>="
literal RIGHT_SHIFT_UNSIGNED_ASSIGN;
}
abstract class BodyDeclaration extends NamedElement {
reference abstractTypeDeclaration[0-1] : AbstractTypeDeclaration oppositeOf bodyDeclarations;
reference annotations[*] ordered container : Annotation;
reference anonymousClassDeclarationOwner[0-1] : AnonymousClassDeclaration oppositeOf bodyDeclarations;
reference modifier[0..1] container : Modifier oppositeOf bodyDeclaration;
}
class BooleanLiteral extends Expression {
attribute value : Boolean;
}
class BlockComment extends Comment {
}
class Block extends Statement {
reference statements[*] ordered container : Statement;
}
class BreakStatement extends Statement {
reference label[0-1] : LabeledStatement oppositeOf usagesInBreakStatements; -- NamedElementRef substitute
}
class CastExpression extends Expression {
reference expression container : Expression;
reference type container : TypeAccess ;
}
class CatchClause extends Statement {
reference exception container : SingleVariableDeclaration oppositeOf catchClause;
reference body container : Block;
}
class CharacterLiteral extends Expression {
attribute escapedValue : String;
}
class ClassFile extends NamedElement {
attribute originalFilePath : String;
reference type[0-1] : AbstractTypeDeclaration;
reference attachedSource[0-1] : CompilationUnit;
reference "package"[0-1] : Package;
}
class ClassInstanceCreation extends Expression, AbstractMethodInvocation {
reference anonymousClassDeclaration[0-1] container : AnonymousClassDeclaration oppositeOf classInstanceCreation;
reference expression[0-1] container : Expression;
reference type container : TypeAccess ;
}
class ConstructorDeclaration extends AbstractMethodDeclaration {
}
class ConditionalExpression extends Expression {
reference elseExpression container : Expression;
reference expression container : Expression;
reference thenExpression container : Expression;
}
class ConstructorInvocation extends Statement, AbstractMethodInvocation {
}
class ClassDeclaration extends TypeDeclaration {
reference superClass[0-1] container : TypeAccess ;
}
abstract class Comment extends ASTNode {
attribute content : String;
attribute enclosedByParent : Boolean;
attribute prefixOfParent : Boolean;
}
class CompilationUnit extends NamedElement {
attribute originalFilePath : String;
reference commentList[*] ordered : Comment;
reference imports[*] ordered container : ImportDeclaration;
reference "package"[0-1] : Package;
reference types[*] ordered : AbstractTypeDeclaration;
}
class ContinueStatement extends Statement {
reference label[0-1] : LabeledStatement oppositeOf usagesInContinueStatements; -- NamedElementRef substitute
}
class DoStatement extends Statement {
reference expression container : Expression;
reference body container : Statement;
}
class EmptyStatement extends Statement {
}
class EnhancedForStatement extends Statement {
reference body container : Statement;
reference expression container : Expression;
reference parameter container : SingleVariableDeclaration oppositeOf enhancedForStatement;
}
-- EnumConstantDeclaration is considered as VariableDeclaration to allowing
-- to be referenced by VariableAccess and without introducing more complex VariableDeclaration hierarchy
-- or a new EnumConstantAccess type
class EnumConstantDeclaration extends BodyDeclaration, VariableDeclaration {
reference anonymousClassDeclaration[0-1] container : AnonymousClassDeclaration;
reference arguments[*] ordered container : Expression;
}
class EnumDeclaration extends AbstractTypeDeclaration {
reference enumConstants[*] ordered container : EnumConstantDeclaration;
}
abstract class Expression extends ASTNode {
}
class ExpressionStatement extends Statement {
reference expression container : Expression;
}
class FieldAccess extends Expression {
reference field container : SingleVariableAccess;
reference expression container : Expression;
}
class FieldDeclaration extends BodyDeclaration, AbstractVariablesContainer {
}
class ForStatement extends Statement {
reference expression[0-1] container : Expression;
reference updaters[*] ordered container : Expression;
reference initializers[*] ordered container : Expression;
reference body container : Statement;
}
class IfStatement extends Statement {
reference expression container : Expression;
reference thenStatement container : Statement;
reference elseStatement[0-1] container : Statement;
}
class ImportDeclaration extends ASTNode {
attribute static[0-1] : Boolean;
reference importedElement : NamedElement oppositeOf usagesInImports; -- NamedElementRef substitute
}
class InfixExpression extends Expression {
attribute operator : InfixExpressionKind;
reference rightOperand container : Expression;
reference leftOperand container : Expression;
reference extendedOperands[*] ordered container : Expression;
}
enumeration InfixExpressionKind {
-- @literalValue "*"
literal TIMES;
-- @literalValue "/"
literal DIVIDE;
-- @literalValue "%"
literal REMAINDER;
-- @literalValue "+"
literal PLUS;
-- @literalValue "-"
literal MINUS;
-- @literalValue "<<"
literal LEFT_SHIFT;
-- @literalValue ">>"
literal RIGHT_SHIFT_SIGNED;
-- @literalValue ">>>"
literal RIGHT_SHIFT_UNSIGNED;
-- @literalValue "<"
literal LESS;
-- @literalValue ">"
literal GREATER;
-- @literalValue "<="
literal LESS_EQUALS;
-- @literalValue ">="
literal GREATER_EQUALS;
-- @literalValue "=="
literal EQUALS;
-- @literalValue "!="
literal NOT_EQUALS;
-- @literalValue "^"
literal XOR;
-- @literalValue "&"
literal AND;
-- @literalValue "|"
literal OR;
-- @literalValue "&&"
literal CONDITIONAL_AND;
-- @literalValue "||"
literal CONDITIONAL_OR;
}
enumeration InheritanceKind {
literal "none";
literal "abstract";
literal final;
}
class Initializer extends BodyDeclaration {
reference body container : Block;
}
class InstanceofExpression extends Expression {
reference rightOperand container : TypeAccess;
reference leftOperand container : Expression;
}
class InterfaceDeclaration extends TypeDeclaration {
}
class Javadoc extends Comment {
reference tags[*] ordered container : TagElement;
}
class LabeledStatement extends NamedElement, Statement {
reference body container : Statement;
reference usagesInBreakStatements[*] : BreakStatement oppositeOf label; -- NamedElementRef substitute opposite
reference usagesInContinueStatements[*] : ContinueStatement oppositeOf label; -- NamedElementRef substitute opposite
}
class LineComment extends Comment {
}
class Manifest {
reference mainAttributes [*] container : ManifestAttribute;
reference entryAttributes [*] container : ManifestEntry;
}
class ManifestAttribute {
attribute key : String;
attribute value : String;
}
class ManifestEntry {
attribute name[0-1] : String;
reference attributes [*] container : ManifestAttribute;
}
-- member can be a MethodDeclaration/Constructor/VariableDeclarationFragment/Type
class MemberRef extends ASTNode {
reference member : NamedElement;
reference qualifier[0-1] container : TypeAccess ;
}
class MethodDeclaration extends AbstractMethodDeclaration {
attribute extraArrayDimensions : Integer;
reference returnType[0-1] container : TypeAccess ;
reference redefinedMethodDeclaration[0-1] : MethodDeclaration oppositeOf redefinitions; -- NamedElementRef substitute
reference redefinitions[*] : MethodDeclaration oppositeOf redefinedMethodDeclaration;-- NamedElementRef substitute opposite
}
class MethodInvocation extends Expression, AbstractMethodInvocation {
reference expression[0-1] container : Expression;
}
class MethodRef extends ASTNode {
reference method : AbstractMethodDeclaration oppositeOf usagesInDocComments; -- NamedElementRef substitute
reference qualifier[0-1] container : TypeAccess ;
reference parameters[*] ordered container : MethodRefParameter;
}
class MethodRefParameter extends ASTNode {
attribute name[0-1] : String;
attribute varargs : Boolean;
reference type container : TypeAccess ;
}
class Model {
attribute name[0-1] : String;
reference ownedElements[*] container : Package oppositeOf model;
reference orphanTypes[*] container : Type;
reference unresolvedItems[*] container : UnresolvedItem;
reference compilationUnits[*] container : CompilationUnit;
reference classFiles[*] container : ClassFile;
reference archives[*] container : Archive;
}
class Modifier extends ASTNode {
attribute visibility : VisibilityKind;
attribute inheritance : InheritanceKind;
attribute static : Boolean;
attribute transient : Boolean;
attribute volatile : Boolean;
attribute native : Boolean;
attribute strictfp : Boolean;
attribute synchronized : Boolean;
reference bodyDeclaration[0-1] : BodyDeclaration oppositeOf modifier;
reference singleVariableDeclaration[0-1] : SingleVariableDeclaration oppositeOf modifier;
reference variableDeclarationStatement[0-1] : VariableDeclarationStatement oppositeOf modifier;
reference variableDeclarationExpression[0-1] : VariableDeclarationExpression oppositeOf modifier;
}
abstract class NamedElement extends ASTNode {
attribute name[0-1] : String;
attribute proxy : Boolean;
reference usagesInImports[*] : ImportDeclaration oppositeOf importedElement; -- NamedElementRef substitute opposite
}
abstract class NamespaceAccess extends ASTNode {
}
class NumberLiteral extends Expression {
attribute tokenValue : String;
}
class NullLiteral extends Expression {
}
class Package extends NamedElement {
reference ownedElements[*] container : AbstractTypeDeclaration oppositeOf "package";
reference model[0-1] : Model oppositeOf ownedElements;
reference ownedPackages[*] container : Package oppositeOf "package";
reference "package"[0-1] : Package oppositeOf ownedPackages;
reference usagesInPackageAccess[*] : PackageAccess oppositeOf "package";
}
class PackageAccess extends NamespaceAccess {
reference "package" : Package oppositeOf usagesInPackageAccess;
reference qualifier[0-1] container : PackageAccess;
}
-- arguments types are TypeAccess rather than direct Type reference
-- for injector implementation constraints (unicity and ordering)
class ParameterizedType extends Type {
reference type container : TypeAccess ;
reference typeArguments[*] ordered container : TypeAccess;
}
class ParenthesizedExpression extends Expression {
reference expression container : Expression;
}
class PostfixExpression extends Expression {
attribute operator : PostfixExpressionKind;
reference operand container : Expression;
}
enumeration PostfixExpressionKind {
-- @literalValue "++"
literal INCREMENT;
-- @literalValue "--"
literal DECREMENT;
}
class PrefixExpression extends Expression {
attribute operator : PrefixExpressionKind;
reference operand container : Expression;
}
enumeration PrefixExpressionKind {
-- @literalValue "++"
literal INCREMENT;
-- @literalValue "--"
literal DECREMENT;
-- @literalValue "+"
literal PLUS;
-- @literalValue "-"
literal MINUS;
-- @literalValue "~"
literal COMPLEMENT;
-- @literalValue "!"
literal NOT;
}
class PrimitiveType extends Type {
}
class PrimitiveTypeBoolean extends PrimitiveType {
}
class PrimitiveTypeByte extends PrimitiveType {
}
class PrimitiveTypeChar extends PrimitiveType {
}
class PrimitiveTypeDouble extends PrimitiveType {
}
class PrimitiveTypeShort extends PrimitiveType {
}
class PrimitiveTypeFloat extends PrimitiveType {
}
class PrimitiveTypeInt extends PrimitiveType {
}
class PrimitiveTypeLong extends PrimitiveType {
}
class PrimitiveTypeVoid extends PrimitiveType {
}
class ReturnStatement extends Statement {
reference expression[0-1] container : Expression;
}
-- This indirection metaclass is necessary for referencing variables in statements.
-- e.g. method invocations args may be some variable access or other expressions (literal...). So
-- - method invocations args must be Expression instances
-- - method invocations args must be owned (containment reference) by the MethodInvocation instance
-- - it involves injector implementation constraints (args unicity and ordering)
--
-- qualifier could be a acces to type or to a package --> Expression
class SingleVariableAccess extends Expression {
reference variable : VariableDeclaration oppositeOf usageInVariableAccess; -- NamedElementRef substitute
reference qualifier[0-1] container : Expression;
}
class SingleVariableDeclaration extends VariableDeclaration {
reference modifier[0..1] container : Modifier oppositeOf singleVariableDeclaration;
attribute varargs : Boolean;
reference type container : TypeAccess ;
reference annotations[*] ordered container : Annotation;
reference methodDeclaration[0-1] : AbstractMethodDeclaration oppositeOf parameters;
reference catchClause[0-1] : CatchClause oppositeOf exception;
reference enhancedForStatement[0-1] : EnhancedForStatement oppositeOf parameter;
}
abstract class Statement extends ASTNode {
}
class StringLiteral extends Expression {
attribute escapedValue : String;
}
class SuperConstructorInvocation extends Statement, AbstractMethodInvocation {
reference expression[0-1] container : Expression;
}
class SuperFieldAccess extends AbstractTypeQualifiedExpression {
reference field container : SingleVariableAccess;
}
class SuperMethodInvocation extends AbstractTypeQualifiedExpression, AbstractMethodInvocation {
}
class SwitchCase extends Statement {
attribute "default" : Boolean;
reference expression[0-1] container : Expression;
}
class SwitchStatement extends Statement {
reference expression container : Expression;
reference statements[*] ordered container : Statement;
}
class SynchronizedStatement extends Statement {
reference body container : Block;
reference expression container : Expression;
}
class TagElement extends ASTNode {
attribute tagName[0-1] : String;
reference fragments[*] ordered container : ASTNode;
}
class TextElement extends ASTNode {
attribute text : String;
}
class ThisExpression extends AbstractTypeQualifiedExpression {
}
class ThrowStatement extends Statement {
reference expression container : Expression;
}
class TryStatement extends Statement {
reference body container : Block;
reference finally[0-1] container : Block;
reference catchClauses[*] ordered container : CatchClause;
}
abstract class Type extends NamedElement {
reference usagesInTypeAccess[*] : TypeAccess oppositeOf type; -- NamedElementRef substitute opposite
}
class TypeAccess extends Expression, NamespaceAccess {
reference type : Type oppositeOf usagesInTypeAccess; -- NamedElementRef substitute
-- qualifier is a TypeAcces or PackageAccess
reference qualifier[0-1] container : NamespaceAccess;
}
abstract class TypeDeclaration extends AbstractTypeDeclaration {
reference typeParameters[*] ordered container : TypeParameter;
}
class TypeDeclarationStatement extends Statement {
reference declaration container : AbstractTypeDeclaration;
}
class TypeLiteral extends Expression {
reference type container : TypeAccess;
}
-- TypeParameter must be a Type to be referenced as a type in method parameters
class TypeParameter extends Type {
reference bounds[*] ordered container : TypeAccess;
}
class UnresolvedItem extends NamedElement {
}
class UnresolvedItemAccess extends Expression, NamespaceAccess {
reference element[0-1] : UnresolvedItem;
-- qualifier can be a Expression or a NamespaceAccess
reference qualifier[0-1] container : ASTNode;
}
class UnresolvedAnnotationDeclaration extends AnnotationTypeDeclaration, UnresolvedItem {
}
class UnresolvedAnnotationTypeMemberDeclaration extends AnnotationTypeMemberDeclaration, UnresolvedItem {
}
class UnresolvedClassDeclaration extends ClassDeclaration, UnresolvedItem {
}
class UnresolvedEnumDeclaration extends EnumDeclaration, UnresolvedItem {
}
class UnresolvedInterfaceDeclaration extends InterfaceDeclaration, UnresolvedItem {
}
class UnresolvedLabeledStatement extends LabeledStatement, UnresolvedItem {
}
class UnresolvedMethodDeclaration extends MethodDeclaration, UnresolvedItem {
}
class UnresolvedSingleVariableDeclaration extends SingleVariableDeclaration, UnresolvedItem {
}
class UnresolvedType extends Type, UnresolvedItem {
}
class UnresolvedTypeDeclaration extends AbstractTypeDeclaration, UnresolvedItem {
}
class UnresolvedVariableDeclarationFragment extends VariableDeclarationFragment, UnresolvedItem {
}
abstract class VariableDeclaration extends NamedElement {
attribute extraArrayDimensions : Integer;
reference initializer[0-1] container : Expression;
reference usageInVariableAccess[*] : SingleVariableAccess oppositeOf variable; -- NamedElementRef substitute opposite
}
class VariableDeclarationExpression extends Expression, AbstractVariablesContainer {
reference modifier[0..1] container : Modifier oppositeOf variableDeclarationExpression;
reference annotations[*] ordered container : Annotation;
}
class VariableDeclarationFragment extends VariableDeclaration {
reference variablesContainer[0-1] : AbstractVariablesContainer oppositeOf fragments;
}
class VariableDeclarationStatement extends Statement, AbstractVariablesContainer {
attribute extraArrayDimensions : Integer;
reference modifier[0..1] container : Modifier oppositeOf variableDeclarationStatement;
reference annotations[*] ordered container : Annotation;
}
enumeration VisibilityKind {
literal none;
literal public;
literal private;
literal protected;
}
class WildCardType extends Type {
attribute upperBound : Boolean;
reference bound[0-1] container : TypeAccess;
}
class WhileStatement extends Statement {
reference expression container : Expression;
reference body container : Statement;
}
}
package PrimitiveTypes {
datatype Boolean;
datatype Integer;
datatype String;
}