List of usage examples for org.aspectj.bridge IMessage WARNING
Kind WARNING
To view the source code for org.aspectj.bridge IMessage WARNING.
Click Source Link
From source file:AjcCompiler.java
License:Open Source License
/** * Hook into the maven logger./*from w w w. j av a 2 s .c om*/ */ 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: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 ww . ja v a2 s .c o m*/ * {@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:org.caesarj.compiler.aspectj.CaesarMessageHandler.java
License:Open Source License
/** * Handles the (AspectJ) message, by creating a KOPI-error and report it to * the compiler./*from w w w . jav a 2 s .c o m*/ */ public boolean handleMessage(IMessage message) throws AbortException { if (isIgnoring(message.getKind())) { return true; } ISourceLocation location = message.getSourceLocation(); if (message.getKind() == IMessage.WARNING) { if (location != null) { compiler.get() .reportTrouble(new CWarning( new TokenReference(location.getSourceFile().getPath(), location.getSourceFile(), location.getLine()), new Message(CaesarMessages.ASPECTJ_WARNING, message.getMessage()))); } else { compiler.get().reportTrouble(new CWarning(TokenReference.NO_REF, new Message(CaesarMessages.ASPECTJ_WARNING, message.getMessage()))); } return true; } if (location != null) { compiler.get() .reportTrouble(new PositionedError( new TokenReference(location.getSourceFile().getPath(), location.getSourceFile(), location.getLine()), new Message(CaesarMessages.ASPECTJ_ERROR, message.getMessage()))); } else { compiler.get().reportTrouble(new PositionedError(TokenReference.NO_REF, new Message(CaesarMessages.ASPECTJ_ERROR, message.getMessage()))); } return true; }
From source file:org.eclipse.ajdt.internal.ui.ajde.UIMessageHandler.java
License:Open Source License
/** * Sets the given marker to have hte appropriate severity, according to the * kind.// w w w . j av a 2 s. c om * * @param marker * the marker to set the message for * @param kind * used to determine the appropriate severity * @throws CoreException */ private void setSeverity(IMarker marker, IMessage.Kind kind) throws CoreException { if (kind == IMessage.ERROR) { marker.setAttribute(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_ERROR)); } else if (kind == IMessage.WARNING) { marker.setAttribute(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_WARNING)); } else { marker.setAttribute(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_INFO)); } }
From source file:org.eclipse.ajdt.internal.utils.AJDTUtils.java
License:Open Source License
/** * Decorate icon based on modifiers, errors etc. Possible decorations are: * abstract, final, synchronized, static, runnable, warning, error, * overrides, implements//from w w w .j a v a 2 s . c o m */ public static ImageDescriptor decorate(ImageDescriptor base, IProgramElement pNode) { int flags = 0; if (pNode != null) { List<Modifiers> modifiers = pNode.getModifiers(); if (modifiers != null) { if (modifiers.contains(IProgramElement.Modifiers.ABSTRACT)) { flags = flags | JavaElementImageDescriptor.ABSTRACT; } if (modifiers.contains(IProgramElement.Modifiers.FINAL)) { flags = flags | JavaElementImageDescriptor.FINAL; } if (modifiers.contains(IProgramElement.Modifiers.SYNCHRONIZED)) { flags = flags | JavaElementImageDescriptor.SYNCHRONIZED; } if (modifiers.contains(IProgramElement.Modifiers.STATIC)) { flags = flags | JavaElementImageDescriptor.STATIC; } } if (pNode.getKind() == IProgramElement.Kind.CONSTRUCTOR || pNode.getKind() == IProgramElement.Kind.INTER_TYPE_CONSTRUCTOR) { flags = flags | JavaElementImageDescriptor.CONSTRUCTOR; } if (pNode.isRunnable()) { flags = flags | JavaElementImageDescriptor.RUNNABLE; } if (pNode.isOverrider()) { flags = flags | JavaElementImageDescriptor.OVERRIDES; } if (pNode.isImplementor()) { flags = flags | JavaElementImageDescriptor.IMPLEMENTS; } IMessage sMessage = pNode.getMessage(); if (sMessage != null) { if (sMessage.getKind() == IMessage.ERROR) { flags = flags | JavaElementImageDescriptor.ERROR; } else if (sMessage.getKind() == IMessage.WARNING) { flags = flags | JavaElementImageDescriptor.WARNING; } } } return decorate(base, flags); }
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; }//w ww . java2s . com } 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; }