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

User Manual    [Previous]   [Next]   

E096 Enumeration Naming Conflict

Umple semantic error reported when an enumeration defined in a class has the same name as the class, or when a model level enumeration has the same name as a class, interface, or trait.

In Umple, class enumerations must not have the same name as the class they are defined in. Model level enumerations must have unique names.

Example

// This example generates the error
// since the enumeration "X" will be added
// to the class "X" because of attribute "t".

enum X{ Red, Blue, Green }

class X{
  X t;
}
      

Load the above code into UmpleOnline

 

Another Example

// This generates the error
// because the enumeration "X"
// has the same name
// as the class it's defined in
 
class X{
  enum X { Red, Blue, Green }
}
      

Load the above code into UmpleOnline

 

Another Example

// This example generates the error
// since enumeration "Y"
// conflicts with interface "Y"

interface Y { 
  name;
}

class X {
 isA Y;
}

enum Y { Red, Blue, Green }
      

Load the above code into UmpleOnline

 

Another Example

// This example generates the error
// since enumeration "Y" conflicts with trait "Y"

class X {
 isA Y;
}

trait Y { 
  name;
}

enum Y { Red, Blue, Green }
      

Load the above code into UmpleOnline

 

Solution to The Above So the Message No Longer Appears

// This example does not generate the error
enum Z { Orange, Yellow }

class X {
 enum Y { Red, Blue, Green }
 Z attr;
}
      

Load the above code into UmpleOnline