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

User Manual    [Previous]   [Next]   

W218 Conflict in Attributes

Umple semantic error related to having an attribute with the same name in a trait and a class

When classes uses traits, all attributes in traits are flattened in classes. Therefore, if there are attributes with the same name, they might create a conflict. The Umple compiler considers this as a warning, because it is the developers' responsibility to decide about the nature of the conflict. Sometimes, developers indicate exactly the same attributes and therefore there is no need to consider the conflict as an error. However, generally, if there are some attributes in host classes which traits need to use them, traits define them as required methods (needed accessors). In this case, host classes need to have accessors for those attributes. In the case of this warning, the Umple compiler just removes one of those attributes and proceeds.

Example

// In this example, there is a warning
// because in class "A" there will be
// two attributes with the name called "name".

class A{
	isA T;
	name;
}
trait T{
	name;
}
      

Load the above code into UmpleOnline

 

Another Example

// In this example, there is a
// warning because in trait "T"
// there will be two attributes
// with the name called "name".
class A{
	isA T;
}
trait T{
	isA T1;
	name;
}
trait T1{
	name;
}
      

Load the above code into UmpleOnline