当前位置: 首页>>代码示例>>Java>>正文


Java CompilerError类代码示例

本文整理汇总了Java中org.codehaus.plexus.compiler.CompilerError的典型用法代码示例。如果您正苦于以下问题:Java CompilerError类的具体用法?Java CompilerError怎么用?Java CompilerError使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CompilerError类属于org.codehaus.plexus.compiler包,在下文中一共展示了CompilerError类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: shortMessage

import org.codehaus.plexus.compiler.CompilerError; //导入依赖的package包/类
/**
 * Short message will have the error message if there's only one, useful for errors forking the compiler
 *
 * @param messages a {@link java.util.List} object.
 * @return the short error message
 * @since 2.0.2
 */
public static String shortMessage( List<CompilerError> messages )
{
    StringBuffer sb = new StringBuffer();

    sb.append( "Compilation failure" );

    if ( messages.size() == 1 )
    {
        sb.append( LS );

        CompilerError compilerError = (CompilerError) messages.get( 0 );

        sb.append( compilerError ).append( LS );
    }
    
    return sb.toString();
}
 
开发者ID:strator-dev,项目名称:greenpepper,代码行数:25,代码来源:CompilationFailureException.java

示例2: logErrors

import org.codehaus.plexus.compiler.CompilerError; //导入依赖的package包/类
/**
 * Print a header with the given label and print all errors similar to the style
 * maven itself uses
 * @param errors Errors to print
 * @param label The label (usually ERRORS or WARNINGS) to head the error list
 * @param log The log to which the messages are printed
 */
private static final void logErrors(final List<CompilerError> errors, final String label,
                                    boolean warn, final Log log) {
    log.info("-------------------------------------------------------------");
    log.warn("CHECKER FRAMEWORK " + label.toUpperCase() + ": ");
    log.info("-------------------------------------------------------------");
    for (final CompilerError error : errors) {
        final String msg = error.toString().trim();
        if(warn) {
            log.warn(msg);
        } else {
            log.error(msg);
        }
    }

    final String labelLc = label.toLowerCase() + ((errors.size() == 1) ? "" : "s");
    log.info(errors.size() + " " + labelLc);
    log.info("-------------------------------------------------------------");
}
 
开发者ID:reprogrammer,项目名称:checker-framework,代码行数:26,代码来源:MavenIOExecutor.java

示例3: longMessage

import org.codehaus.plexus.compiler.CompilerError; //导入依赖的package包/类
/**
 * <p>longMessage.</p>
 *
 * @param messages a {@link java.util.List} object.
 * @return a {@link java.lang.String} object.
 */
public static String longMessage( List<CompilerError> messages )
{
    StringBuffer sb = new StringBuffer();

    if ( messages != null )
    {
        for ( CompilerError compilerError : messages )
        {
            sb.append( compilerError ).append( LS );
        }
    }
    return sb.toString();
}
 
开发者ID:strator-dev,项目名称:greenpepper,代码行数:20,代码来源:CompilationFailureException.java

示例4: parseMessages

import org.codehaus.plexus.compiler.CompilerError; //导入依赖的package包/类
/**
    * Parses the compiler error output into a list of {@code CompilerError} objects.
    *
    * @param input the compiler error output
    * @return the parsed error output
    */

    public static List<CompilerError> parseMessages(String input) {
        List<CompilerError> errors = new ArrayList<CompilerError>();

        try {
        final BufferedReader reader = new BufferedReader(new StringReader(input));
        try {
            final StringBuilder errorBuffer = new StringBuilder();
            String line;
            while ((line = reader.readLine()) != null) {
                if (line.isEmpty()) {
                    continue;
                }

                // Skip summary of warnings/errors
                if (Character.isDigit(line.charAt(0))) {
                    continue;
                }

                // Start of a new message?
                if (errorBuffer.length() > 0 && !Character.isWhitespace(line.charAt(0))) {
                    errors.add(parseMessage(errorBuffer.toString()));
                    errorBuffer.setLength(0);
                }
                errorBuffer.append(line).append(EOL);
            }

            // Handle the last message
            if (errorBuffer.length() > 0) {
                errors.add(parseMessage(errorBuffer.toString()));
            }

            return errors;
        } finally {
            reader.close();
        }
    } catch (IOException e) {
        // Should never happen
        throw new RuntimeException(e);
    }
}
 
开发者ID:reprogrammer,项目名称:checker-framework,代码行数:48,代码来源:JavacErrorMessagesParser.java

示例5: CompilationFailureException

import org.codehaus.plexus.compiler.CompilerError; //导入依赖的package包/类
/**
 * <p>Constructor for CompilationFailureException.</p>
 *
 * @param messages a {@link java.util.List} object.
 */
public CompilationFailureException( List<CompilerError> messages )
{
    super( null, shortMessage( messages ), longMessage( messages ) );
}
 
开发者ID:strator-dev,项目名称:greenpepper,代码行数:10,代码来源:CompilationFailureException.java


注:本文中的org.codehaus.plexus.compiler.CompilerError类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。