uOttawaUniversity of Ottawa - Canadas University
list of dots

Umple User Manual    [Previous]   [Next]   

Loading

W003 Redundant Lazy With Initialization

Umple syntactic warning reported when the lazy keyword in specified when there is also an initializer

The function of the 'lazy' keyword is to indicate that an attribute is not to appear in the constructor. However an initializer for the attribute has the same effect, so specifying both 'lazy' and an initializer is redundant, and hints that there may be a mistake. The solution is just to remove the extraneous 'lazy'.

Example

// This example generates the warning
class X3lazy {
  lazy Integer a = 1;
}

      

Load the above code into UmpleOnline

 

Another Example

// This shows how the warning can be removed.
class X3lazy {
  Integer a = 1;
}

      

Load the above code into UmpleOnline