Bug 5095 template: toarray incorrect
its defintion should be: (${type}[]) ${collection}.toArray(new ${type}[${collection}.size()]); rather than (${type}[]) ${collection}.toArray(new ${type}[${collection}]);
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/template/TemplateSet.java
import org.eclipse.core.runtime.Platform;
import org.eclipse.jdt.internal.core.Assert;
import org.eclipse.jdt.internal.ui.JavaPlugin;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.w3c.dom.Text;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
/**
 * A user defined template set.
 */
public class TemplateSet {
	
	private static class TemplateComparator implements Comparator {
		public int compare(Object arg0, Object arg1) {
			if (arg0 == arg1)
				return 0;
			
			if (arg0 == null)
				return -1;
				
			Template template0= (Template) arg0;
			Template template1= (Template) arg1;
			
			return template0.getName().compareTo(template1.getName());
		}