list of dots Digital Research Alliance of Canada logo  NSERC logo  University of Ottawa logo / UniversitĂ© d'Ottawa

User Manual    [Previous]   [Next]   

E213 Bidirectional Association in Traits

Umple semantic error related to having bidirectional association with interfaces

Traits can make associations with interfaces, classes, and template parameters. If one end of the association is a template parameter, the binding type must be checked to make sure it is compatible with the type of the association. For example, if a trait has a bidirectional association with a template parameter, the binding value cannot be an interface and it must be a class. Breaking this constraint is reported to modelers using this error code.

Example

// In this example, there is an error
// because a bidirectional association
// is created with interface I,
// which is not valid.
interface I {
  /*implementation*/
}
trait T <RelatedClass> {
  0..1 -- * RelatedClass;
  /*implementation*/
}
class C{
 isA T<RelatedClass=I>;
 /*implementation*/
}
      

Load the above code into UmpleOnline