uOttawaUniversity of Ottawa - Canadas University
list of dots

Umple User Manual    [Previous]   [Next]   

Loading

W007 Key Already Specified

Umple semantic warning reported when a second key statement is encountered in a class

To avoid confusion, a class should normally only have one key specification. This warning is intended to direct the programmer to list the multiple attributes within the same key directive, rather specifying them separately.

The reason for this is that without this warning, code that is separated by many lines or found in a mixin file might modify the key in a way that wasn't anticipated by the developer who is not aware of the existence of multiple key statements.

Developers can ignore this warning without any consequences. The examples below will generate the same compiled code.

Example

// This example generates the message
class X {
  name;
  id;
  key { name }
  key { id }
}


      

Load the above code into UmpleOnline

 

Another Example

// This example below avoids the message
class X {
  name;
  id;
  key { name, id }
}


      

Load the above code into UmpleOnline