package mclint.util;

import ast.ASTNode;

/**
 * Useful methods for manipulating ASTs.
 * @author isbadawi
 */
public class AstUtil {
  /**
   * Replaces a subtree with another, correctly updating parent/child links.
   */
  @SuppressWarnings("unchecked")
  public static void replace(ASTNode<?> oldNode, ASTNode<?> newNode) {
    oldNode.getParent().setChild(newNode, oldNode.getParent().getIndexOfChild(oldNode));
  }

  /**
   * Replace a node with the contents of a list. 
   * 
   * Technically this will always work, but it really only makes sense if the replaced node is an
   * element of a list to begin with. 
   */
  @SuppressWarnings({"unchecked", "rawtypes"})
  public static void replaceWithContents(ASTNode<?> node, ast.List<?> source) {
    ASTNode parent = node.getParent();
    int index = parent.getIndexOfChild(node);
    node.getParent().removeChild(index);
    for (Object element : source) {
      parent.insertChild((ASTNode<?>) element, index++);
    }
  }
  private AstUtil() {}
}

@@ -221,41 +221,8 @@
  */%0A
-  @SuppressWarnings(%22unchecked%22)%0A
   pu
@@ -591,55 +591,8 @@
  */%0A
-  @SuppressWarnings(%7B%22unchecked%22, %22rawtypes%22%7D)%0A
   pu
@@ -678,16 +678,19 @@
  ASTNode
+%3C?%3E
  parent 

Remove unnecessary SuppressWarnings annotations from AstUtil