Example usage for org.aspectj.tools.ajc Main bareMain

List of usage examples for org.aspectj.tools.ajc Main bareMain

Introduction

In this page you can find the example usage for org.aspectj.tools.ajc Main bareMain.

Prototype

public static int bareMain(String[] args, boolean useSystemExit, List fails, List errors, List warnings,
        List infos) 

Source Link

Document

Convenience method to run ajc and collect String lists of messages.

Usage

From source file:com.runwaysdk.business.generation.AspectJCompiler.java

License:Open Source License

/**
 * Calls the AspectJ Compiler and wraps any errors or failures in a {@link CompilerException}
 *
 * @param args//from w  w w.  j  a v  a  2  s .c o m
 *          Arguments for the compiler
 * @throws CompilerException
 *           if compilation fails
 */
private void callAJC(String args[]) {
    Log log = LogFactory.getLog(COMPILER_LOG);
    log.trace(Arrays.deepToString(args));

    fails.clear();
    errors.clear();
    warnings.clear();
    infos.clear();

    if (0 < Main.bareMain(args, false, fails, errors, warnings, infos)) {
        // We have errors
        String message = new String();
        for (String error : errors) {
            message += '\n' + error;
        }
        for (String fail : fails) {
            message += '\n' + fail;
        }
        throw new CompilerException("Errors found during compilation:" + message, message);
    }
}