private void checkAbstractDeclaration(MethodNode methodNode) {
   if (!methodNode.isAbstract()) return;
   if (isAbstract(currentClass.getModifiers())) return;
   addError(
       "Can't have an abstract method in a non-abstract class."
           + " The "
           + getDescription(currentClass)
           + " must be declared abstract or the method '"
           + methodNode.getTypeDescriptor()
           + "' must not be abstract.",
       methodNode);
 }
예제 #2
0
  /**
   * @return the list of abstract methods associated with this ClassNode or null if there are no
   *     such methods
   */
  public List<MethodNode> getAbstractMethods() {
    List<MethodNode> result = new ArrayList<MethodNode>(3);
    for (MethodNode method : getDeclaredMethodsMap().values()) {
      if (method.isAbstract()) {
        result.add(method);
      }
    }

    if (result.isEmpty()) {
      return null;
    } else {
      return result;
    }
  }