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

User Manual    [Previous]   [Next]   

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

 

Solution to The Above So the Message No Longer Appears

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

      

Load the above code into UmpleOnline