list of dots

User Manual    [Previous]   [Next]   

W142 Type is access specifier

Umple warning when a type looks like it was meant as a visibility specifier

Umple attributes do not support visibility specifiers such as public, private and protected. An attribute is private by default, and programmers are supposed to use the corresponding generated get method to read it, or the set method to modify it.

This warning appears when one of the visibility keywords precedes an attribute.

Example

// This case raises the warning
// because it is probably an error
// Umple will consider "x" to have type "public"
class X {
  public x;
}


      

Load the above code into UmpleOnline

 

Another Example

// This is probably what was intended,
// attributes have private access by default
// but the programmer would call
// public String getX() to read it
// and public boolean setX(String) to set it
class X {
  x;
}


      

Load the above code into UmpleOnline

 

Another Example

// Although not recommended, the programmer
// can also bypass Umple and directly specify
// both the visibility directive and the type.
// Umple will not see that as an attribute
// and will inject the line of code into the
// output directly.
class X {
  public String x;
}


      

Load the above code into UmpleOnline