private BuildNotifierAdapter currNotifier = null;
private boolean initialized = false;
private boolean structureDirty = true;
- private boolean showInfoMessages = false;
// set to false in incremental mode to re-do initial build
private boolean nextBuild = false;
super();
}
- public void showInfoMessages(boolean show) { // XXX surface in GUI
- showInfoMessages = show;
- }
- public boolean getShowInfoMessages() {
- return showInfoMessages;
- }
-
- public void nextBuildFresh() {
+ public void nextBuildFresh() {
if (nextBuild) {
nextBuild = false;
}
public MessageHandlerAdapter() {
this.taskListManager = Ajde.getDefault().getTaskListManager();
+ ignore(IMessage.INFO);
}
public boolean handleMessage(IMessage message) throws AbortException {
IMessage.Kind kind = message.getKind();
if (kind == IMessage.ABORT) return handleAbort(message);
- if (isIgnoring(kind)
- || (!showInfoMessages && IMessage.INFO.equals(kind))) {
+ if (isIgnoring(kind)) {
return true;
- }
+ }
taskListManager.addSourcelineTask(message);
return true;// return super.handleMessage(message); // also store...
}
public IMessageHandler getMessageHandler() {
+ if (messageHandler == null) {
+ init();
+ }
return messageHandler;
}
public void testCancelFirstCompile() {
if (debugTests) System.out.println("\n\n\ntestCancelFirstCompile: Building with LoadsaCode.lst");
compilerAdapter = new CompilerAdapter();
- compilerAdapter.showInfoMessages(false);
BuildProgMon programmableBPM = new BuildProgMon();
programmableBPM.cancelOn("compiled:",1); // Force a cancel after the first compile occurs
public void testCancelThirdCompile() {
if (debugTests) System.out.println("\n\n\ntestCancelThirdCompile: Building with LoadsaCode.lst");
compilerAdapter = new CompilerAdapter();
- compilerAdapter.showInfoMessages(false);
BuildProgMon programmableBPM = new BuildProgMon();
programmableBPM.cancelOn("compiled:",3); // Force a cancel after the third compile occurs
public void testCancelFirstAspectWeave() {
if (debugTests) System.out.println("\n\n\ntestCancelFirstAspectWeave: Building with LoadsaCode.lst");
compilerAdapter = new CompilerAdapter();
- compilerAdapter.showInfoMessages(false);
BuildProgMon programmableBPM = new BuildProgMon();
programmableBPM.cancelOn("woven aspect ",1); // Force a cancel after the first weave aspect occurs
public void testCancelThirdAspectWeave() {
if (debugTests) System.out.println("\n\n\ntestCancelThirdAspectWeave: Building with LoadsaCode.lst");
compilerAdapter = new CompilerAdapter();
- compilerAdapter.showInfoMessages(false);
BuildProgMon programmableBPM = new BuildProgMon();
// Force a cancel after the third weave occurs.
public void testCancelFirstClassWeave() {
if (debugTests) System.out.println("testCancelFirstClassWeave: Building with EvenMoreCode.lst");
compilerAdapter = new CompilerAdapter();
- compilerAdapter.showInfoMessages(false);
BuildProgMon programmableBPM = new BuildProgMon();
programmableBPM.cancelOn("woven class",1);
public void testCancelSecondClassWeave() {
if (debugTests) System.out.println("testCancelSecondClassWeave: Building with EvenMoreCode.lst");
compilerAdapter = new CompilerAdapter();
- compilerAdapter.showInfoMessages(false);
BuildProgMon programmableBPM = new BuildProgMon();
programmableBPM.cancelOn("woven class",2);
import java.util.Set;
import org.aspectj.ajde.internal.CompilerAdapter;
+import org.aspectj.bridge.IMessage;
import org.aspectj.util.FileUtil;
public class ReweavableTestCase extends AjdeTestCase {
public void testNonReweavableCompile() {
if (debugTests) System.out.println("testNonReweavableCompile: Building with NonReweavable1.lst");
compilerAdapter = new CompilerAdapter();
- compilerAdapter.showInfoMessages(true);
+ compilerAdapter.getMessageHandler().dontIgnore(IMessage.INFO);
compilerAdapter.compile((String) openFile("NonReweavable1.lst").getAbsolutePath(),new BPM(),false);
assertFalse("Did not expect to find a message about the weaver operating in reweavable mode",
public void testReweavableCompile() {
if (debugTests) System.out.println("testReweavableCompile: Building with Reweavable1.lst");
compilerAdapter = new CompilerAdapter();
- compilerAdapter.showInfoMessages(true);
+ compilerAdapter.getMessageHandler().dontIgnore(IMessage.INFO);
compilerAdapter.compile((String) openFile("Reweavable1.lst").getAbsolutePath(),new BPM(),false);
assertTrue("Expected a message about operating in reweavable mode, but didn't get one",
public void testReweavableCompressCompile() {
if (debugTests) System.out.println("testReweavableCompressCompile: Building with ReweavableCompress1.lst");
compilerAdapter = new CompilerAdapter();
- compilerAdapter.showInfoMessages(true);
+ compilerAdapter.getMessageHandler().dontIgnore(IMessage.INFO);
compilerAdapter.compile((String) openFile("ReweavableCompress1.lst").getAbsolutePath(),new BPM(),false);
assertTrue("Expected a message about operating in reweavable mode, but didn't get one",
public void testReweavableSimpleCompile() {
if (debugTests) System.out.println("testReweavableSimpleCompile: Building with Reweavable1.lst");
compilerAdapter = new CompilerAdapter();
- compilerAdapter.showInfoMessages(true);
+ compilerAdapter.getMessageHandler().dontIgnore(IMessage.INFO);
compilerAdapter.compile((String) openFile("Reweavable1.lst").getAbsolutePath(),new BPM(),false);
assertTrue("Expected a message about operating in reweavable mode, but didn't get one",
public void testForReweavableSimpleErrorCompile() {
if (debugTests) System.out.println("testForReweavableSimpleErrorCompile: Building with Reweavable2.lst");
compilerAdapter = new CompilerAdapter();
- compilerAdapter.showInfoMessages(true);
+ compilerAdapter.getMessageHandler().dontIgnore(IMessage.INFO);
compilerAdapter.compile((String) openFile("Reweavable1.lst").getAbsolutePath(),new BPM(),false);
assertTrue("Expected a message about operating in reweavable mode, but didn't get one",
public void testErrorScenario2Compile() {
if (debugTests) System.out.println("testErrorScenario2: Building with TJP1.lst");
compilerAdapter = new CompilerAdapter();
- compilerAdapter.showInfoMessages(true);
+ compilerAdapter.getMessageHandler().dontIgnore(IMessage.INFO);
compilerAdapter.compile((String) openFile("TJP1.lst").getAbsolutePath(),new BPM(),false);
assertTrue("Expected a message about operating in reweavable mode, but didn't get one",
public void testWorkingScenario2Compile() {
if (debugTests) System.out.println("testWorkingScenario2: Building with TJP1.lst");
compilerAdapter = new CompilerAdapter();
- compilerAdapter.showInfoMessages(true);
+ compilerAdapter.getMessageHandler().dontIgnore(IMessage.INFO);
compilerAdapter.compile((String) openFile("TJP1.lst").getAbsolutePath(),new BPM(),false);
assertTrue("Expected a message about operating in reweavable mode, but didn't get one",
public void testWeaveMessagesAdvice() {
if (debugTests) System.out.println("testWeaveMessagesAdvice: Building with One.lst");
compilerAdapter = new CompilerAdapter();
- compilerAdapter.showInfoMessages(true);
compilerAdapter.compile((String) openFile("One.lst").getAbsolutePath(),new BPM(),false);
verifyWeavingMessages("advice",true);
}
public void testWeaveMessagesITD() {
if (debugTests) System.out.println("\ntestWeaveMessagesITD: Building with Two.lst");
compilerAdapter = new CompilerAdapter();
- compilerAdapter.showInfoMessages(true);
compilerAdapter.compile((String) openFile("Two.lst").getAbsolutePath(),new BPM(),false);
verifyWeavingMessages("itd",true);
}
public void testWeaveMessagesDeclare() {
if (debugTests) System.out.println("\ntestWeaveMessagesDeclare: Building with Three.lst");
compilerAdapter = new CompilerAdapter();
- compilerAdapter.showInfoMessages(true);
compilerAdapter.compile((String) openFile("Three.lst").getAbsolutePath(),new BPM(),false);
verifyWeavingMessages("declare1",true);
}
public void testWeaveMessagesDeclareExtends() {
if (debugTests) System.out.println("\ntestWeaveMessagesDeclareExtends: Building with Four.lst");
compilerAdapter = new CompilerAdapter();
- compilerAdapter.showInfoMessages(true);
compilerAdapter.compile((String) openFile("Four.lst").getAbsolutePath(),new BPM(),false);
verifyWeavingMessages("declare.extends",true);
}
public void testWeaveMessagesDeclareSoft() {
if (debugTests) System.out.println("\ntestWeaveMessagesDeclareSoft: Building with Five.lst");
compilerAdapter = new CompilerAdapter();
- compilerAdapter.showInfoMessages(true);
compilerAdapter.compile((String) openFile("Five.lst").getAbsolutePath(),new BPM(),false);
verifyWeavingMessages("declare.soft",true);
}
if (!LangUtil.is15VMOrGreater()) return; // annotation classes won't be about pre 15
if (debugTests) System.out.println("\ntestWeaveMessagesDeclareAnnotation: Building with Six.lst");
compilerAdapter = new CompilerAdapter();
- compilerAdapter.showInfoMessages(true);
compilerAdapter.compile((String) openFile("Six.lst").getAbsolutePath(),new BPM(),false);
verifyWeavingMessages("declare.annotation",true);
}
public void testWeaveMessagesDeclareAnnotationWeaveInfoOff() {
if (debugTests) System.out.println("\ntestWeaveMessagesDeclareAnnotation: Building with Seven.lst");
compilerAdapter = new CompilerAdapter();
- compilerAdapter.showInfoMessages(true);
compilerAdapter.compile((String) openFile("Seven.lst").getAbsolutePath(),new BPM(),false);
verifyWeavingMessages("declare.annotationNoWeaveInfo",true);
}
delegate.dontIgnore(kind);
}
+ /**
+ * Delegate
+ * @see org.aspectj.bridge.IMessageHandler#ignore(org.aspectj.bridge.IMessage.Kind)
+ * @param kind
+ */
+ public void ignore(IMessage.Kind kind) {
+ delegate.ignore(kind);
+ }
+
/** @return delegate.toString() */
public String toString() {
return delegate.toString();
if (proxy != null) proxy.reset();
counters.clear();
}
+
}
public void dontIgnore(IMessage.Kind kind) {
;
}
+ public void ignore(IMessage.Kind kind) {
+ }
};
/**
* @param kind
*/
void dontIgnore(IMessage.Kind kind);
+
+ /**
+ * Allow fine grained configuration after initialization.
+ *
+ * @param kind
+ */
+ void ignore(IMessage.Kind kind);
}
public void dontIgnore(IMessage.Kind kind) {
;
}
+ public void ignore(Kind kind) {
+ }
};
return visitMessages(holder, selector, true, false);
}
String text = message.getMessage();
return ((null != message) && (-1 != text.indexOf(infix)));
}
+
+ public void ignore(Kind kind) {
+ }
}
// ------------------ components to render messages
;
}
+ /**
+ * No-op
+ * @see org.aspectj.bridge.IMessageHandler#ignore(org.aspectj.bridge.IMessage.Kind)
+ * @param kind
+ */
+ public void ignore(IMessage.Kind kind) {
+ }
+
/** @return null to not print, or message rendering (including newlines) */
protected String render(IMessage message) {
return message.toString();
public void dontIgnore(Kind kind) {
delegate.dontIgnore(kind);
}
+
+
+ /* (non-Javadoc)
+ * @see org.aspectj.bridge.IMessageHandler#ignore(org.aspectj.bridge.IMessage.Kind)
+ */
+ public void ignore(Kind kind) {
+ delegate.ignore(kind);
+ }
private static class PinpointedMessage implements IMessage {
}
}
+ public void ignore(IMessage.Kind kind) {
+ if (kind.equals(IMessage.WEAVEINFO)) {
+ showWeaveInfo = false;
+ } else if (kind.equals(IMessage.DEBUG)) {
+ isVerbose = false;
+ } else if (kind.equals(IMessage.WARNING)) {
+ showWarn = true;
+ }
+ }
+
}
// Now jump through firey hoops to turn them on/off
if (handler instanceof CountingMessageHandler) {
IMessageHandler delegate = ((CountingMessageHandler)handler).delegate;
- // Without dontIgnore() on the IMessageHandler interface, we have to do this *blurgh*
- if (delegate instanceof MessageHandler) {
- if (swi)
- ((MessageHandler)delegate).dontIgnore(IMessage.WEAVEINFO);
- else
- ((MessageHandler)delegate).ignore(IMessage.WEAVEINFO);
- }
+ if (swi)
+ delegate.dontIgnore(IMessage.WEAVEINFO);
+ else
+ delegate.ignore(IMessage.WEAVEINFO);
}
-
boolean incrementalMode = buildConfig.isIncrementalMode()
|| buildConfig.isIncrementalFileMode();
;
}
+ /**
+ * No-op
+ * @see org.aspectj.bridge.IMessageHandler#ignore(org.aspectj.bridge.IMessage.Kind)
+ * @param kind
+ */
+ public void ignore(Kind kind) {
+ }
+
private int getStartPos(ISourceLocation sLoc,CompilationResult result) {
int pos = 0;
if (sLoc == null) return 0;
IProblem[] retValue = (IProblem[])ret.toArray(new IProblem[]{});
return retValue;
}
+
}
*/
public void dontIgnore(IMessage.Kind kind) {
;
- }
+ }
+
+ public void ignore(Kind kind) {
+ }
}
import org.aspectj.bridge.MessageUtil;
import org.aspectj.bridge.ReflectionFactory;
import org.aspectj.bridge.Version;
+import org.aspectj.bridge.IMessage.Kind;
import org.aspectj.bridge.context.CompilationAndWeavingContext;
import org.aspectj.util.FileUtil;
import org.aspectj.util.LangUtil;
return null;
}
}
+
+ /**
+ * No-op
+ * @see org.aspectj.bridge.IMessageHandler#ignore(org.aspectj.bridge.IMessage.Kind)
+ * @param kind
+ */
+ public void ignore(Kind kind) {
+ }
}
public static class LogModeMessagePrinter extends MessagePrinter {
public void dontIgnore(Kind kind) {
}
+
+ public void ignore(Kind kind) {
+ }
}
}
+ /* (non-Javadoc)
+ * @see org.aspectj.bridge.IMessageHandler#ignore(org.aspectj.bridge.IMessage.Kind)
+ */
+ public void ignore(Kind kind) {
+ // TODO Auto-generated method stub
+ }
+
}
*/
public void dontIgnore(Kind kind) {
}
+
+ /* (non-Javadoc)
+ * @see org.aspectj.bridge.IMessageHandler#ignore(org.aspectj.bridge.IMessage.Kind)
+ */
+ public void ignore(Kind kind) {
+ }
}
}
;
}
+ public void ignore(IMessage.Kind kind) {
+ }
+
public boolean handleMessage(IMessage message) {
(message.isFailed() ? failures : passes).add(message);
return true;
}
-
}
}
// /**
messageHolder.dontIgnore(kind);
}
+ public void ignore(IMessage.Kind kind) {
+ messageHolder.ignore(kind);
+ }
+
/**
* @see org.aspectj.bridge.IMessageHolder#hasAnyMessage(org.aspectj.bridge.IMessage.Kind, boolean)
*/
}
+ public void ignore(IMessage.Kind kind) {
+
+ }
}
\ No newline at end of file
public void dontIgnore(org.aspectj.bridge.IMessage.Kind kind) {
// empty
}
+
+ public void ignore(org.aspectj.bridge.IMessage.Kind kind) {
+ // empty
+ }
}
delegate.dontIgnore(kind);
}
}
+
+ public void ignore(Kind kind) {
+ if (null != kind) {
+ delegate.ignore(kind);
+ }
+ }
private boolean addMessage (IMessage message) {
messages.add(message);
public void setDelegate (IMessageHandler messageHandler) {
delegate = messageHandler;
}
+
}
protected class WeavingAdaptorMessageWriter extends MessageWriter {
}
public boolean isIgnoring(Kind kind) {return false;}
public void dontIgnore(IMessage.Kind kind) {;}
+ public void ignore(Kind kind) {}
}
public void testReferenceToNonAnnotationType() {
public void dontIgnore(Kind kind) {
}
+
+ public void ignore(Kind kind) {
+ }
}
}