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

User Manual    [Previous]   [Next]   

E037 Uninitialized Constant Object

Umple semantic error generated when an Object constant is not initialized

It makes little sense to have a constant unless it is given a value. Since there is no obvious default value for arbitrary data types, it is an error to declare an uninitialized constant unless it is of one of the builtin Umple data types. (For builtin datatypes this is not a problem since a number can be initialized as zero by default, and a string as empty by default).

Example

// This example generates error 37
class X {
  const Y A;
}

class Y {
  Integer a;
}
      

Load the above code into UmpleOnline

 

Solution to The Above So the Message No Longer Appears

// This example resolves error 37

class X {
  const Y A=new Y(3);
}

class Y {
  Integer a;
}
      

Load the above code into UmpleOnline