/*
 * Copyright 2003-2015 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.codehaus.groovy.control;

import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.io.xml.StaxDriver;

import java.io.FileWriter;

public abstract class XStreamUtils {
    public static void serialize(final String name, final Object ast) {
        XStream xstream = new XStream(new StaxDriver());
        try {
            xstream.toXML(ast, new FileWriter(name + ".xml"));
            System.out.println("Written AST to " + name + ".xml");
        } catch (Exception e) {
            System.out.println("Couldn't write to " + name + ".xml");
            e.printStackTrace();
        }
    }
}

@@ -3,74 +3,264 @@
 %0A * 
-Copyright 2003-2015 the original author or authors.%0A *%0A * Licensed
+ Licensed to the Apache Software Foundation (ASF) under one%0A *  or more contributor license agreements.  See the NOTICE file%0A *  distributed with this work for additional information%0A *  regarding copyright ownership.  The ASF licenses this file%0A *  to you
  und
@@ -298,16 +298,20 @@
 2.0 (the
+%0A * 
  %22Licens
@@ -314,19 +314,16 @@
 cense%22);
-%0A *
  you may
@@ -361,16 +361,20 @@
 mpliance
+%0A * 
  with th
@@ -383,19 +383,17 @@
 License.
-%0A *
+ 
  You may
@@ -430,18 +430,16 @@
 at%0A *%0A *
-  
     http
@@ -482,16 +482,17 @@
 .0%0A *%0A *
+ 
  Unless 
@@ -542,16 +542,20 @@
 writing,
+%0A * 
  softwar
@@ -555,19 +555,16 @@
 software
-%0A *
  distrib
@@ -606,16 +606,20 @@
 ed on an
+%0A * 
  %22AS IS%22
@@ -625,19 +625,16 @@
 %22 BASIS,
-%0A *
  WITHOUT
@@ -665,16 +665,20 @@
 S OF ANY
+%0A * 
  KIND, e
@@ -702,19 +702,17 @@
 implied.
-%0A *
+ 
  See the
@@ -727,16 +727,20 @@
  for the
+%0A * 
  specifi
@@ -775,19 +775,16 @@
 ions and
-%0A *
  limitat
@@ -787,16 +787,20 @@
 itations
+%0A * 
  under t
@@ -815,17 +815,16 @@
 se.%0A */%0A
-%0A
 package 

use standard header