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

User Manual    [Previous]   [Next]   

E217 Conflict in Types of Attributes

Umple semantic error related to having an attribute from a trait with different types

We can define template parameters for traits and use them with different bindings in several hierarchy paths. If types of some attributes are based on template parameters, there is a case in which those are bound with different values. In a case that a trait is going to be used in a diamond form of hierarchy, this can result in a conflict. Note that if the types are the same, then there is no conflict.

Example

// In this example, there is a
// conflict because in trait "T"
// there will be two attributes
// with the same name "data" but
// with different types
// which are "B" and "C".
class A{
	isA T;
}
class B{
	//elements
}
class C{
	//elements
}
trait T{
	isA T1;
	isA T2;
}
trait T1{
	isA Share<Type = B>;
}
trait T2{
	isA Share<Type = C>;
}
trait Share<Type> {
	Type data;
}
      

Load the above code into UmpleOnline