.NAME Order of member declarations

.DESCRIPTION

Definition:
-----------
In a class, declarations must follow a particular order, given in the parameters of the rule.
The order depends on the types of the declaration. The type is defined by:
- the acces type (public, private, protected or package if no access type is specified),
- the scope (class or instance),
- the variable type (constant, attribute, method, constructor, type).

The order is defined by an ordered list of strings defining a set of declaration types.

A declaration of one type can not follow a declaration of another type if its type matches a set of
type that is before the set of types of the first one in the ordered list.

A declaration matches a set of types if the set of types is the first of the list of the highest
number of criteria which includes the type of the declaration.

Parameters:
----------
A list of character strings representing the declaration types in the wanted order.
Each string contains a set of the above keywords. Several keywords of the category are alternatives.
Several categories increase the number of criteria of the set. In addition to the keywords described
above, "allaccess" means private, protected, public or package; "allscope" means class or instance;
"alldecl" means constant, variable, method, constructor or type; "others" means any types not listed above.

Class definitions have not to contain all the types defined in the standard.

If the constructor type does not appear in the list, constructors will be considered as ordinary methods.

It is advisable to use "allaccess", "allscope" and "alldecl" to increase the number of criteria of a set.
For instance, use "allaccess allscope constructor" to match any constructor, but use "method" to match the
methods not matched by other sets.

Justification:
--------------
Makes the code easier to read.

Example:
--------
// if the standard has the following strings in this order:
// "allaccess allscope constructor" "public class method" "public method" "method" "constant" "others",
// following declarations are allowed
class aClass {
  public aClass(){}
  public int f() {}
  int i;
}
class aClass {
  static public void p() {}
  public int f(int j) {}
  int f() {}
  static final int ID = 123;
  class subClass { }
}
// and not the following one:
class aClass  {
int f() {}
public F() {}
}


.SEVERITY Advisory

.COMMAND builtin

