private String extractNativeMethodBody(MethodDeclaration m) {
   assert (m.getModifiers() & Modifier.NATIVE) > 0;
   String nativeCode = extractNativeCode(m.getStartPosition(), m.getLength());
   if (nativeCode == null) {
     ErrorUtil.warning(m, "no native code found");
     return "";
   }
   return '{' + nativeCode + '}';
 }
 public boolean visit(MethodDeclaration node) {
   String signature = getSignature(node);
   push(
       node.isConstructor() ? JavaNode.CONSTRUCTOR : JavaNode.METHOD,
       signature,
       node.getStartPosition(),
       node.getLength());
   return false;
 }
  /**
   * Constructor.
   *
   * @param methodDeclarationNode the method declaration of this manager handles.
   */
  public StubMethodBindingManager(MethodDeclaration methodDeclarationNode) {
    this.methodDeclarationNode = methodDeclarationNode;

    this.stubMethodLen = methodDeclarationNode.getLength();
    this.stubMethodStartPosition = methodDeclarationNode.getStartPosition();

    ASTNode astNode = methodDeclarationNode.getRoot();

    System.out.println(
        "Stub Method, stubMethodLen = "
            + stubMethodLen
            + ", StubMethodStartPosition = "
            + stubMethodStartPosition);
  }
  private void printMethodsAndOcni(
      AbstractTypeDeclaration typeNode,
      Iterable<MethodDeclaration> methods,
      Iterable<Comment> comments) {
    Set<String> methodsPrinted = Sets.newHashSet();
    Iterator<MethodDeclaration> methodsIter = methods.iterator();
    Iterator<Comment> commentsIter = comments.iterator();
    MethodDeclaration nextMethod = methodsIter.hasNext() ? methodsIter.next() : null;
    Comment nextComment = commentsIter.hasNext() ? commentsIter.next() : null;
    int minPos = 0;
    while (nextMethod != null || nextComment != null) {
      int methodStartPos = nextMethod != null ? nextMethod.getStartPosition() : Integer.MAX_VALUE;
      if (methodStartPos < 0) {
        methodStartPos = minPos;
      }
      int commentStartPos =
          nextComment != null ? nextComment.getStartPosition() : Integer.MAX_VALUE;
      if (methodStartPos < commentStartPos) {
        assert nextMethod != null;
        printMethod(nextMethod);
        minPos = methodStartPos + nextMethod.getLength();
        nextMethod = methodsIter.hasNext() ? methodsIter.next() : null;
      } else {
        assert nextComment != null;
        if (commentStartPos > minPos) {
          String nativeCode = extractNativeCode(commentStartPos, nextComment.getLength());
          if (nativeCode != null) {
            nativeCode = reindent(nativeCode.trim());
            findMethodSignatures(nativeCode, methodsPrinted);
            print(nativeCode + "\n\n");
          }
        }
        nextComment = commentsIter.hasNext() ? commentsIter.next() : null;
      }
    }

    // If the type implements Iterable and there's no existing implementation
    // for NSFastEnumeration's protocol method, then add the default
    // implementation.
    if (BindingUtil.findInterface(Types.getTypeBinding(typeNode), "java.lang.Iterable") != null
        && !methodsPrinted.contains("countByEnumeratingWithState:objects:count:")) {
      print(
          "- (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state "
              + "objects:(__unsafe_unretained id *)stackbuf count:(NSUInteger)len {\n"
              + "  return JreDefaultFastEnumeration(self, state, stackbuf, len);\n}\n\n");
    }
  }