/**
  * @param type
  * @return
  */
 protected String getNameOfType(final Type type) {
   String nameOfType = "";
   if (type != null) {
     if (type.isPrimitiveType()) {
       nameOfType = type.toString();
     } else if (type.isParameterizedType()) {
       nameOfType = getParametrizedType((ParameterizedType) type);
     } else if (type.isArrayType()) {
       final ArrayType array = (ArrayType) type;
       nameOfType = getNameOfType(array.getElementType()) /*+ "[]"*/;
     } else if (type.isUnionType()) {
       // TODO: this is used for exceptions till now
       // So we will just capture the first type that we encounter
       final UnionType uType = (UnionType) type;
       final StringBuffer sb = new StringBuffer();
       for (final Object unionedType : uType.types()) {
         sb.append(getNameOfType(((Type) unionedType)));
         break;
         // sb.append(" | ");
       }
       // sb.delete(sb.length() - 3, sb.length());
       nameOfType = sb.toString();
     } else if (type.isWildcardType()) {
       final WildcardType wType = (WildcardType) type;
       nameOfType =
           (wType.isUpperBound() ? "? extends " : "? super ") + getNameOfType(wType.getBound());
     } else {
       nameOfType = getFullyQualifiedNameFor(type.toString());
     }
   }
   return nameOfType;
 }
 /*
  * @see ASTVisitor#visit(ArrayType)
  */
 @Override
 public boolean visit(ArrayType node) {
   if (node.getAST().apiLevel() < AST.JLS8) {
     getComponentType(node).accept(this);
     this.fBuffer.append("[]"); // $NON-NLS-1$
   } else {
     node.getElementType().accept(this);
     List<Dimension> dimensions = node.dimensions();
     for (int i = 0; i < dimensions.size(); i++) {
       Dimension dimension = dimensions.get(i);
       dimension.accept(this);
     }
   }
   return false;
 }
 /*
  * @see ASTVisitor#visit(ArrayCreation)
  */
 public boolean visit(ArrayCreation node) {
   this.fBuffer.append("new "); // $NON-NLS-1$
   ArrayType at = node.getType();
   int dims = at.getDimensions();
   Type elementType = at.getElementType();
   elementType.accept(this);
   for (Iterator it = node.dimensions().iterator(); it.hasNext(); ) {
     this.fBuffer.append("["); // $NON-NLS-1$
     Expression e = (Expression) it.next();
     e.accept(this);
     this.fBuffer.append("]"); // $NON-NLS-1$
     dims--;
   }
   // add empty "[]" for each extra array dimension
   for (int i = 0; i < dims; i++) {
     this.fBuffer.append("[]"); // $NON-NLS-1$
   }
   if (node.getInitializer() != null) {
     node.getInitializer().accept(this);
   }
   return false;
 }
 /*
  * @see ASTVisitor#visit(ArrayType)
  */
 public boolean visit(ArrayType node) {
   node.getComponentType().accept(this);
   this.fBuffer.append("[]"); // $NON-NLS-1$
   return false;
 }
 /**
  * @param node node
  * @return component type
  * @deprecated to avoid deprecation warning
  */
 private static Type getComponentType(ArrayType node) {
   return node.getComponentType();
 }