List of usage examples for org.aspectj.bridge IMessage getKind
Kind getKind();
From source file:AjcCompiler.java
License:Open Source License
/** * Hook into the maven logger./*from w ww . j ava 2s.co 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.ltwlog.MessageHolder.java
License:Open Source License
public boolean handleMessage(IMessage message) throws AbortException { if (isIgnoring(message.getKind())) { return false; } else {/*from w w w . j a va 2 s . c o m*/ s_messages.add(message.toString()); return true; } }
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)) ;/* www . j a v a 2 s . c o m*/ 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
private boolean isMessageDetailDesired(final IMessage message) { if (message != null) { for (IMessage.Kind current : showDetailsForMessageKindList) { if (message.getKind().equals(current)) { return true; }//from ww w . j a v a2s .c om } } return false; }
From source file:de.zalando.mojo.aspectj.MavenMessageHandler.java
License:Open Source License
private boolean isNotIgnored(final IMessage message, final IMessage.Kind messageType) { return message.getKind().equals(messageType) && !isIgnoring(messageType); }
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.// w ww . ja v a2s . c om */ 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.cooperari.core.aspectj.AgentFacade.java
License:Apache License
/** * Handle weaver agent message./* w w w .j a va 2 s .c o m*/ * * @param msg Message object. */ void handleMessage(IMessage msg) { if (CWorkspace.INSTANCE.isInitialized()) { if (_agentLog == null) { try { _agentLog = CWorkspace.INSTANCE.createLog(".", LOG_ID, CLog.Option.OMMIT_THREAD_INFO); } catch (Throwable e) { _agentLog = CLog.SYSTEM_OUT; } } _agentLog.message(msg.toString()); } if (msg.getKind() == IMessage.WEAVEINFO) { try { Matcher matcher = WI_MSG_PATTERN.matcher(msg.getMessage()); if (matcher.find()) { String kind = matcher.group(1); String desc = matcher.group(2); String signature; if (kind.equals(JoinPoint.SYNCHRONIZATION_LOCK)) { signature = CYieldPoint.MONITOR_ENTER_SIGNATURE; } else if (kind.equals(JoinPoint.SYNCHRONIZATION_UNLOCK)) { signature = CYieldPoint.MONITOR_EXIT_SIGNATURE; } else if (kind.equals(JoinPoint.METHOD_CALL)) { signature = uniformize(desc); } else { signature = kind + "(" + uniformize(desc) + ")"; } if (_ignoreSet.contains(signature)) { return; } String fileInfo = matcher.group(3); int lineInfo = Integer.parseInt(matcher.group(4)); CYieldPointImpl yp = new CYieldPointImpl(signature, fileInfo, lineInfo); synchronized (this) { _globalCoverageLog.recordDefinition(yp); } } } catch (Throwable e) { handleError(e); } } // else { // // } }
From source file:org.eclipse.ajdt.internal.core.ajde.CoreBuildMessageHandler.java
License:Open Source License
public boolean handleMessage(IMessage message) { if (!USE_LOG) { return true; }/*from w w w . j av a 2 s . co m*/ IMessage.Kind kind = message.getKind(); if (kind.equals(IMessage.ABORT)) { AJLog.log(AJLog.COMPILER, "AJC: Compiler error: " + message.getMessage()); //$NON-NLS-1$ message.getThrown().printStackTrace(); } if (isIgnoring(kind)) { return true; } AJLog.log(AJLog.COMPILER, "AJC: " + message); //$NON-NLS-1$ return true; }
From source file:org.eclipse.ajdt.internal.ui.ajde.UIMessageHandler.java
License:Open Source License
public boolean handleMessage(IMessage message) { IMessage.Kind kind = message.getKind(); if (kind == IMessage.ABORT || message.getThrown() != null) { // an exception has been thrown by AspectJ, therefore // want to create an error dialog containing the information // and display it to the user AJDTErrorHandler.handleInternalError(UIMessages.ajErrorDialogTitle, message.getMessage(), message.getThrown());//from www. j av a 2s .co m return true; } if (isIgnoring(kind)) { return true; } if (message.getSourceLocation() == null) { AJLog.log(AJLog.COMPILER_MESSAGES, message.getMessage()); //$NON-NLS-1$ problems.add(new ProblemTracker(message.getMessage(), null, message.getKind())); } else { if (DebugTracing.DEBUG_COMPILER_MESSAGES) { // avoid constructing log string if trace is not active AJLog.log(AJLog.COMPILER_MESSAGES, "addSourcelineTask message=" //$NON-NLS-1$ + message.getMessage() + " file=" //$NON-NLS-1$ + message.getSourceLocation().getSourceFile().getPath() + " line=" //$NON-NLS-1$ + message.getSourceLocation().getLine()); } else { AJLog.log(AJLog.COMPILER_MESSAGES, message.getMessage()); } problems.add(new ProblemTracker(message.getMessage(), message.getSourceLocation(), message.getKind(), message.getDeclared(), message.getExtraSourceLocations(), message.getID(), message.getSourceStart(), message.getSourceEnd(), message.getThrown())); } return true; }
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 . ja v a2 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); }