// Path: nicobar-core/src/main/java/com/netflix/nicobar/core/compile/ScriptCompilationException.java
// public class ScriptCompilationException extends Exception {                                                                                                                                                                                                  
//     private static final long serialVersionUID = 1L;                                                                                                                                                                                                         
//                                                                                                                                                                                                                                                              
//     /**                                                                                                                                                                                                                                                      
//      * Create a generic compilation exception.                                                                                                                                                                                                               
//      * @param message the actual message.                                                                                                                                                                                                                    
//      */                                                                                                                                                                                                                                                      
//     public ScriptCompilationException(String message) {                                                                                                                                                                                                      
//         super(message);                                                                                                                                                                                                                                      
//     }                                                                                                                                                                                                                                                        
//                                                                                                                                                                                                                                                              
//     /**                                                                                                                                                                                                                                                      
//      * A compilation exception with a specific underlying exception                                                                                                                                                                                          
//      * that is compiler specific.                                                                                                                                                                                                                            
//      */                                                                                                                                                                                                                                                      
//     public ScriptCompilationException(String message, Throwable cause) {                                                                                                                                                                                     
//         super(message, cause);                                                                                                                                                                                                                               
//     }                                                                                                                                                                                                                                                        
// }                                                                                                                                                                                                                                                            


import org.codehaus.groovy.control.CompilationUnit;
import org.codehaus.groovy.control.CompilerConfiguration;
import org.codehaus.groovy.control.Phases;
import org.codehaus.groovy.tools.GroovyClass;
import com.netflix.nicobar.core.archive.ScriptArchive;
import com.netflix.nicobar.core.compile.ScriptCompilationException;
import groovy.lang.GroovyClassLoader;
import java.io.IOException;
import java.nio.file.Path;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import org.codehaus.groovy.control.CompilationFailedException;
        return this;
    }

    public Groovy2CompilerHelper addSourceFile(Path groovyFile) {
        if (groovyFile != null) {
            sourceFiles.add(groovyFile);
        }
        return this;
    }

    public Groovy2CompilerHelper addScriptArchive(ScriptArchive archive) {
        if (archive != null) {
            scriptArchives.add(archive);
        }
        return this;
    }

    public Groovy2CompilerHelper withConfiguration(CompilerConfiguration compilerConfig) {
        if (compilerConfig != null) {
            this.compileConfig = compilerConfig;
        }
        return this;
    }

    /**
     * Compile the given source and load the resultant classes into a new {@link ClassNotFoundException}
     * @return initialized and laoded classes
     * @throws ScriptCompilationException
     */
    @SuppressWarnings("unchecked")
// Path: nicobar-core/src/main/java/com/netflix/nicobar/core/compile/ScriptCompilationException.java
// public class ScriptCompilationException extends Exception {                                                                                                                                                                                                  
//     private static final long serialVersionUID = 1L;                                                                                                                                                                                                         
//                                                                                                                                                                                                                                                              
//     /**                                                                                                                                                                                                                                                      
//      * Create a generic compilation exception.                                                                                                                                                                                                               
//      * @param message the actual message.                                                                                                                                                                                                                    
//      */                                                                                                                                                                                                                                                      
//     public ScriptCompilationException(String message) {                                                                                                                                                                                                      
//         super(message);                                                                                                                                                                                                                                      
//     }                                                                                                                                                                                                                                                        
//                                                                                                                                                                                                                                                              
//     /**                                                                                                                                                                                                                                                      
//      * A compilation exception with a specific underlying exception                                                                                                                                                                                          
//      * that is compiler specific.                                                                                                                                                                                                                            
//      */                                                                                                                                                                                                                                                      
//     public ScriptCompilationException(String message, Throwable cause) {                                                                                                                                                                                     
//         super(message, cause);                                                                                                                                                                                                                               
//     }                                                                                                                                                                                                                                                        
// }                                                                                                                                                                                                                                                            


// Path: nicobar-groovy2/src/main/java/com/netflix/nicobar/groovy2/internal/compile/Groovy2CompilerHelper.java
import org.codehaus.groovy.control.CompilationUnit;
import org.codehaus.groovy.control.CompilerConfiguration;
import org.codehaus.groovy.control.Phases;
import org.codehaus.groovy.tools.GroovyClass;
import com.netflix.nicobar.core.archive.ScriptArchive;
import com.netflix.nicobar.core.compile.ScriptCompilationException;
import groovy.lang.GroovyClassLoader;
import java.io.IOException;
import java.nio.file.Path;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import org.codehaus.groovy.control.CompilationFailedException;

        return this;
    }

    public Groovy2CompilerHelper addSourceFile(Path groovyFile) {
        if (groovyFile != null) {
            sourceFiles.add(groovyFile);
        }
        return this;
    }

    public Groovy2CompilerHelper addScriptArchive(ScriptArchive archive) {
        if (archive != null) {
            scriptArchives.add(archive);
        }
        return this;
    }

    public Groovy2CompilerHelper withConfiguration(CompilerConfiguration compilerConfig) {
        if (compilerConfig != null) {
            this.compileConfig = compilerConfig;
        }
        return this;
    }

    /**
     * Compile the given source and load the resultant classes into a new {@link ClassNotFoundException}
     * @return initialized and laoded classes
     * @throws ScriptCompilationException
     */
    @SuppressWarnings("unchecked")
    public Set<GroovyClass> compile() throws ScriptCompilationException {