Example usage for org.aspectj.bridge IMessage INFO

List of usage examples for org.aspectj.bridge IMessage INFO

Introduction

In this page you can find the example usage for org.aspectj.bridge IMessage INFO.

Prototype

Kind INFO

To view the source code for org.aspectj.bridge IMessage INFO.

Click Source Link

Usage

From source file:AjcCompiler.java

License:Open Source License

/**
 * Hook into the maven logger./*from   w w  w .j  ava 2s .  c o m*/
 */
public boolean handleMessage(IMessage message) {
    if (message.getKind().equals(IMessage.WARNING) && !isIgnoring(IMessage.WARNING))
        log.warning(message.getMessage());
    else if (message.getKind().equals(IMessage.DEBUG) && !isIgnoring(IMessage.DEBUG))
        log.fine(message.getMessage());
    else if (message.getKind().equals(IMessage.ERROR) && !isIgnoring(IMessage.ERROR))
        log.severe(message.getMessage());
    else if (message.getKind().equals(IMessage.ABORT) && !isIgnoring(IMessage.ABORT))
        log.severe(message.getMessage());
    else if (message.getKind().equals(IMessage.FAIL) && !isIgnoring(IMessage.FAIL))
        log.severe(message.getMessage());
    else if (message.getKind().equals(IMessage.INFO) && !isIgnoring(IMessage.INFO))
        log.fine(message.getMessage());
    else if (message.getKind().equals(IMessage.WEAVEINFO) && !isIgnoring(IMessage.WEAVEINFO))
        log.info(message.getMessage());
    else if (message.getKind().equals(IMessage.TASKTAG) && !isIgnoring(IMessage.TASKTAG))
        log.fine(message.getMessage());
    return super.handleMessage(message);
}

From source file:ataspectj.TestHelper.java

License:Open Source License

public boolean handleMessage(IMessage message) throws AbortException {
    boolean ret = super.handleMessage(message);
    if (message.getKind().isSameOrLessThan(IMessage.INFO))
        ;//  w  w  w . ja  v  a2 s .c  om
    if (message.getKind().isSameOrLessThan(IMessage.DEBUG))
        ;
    else {
        // we do exit here since Assert.fail will only trigger a runtime exception that might
        // be catched by the weaver anyway
        System.err.println("*** Exiting - got a warning/fail/error/abort IMessage");
        System.exit(-1);
    }
    return ret;
}

From source file:de.zalando.mojo.aspectj.MavenMessageHandler.java

License:Open Source License

/**
 * Copies output from the supplied message onto the active Maven Log.
 * If the message type (i.e. {@code message.getKind()}) is listed in the showDetailsForMessageKindList List,
 * the message is prefixed with location details (Class, row/line number etc.) as well.
 * <p/>/*from w w  w .ja  v  a2 s . c om*/
 * {@inheritDoc}
 */
public boolean handleMessage(final IMessage message) {

    // Compose the message text
    final StringBuilder builder = new StringBuilder(message.getMessage());
    if (isMessageDetailDesired(message)) {

        //
        // The AJC details are typically delivered on the format [fileName]:[lineNumber]
        // (i.e. /src/main/java/Clazz.java:16).
        //
        // Mimic this, and include the context of the message as well,
        // including guarding against NPEs.
        //
        final ISourceLocation sourceLocation = message.getSourceLocation();
        final String sourceFile = sourceLocation == null || sourceLocation.getSourceFile() == null
                ? "<unknown source file>"
                : sourceLocation.getSourceFile().getAbsolutePath();
        final String context = sourceLocation == null || sourceLocation.getContext() == null ? ""
                : sourceLocation.getContext() + "\n";
        final String line = sourceLocation == null ? "<no line information>" : "" + sourceLocation.getLine();

        builder.append("\n\t").append(sourceFile).append(":").append(line).append("\n").append(context);
    }

    final String messageText = builder.toString();

    if (isNotIgnored(message, IMessage.DEBUG) || isNotIgnored(message, IMessage.INFO)
            || isNotIgnored(message, IMessage.TASKTAG)) {

        // The DEBUG, INFO, and TASKTAG ajc message kinds are considered Maven Debug messages.
        log.debug(messageText);

    } else if (isNotIgnored(message, IMessage.WEAVEINFO)) {

        // The WEAVEINFO ajc message kind is considered Maven Info messages.
        log.info(messageText);

    } else if (isNotIgnored(message, IMessage.WARNING)) {

        // The WARNING ajc message kind is considered Maven Warn messages.
        log.warn(messageText);

    } else if (isNotIgnored(message, IMessage.ERROR) || isNotIgnored(message, IMessage.ABORT)
            || isNotIgnored(message, IMessage.FAIL)) {

        // We map ERROR, ABORT, and FAIL ajc message kinds to Maven Error messages.
        log.error(messageText);
    }

    // Delegate to normal handling.
    return super.handleMessage(message);
}

