Esempio n. 1
0
 /**
  * Checks order of methods.
  *
  * @param methods Iterable<DetailAST> methods
  */
 private void checkOrder(final Iterable<DetailAST> methods) {
   MethodsOrderCheck.Modifiers prev = MethodsOrderCheck.Modifiers.PUB;
   for (final DetailAST method : methods) {
     final MethodsOrderCheck.Modifiers mtype = MethodsOrderCheck.getModifierType(method);
     if (mtype.getOrder() < prev.getOrder()) {
       this.log(method.getLineNo(), "Wrong method declaration order");
     } else {
       prev = mtype;
     }
   }
 }
Esempio n. 2
0
 /**
  * Checks class definition to satisfy the rule.
  *
  * @param node Tree node, containing class definition (CLASS_DEF).
  */
 private void checkClass(final DetailAST node) {
   final DetailAST obj = node.findFirstToken(TokenTypes.OBJBLOCK);
   if (obj != null) {
     this.checkOrder(MethodsOrderCheck.findAllChildren(obj, TokenTypes.METHOD_DEF));
   }
 }