From: mwebster Date: Wed, 23 Aug 2006 11:52:22 +0000 (+0000) Subject: Bug 150271 "Allow multiple levels of LTW information" (make weaving/not weaving messa... X-Git-Tag: BEFORE_133532~85 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=8549d861b124c20eba114b658e886bfbaf5d231c;p=aspectj.git Bug 150271 "Allow multiple levels of LTW information" (make weaving/not weaving messages debug and add -debug to options for aop.xml) --- diff --git a/loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java b/loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java index d43034c90..20d57f3e7 100644 --- a/loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java +++ b/loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java @@ -673,7 +673,7 @@ public class ClassLoaderWeavingAdaptor extends WeavingAdaptor { private void defineClass(ClassLoader loader, String name, byte[] bytes) { if (trace.isTraceEnabled()) trace.enter("defineClass",this,new Object[] {loader,name,bytes}); Object clazz = null; - info("generating class '" + name + "'"); + debug("generating class '" + name + "'"); try { //TODO av protection domain, and optimize diff --git a/loadtime/src/org/aspectj/weaver/loadtime/DefaultMessageHandler.java b/loadtime/src/org/aspectj/weaver/loadtime/DefaultMessageHandler.java index 80d6e23e3..c9b4a6d9f 100644 --- a/loadtime/src/org/aspectj/weaver/loadtime/DefaultMessageHandler.java +++ b/loadtime/src/org/aspectj/weaver/loadtime/DefaultMessageHandler.java @@ -21,6 +21,7 @@ import org.aspectj.bridge.AbortException; public class DefaultMessageHandler implements IMessageHandler { boolean isVerbose = false; + boolean isDebug = false; boolean showWeaveInfo = false; boolean showWarn = true; @@ -43,6 +44,9 @@ public class DefaultMessageHandler implements IMessageHandler { if (kind.isSameOrLessThan(IMessage.INFO)) { return !isVerbose; } + if (kind.isSameOrLessThan(IMessage.DEBUG)) { + return !isDebug; + } return !showWarn; } diff --git a/loadtime/src/org/aspectj/weaver/loadtime/Options.java b/loadtime/src/org/aspectj/weaver/loadtime/Options.java index 67265343f..be01cb7ec 100644 --- a/loadtime/src/org/aspectj/weaver/loadtime/Options.java +++ b/loadtime/src/org/aspectj/weaver/loadtime/Options.java @@ -35,6 +35,7 @@ public class Options { private final static String OPTION_noWarnNone = "-warn:none"; private final static String OPTION_proceedOnError = "-proceedOnError"; private final static String OPTION_verbose = "-verbose"; + private final static String OPTION_debug = "-debug"; private final static String OPTION_reweavable = "-Xreweavable";//notReweavable is default for LTW private final static String OPTION_noinline = "-Xnoinline"; private final static String OPTION_addSerialVersionUID = "-XaddSerialVersionUID"; @@ -106,6 +107,8 @@ public class Options { weaverOption.optionalJoinpoints = arg.substring(OPTIONVALUED_joinpoints.length()).trim(); } else if (arg.equalsIgnoreCase(OPTION_verbose)) { weaverOption.verbose = true; + } else if (arg.equalsIgnoreCase(OPTION_debug)) { + weaverOption.debug = true; } else if (arg.equalsIgnoreCase(OPTION_pinpoint)) { weaverOption.pinpoint = true; } else if (arg.startsWith(OPTIONVALUED_messageHandler)) { @@ -141,6 +144,9 @@ public class Options { if (weaverOption.verbose) { weaverOption.messageHandler.dontIgnore(IMessage.INFO); } + if (weaverOption.debug) { + weaverOption.messageHandler.dontIgnore(IMessage.DEBUG); + } if (weaverOption.showWeaveInfo) { weaverOption.messageHandler.dontIgnore(IMessage.WEAVEINFO); } @@ -156,6 +162,7 @@ public class Options { boolean noWarn; boolean proceedOnError; boolean verbose; + boolean debug; boolean notReWeavable = true;//default to notReweavable for LTW (faster) boolean noInline; boolean addSerialVersionUID; diff --git a/tests/java5/ataspectj/ajc-ant.xml b/tests/java5/ataspectj/ajc-ant.xml index 8dccebac7..12df7d64c 100644 --- a/tests/java5/ataspectj/ajc-ant.xml +++ b/tests/java5/ataspectj/ajc-ant.xml @@ -1,11 +1,13 @@ - + + + - - - + diff --git a/tests/java5/ataspectj/ataspectj/TestHelper.java b/tests/java5/ataspectj/ataspectj/TestHelper.java index 378f5936d..f53956193 100644 --- a/tests/java5/ataspectj/ataspectj/TestHelper.java +++ b/tests/java5/ataspectj/ataspectj/TestHelper.java @@ -57,9 +57,9 @@ public class TestHelper extends DefaultMessageHandler { public boolean handleMessage(IMessage message) throws AbortException { boolean ret = super.handleMessage(message); - if (message.getKind().isSameOrLessThan(IMessage.INFO)) { - ; - } else { + if (message.getKind().isSameOrLessThan(IMessage.INFO)); + 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"); diff --git a/tests/java5/ataspectj/ataspectj/aop-dumpbeforeandafter.xml b/tests/java5/ataspectj/ataspectj/aop-dumpbeforeandafter.xml index 8f0ef772d..cf94484e7 100644 --- a/tests/java5/ataspectj/ataspectj/aop-dumpbeforeandafter.xml +++ b/tests/java5/ataspectj/ataspectj/aop-dumpbeforeandafter.xml @@ -3,7 +3,7 @@ - + diff --git a/tests/java5/ataspectj/ataspectj/ltwlog/aop-verbose.xml b/tests/java5/ataspectj/ataspectj/ltwlog/aop-verbose.xml index 7cd1b4629..edaa71777 100644 --- a/tests/java5/ataspectj/ataspectj/ltwlog/aop-verbose.xml +++ b/tests/java5/ataspectj/ataspectj/ltwlog/aop-verbose.xml @@ -1,5 +1,5 @@ - + diff --git a/tests/java5/ataspectj/ataspectj/ltwlog/aop-verboseandshow.xml b/tests/java5/ataspectj/ataspectj/ltwlog/aop-verboseandshow.xml index 557ad27a5..8f1d70406 100644 --- a/tests/java5/ataspectj/ataspectj/ltwlog/aop-verboseandshow.xml +++ b/tests/java5/ataspectj/ataspectj/ltwlog/aop-verboseandshow.xml @@ -1,5 +1,5 @@ - + diff --git a/tests/ltw/aop-defineaspect.xml b/tests/ltw/aop-defineaspect.xml index f40bff2c4..2fe76caa5 100644 --- a/tests/ltw/aop-defineaspect.xml +++ b/tests/ltw/aop-defineaspect.xml @@ -4,6 +4,6 @@ - + diff --git a/tests/ltw/aop-emptytests.xml b/tests/ltw/aop-emptytests.xml index da7bd5e2a..f686bb484 100644 --- a/tests/ltw/aop-emptytests.xml +++ b/tests/ltw/aop-emptytests.xml @@ -2,7 +2,7 @@ - + \ No newline at end of file diff --git a/tests/ltw/aop-nomatch.xml b/tests/ltw/aop-nomatch.xml index 620a4c77e..ac82b6014 100644 --- a/tests/ltw/aop-nomatch.xml +++ b/tests/ltw/aop-nomatch.xml @@ -3,5 +3,5 @@ - + diff --git a/tests/ltw/aop-nomatchxlint.xml b/tests/ltw/aop-nomatchxlint.xml index 4271e394d..46c38ca75 100644 --- a/tests/ltw/aop-nomatchxlint.xml +++ b/tests/ltw/aop-nomatchxlint.xml @@ -3,5 +3,5 @@ - + diff --git a/tests/ltw/aop-nomatchxlintfile.xml b/tests/ltw/aop-nomatchxlintfile.xml index 35ce126e3..1bfabf169 100644 --- a/tests/ltw/aop-nomatchxlintfile.xml +++ b/tests/ltw/aop-nomatchxlintfile.xml @@ -3,5 +3,5 @@ - + diff --git a/tests/src/org/aspectj/systemtest/ajc150/ataspectj/ltw.xml b/tests/src/org/aspectj/systemtest/ajc150/ataspectj/ltw.xml index a74d17ede..a27ecd482 100644 --- a/tests/src/org/aspectj/systemtest/ajc150/ataspectj/ltw.xml +++ b/tests/src/org/aspectj/systemtest/ajc150/ataspectj/ltw.xml @@ -2,7 +2,7 @@ - + @@ -113,8 +113,8 @@ - - + + @@ -182,8 +182,8 @@ - - + + @@ -207,9 +207,9 @@ - + - + @@ -264,7 +264,7 @@ files="ataspectj/ltwlog/MessageHolder.java,ataspectj/ltwreweavable/MainReweavableLogging.java,ataspectj/ltwreweavable/AspectReweavableLogging.java,ataspectj/ltwreweavable/Advisable.java,ataspectj/ltwreweavable/EmptyAtAspect.java" options="-1.5" outjar="main1.jar"/> - + diff --git a/tests/src/org/aspectj/systemtest/ajc150/ltw/ltw-tests.xml b/tests/src/org/aspectj/systemtest/ajc150/ltw/ltw-tests.xml index 14bf511c5..816ff27b2 100644 --- a/tests/src/org/aspectj/systemtest/ajc150/ltw/ltw-tests.xml +++ b/tests/src/org/aspectj/systemtest/ajc150/ltw/ltw-tests.xml @@ -6,7 +6,7 @@ @@ -14,7 +14,7 @@ classpath="main1.jar" files="Aspect2.aj" outjar="aspect2.jar" - options="-showWeaveInfo" + options="-showWeaveInfo -verbose" > @@ -227,8 +227,8 @@ - - + + @@ -396,7 +396,7 @@ - + @@ -419,7 +419,7 @@ - + @@ -442,7 +442,7 @@ - + @@ -465,7 +465,7 @@ - + diff --git a/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml b/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml index 39bb0146a..812d15830 100644 --- a/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml +++ b/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml @@ -703,8 +703,8 @@ - - + + diff --git a/weaver/src/org/aspectj/weaver/tools/WeavingAdaptor.java b/weaver/src/org/aspectj/weaver/tools/WeavingAdaptor.java index 3d80b9901..b1adcfb8f 100644 --- a/weaver/src/org/aspectj/weaver/tools/WeavingAdaptor.java +++ b/weaver/src/org/aspectj/weaver/tools/WeavingAdaptor.java @@ -233,17 +233,17 @@ public class WeavingAdaptor implements IMessageContext { // a valid aspectOf()/hasAspect() generated in them. However - if they are excluded // (via include/exclude in aop.xml) they really should only get aspectOf()/hasAspect() // and not be included in the full set of aspects being applied by 'this' weaver - info("weaving '" + name + "'"); + debug("weaving '" + name + "'"); bytes = getWovenBytes(name, bytes); } else if (shouldWeaveAnnotationStyleAspect(name, bytes)) { // an @AspectJ aspect needs to be at least munged by the aspectOf munger - info("weaving '" + name + "'"); + debug("weaving '" + name + "'"); bytes = getAtAspectJAspectBytes(name, bytes); } else { - info("not weaving '" + name + "'"); + debug("not weaving '" + name + "'"); } } else { - info("cannot weave '" + name + "'"); + debug("cannot weave '" + name + "'"); } if (trace.isTraceEnabled()) trace.exit("weaveClass",bytes); @@ -392,6 +392,10 @@ public class WeavingAdaptor implements IMessageContext { return ret; } + protected boolean debug (String message) { + return MessageUtil.debug(messageHandler,message); + } + protected boolean info (String message) { return MessageUtil.info(messageHandler,message); } @@ -542,6 +546,7 @@ public class WeavingAdaptor implements IMessageContext { super(writer,true); ignore(IMessage.WEAVEINFO); + ignore(IMessage.DEBUG); ignore(IMessage.INFO); this.failKind = IMessage.ERROR; }