From source file:info.rubico.mock4aj.weavers.aspectj.DynamicRuntimeWeavingAdaptor.java

License:Open Source License

protected void initMessageHandler() {
    super.createMessageHandler();

    IMessageHandler messageHandler = getMessageHandler();
    // TODO Configure verbosity
    messageHandler.dontIgnore(IMessage.INFO); // VERBOSE
    messageHandler.dontIgnore(IMessage.DEBUG);
    messageHandler.dontIgnore(IMessage.WEAVEINFO);
}

From source file:org.caesarj.compiler.aspectj.CaesarMessageHandler.java

License:Open Source License

/**
 * Tells whether the given message kind should be ignored by the handler.
 *//*w  w w. j a  v a 2 s . com*/
public boolean isIgnoring(Kind kind) {
    return kind == IMessage.INFO || kind == IMessage.WEAVEINFO || kind == IMessage.DEBUG;
}

From source file:org.eclipse.ajdt.internal.core.ajde.CoreBuildMessageHandler.java

License:Open Source License

public CoreBuildMessageHandler() {
    ignoring = new ArrayList<Kind>();
    ignore(IMessage.INFO);
    ignore(IMessage.WEAVEINFO);
}

From source file:org.eclipse.ajdt.internal.ui.ajde.UIMessageHandler.java

License:Open Source License

public UIMessageHandler(IProject project) {
    ignoring = new ArrayList<Kind>();

    if (!AspectJPreferences.getBooleanPrefValue(project, AspectJPreferences.OPTION_verbose)) {
        ignore(IMessage.INFO);
    }/*from w w  w  .j a v  a2 s. c  om*/
    if (!AspectJPreferences.getShowWeaveMessagesOption(project)) {
        ignore(IMessage.WEAVEINFO);
    }
}

From source file:org.eclipse.ajdt.ui.tests.ajde.UIMessageHandlerTest.java

License:Open Source License

public void testDefaultSettingsMessagesThatAreIgnored() throws Exception {
    IProject project = createPredefinedProject("Bean Example"); //$NON-NLS-1$
    IBuildMessageHandler handler = AspectJPlugin.getDefault().getCompilerFactory()
            .getCompilerForProject(project).getMessageHandler();
    assertTrue("by default should be ignoring 'INFO' messages but " + //$NON-NLS-1$
            "are not", handler.isIgnoring(IMessage.INFO)); //$NON-NLS-1$
    assertTrue("by default should be ignoring 'WEAVEINFO' messages but " + //$NON-NLS-1$
            "are not", handler.isIgnoring(IMessage.WEAVEINFO)); //$NON-NLS-1$
}

From source file:org.springframework.aop.aspectj.AspectJWeaverMessageHandler.java

License:Apache License

@Override
public boolean handleMessage(IMessage message) throws AbortException {
    Kind messageKind = message.getKind();
    if (messageKind == IMessage.DEBUG) {
        if (logger.isDebugEnabled()) {
            logger.debug(makeMessageFor(message));
            return true;
        }/*from w  w  w .  j a  v  a 2 s .c o  m*/
    } else if (messageKind == IMessage.INFO || messageKind == IMessage.WEAVEINFO) {
        if (logger.isInfoEnabled()) {
            logger.info(makeMessageFor(message));
            return true;
        }
    } else if (messageKind == IMessage.WARNING) {
        if (logger.isWarnEnabled()) {
            logger.warn(makeMessageFor(message));
            return true;
        }
    } else if (messageKind == IMessage.ERROR) {
        if (logger.isErrorEnabled()) {
            logger.error(makeMessageFor(message));
            return true;
        }
    } else if (messageKind == IMessage.ABORT) {
        if (logger.isFatalEnabled()) {
            logger.fatal(makeMessageFor(message));
            return true;
        }
    }
    return false;
}