コード例 #1
0
ファイル: MethodsOrderCheck.java プロジェクト: vkuchyn/qulice
 /**
  * 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;
     }
   }
 }
コード例 #2
0
ファイル: MethodsOrderCheck.java プロジェクト: vkuchyn/qulice
 /**
  * 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));
   }
 }