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

User Manual    [Previous]   [Next]   

W035 Uninitialized Constant

Umple semantic warning generated when a Umple builtin data type constant is not initialized

It makes little sense to have a constant unless it is given a value. If a constant is of one of the built-in Umple data types we will set it to a default value: Integer, Double and Float will be set to zero, String will be set to an empty String, Boolean will be set to false, Date will be set to the date where the code was generated and Time will be set to midnight (00:00:00). However, the warning is issued since forgetting to initialize a constant is a common source of errors.

Example

// The following will generate this warning

class X {
  const String A; //same as const String a = "";
}
      

Load the above code into UmpleOnline

 

Solution to The Above So the Message No Longer Appears


// The following will resolve the issue

class X {
  const String A = "Something Interesting";
}
      

Load the above code into UmpleOnline