uOttawaUniversity of Ottawa - Canadas University
list of dots

Umple User Manual    [Previous]   [Next]   

Loading

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