diff options
author | aclement <aclement> | 2005-04-19 12:16:57 +0000 |
---|---|---|
committer | aclement <aclement> | 2005-04-19 12:16:57 +0000 |
commit | 1ab8062fcd5a15d092ce2e69d1b603edba12f753 (patch) | |
tree | 322eb964137ad85bce27eb24254108d83716ae75 | |
parent | e8601ecc09d493767162d7d97a2850a08a8de386 (diff) | |
download | aspectj-1ab8062fcd5a15d092ce2e69d1b603edba12f753.tar.gz aspectj-1ab8062fcd5a15d092ce2e69d1b603edba12f753.zip |
from branch: changes for @AJ - any tests for this???
-rw-r--r-- | weaver/src/org/aspectj/weaver/tools/WeavingAdaptor.java | 38 |
1 files changed, 25 insertions, 13 deletions
diff --git a/weaver/src/org/aspectj/weaver/tools/WeavingAdaptor.java b/weaver/src/org/aspectj/weaver/tools/WeavingAdaptor.java index 0e79157bb..a24008f7c 100644 --- a/weaver/src/org/aspectj/weaver/tools/WeavingAdaptor.java +++ b/weaver/src/org/aspectj/weaver/tools/WeavingAdaptor.java @@ -14,7 +14,6 @@ package org.aspectj.weaver.tools; import java.io.File; -import java.io.FileNotFoundException; import java.io.IOException; import java.io.PrintWriter; import java.net.URL; @@ -38,6 +37,7 @@ import org.aspectj.util.FileUtil; import org.aspectj.weaver.IClassFileProvider; import org.aspectj.weaver.IWeaveRequestor; import org.aspectj.weaver.ResolvedTypeX; +import org.aspectj.weaver.ataspectj.Ajc5MemberMaker; import org.aspectj.weaver.bcel.BcelWeaver; import org.aspectj.weaver.bcel.BcelWorld; import org.aspectj.weaver.bcel.UnwovenClassFile; @@ -64,13 +64,13 @@ public class WeavingAdaptor { public static final String WEAVING_ADAPTOR_VERBOSE = "aj.weaving.verbose"; public static final String SHOW_WEAVE_INFO_PROPERTY = "org.aspectj.weaver.showWeaveInfo"; - private boolean enabled = true; - private boolean verbose = getVerbose(); - private BcelWorld bcelWorld = null; - private BcelWeaver weaver = null; - private WeavingAdaptorMessageHandler messageHandler = null; - private GeneratedClassHandler generatedClassHandler; - private Map generatedClasses = new HashMap(); /* String -> UnwovenClassFile */ + protected boolean enabled = true; + protected boolean verbose = getVerbose(); + protected BcelWorld bcelWorld = null; + protected BcelWeaver weaver = null; + protected WeavingAdaptorMessageHandler messageHandler = null; + protected GeneratedClassHandler generatedClassHandler; + protected Map generatedClasses = new HashMap(); /* String -> UnwovenClassFile */ /** * Construct a WeavingAdaptor with a reference to a weaving class loader. The @@ -183,16 +183,28 @@ public class WeavingAdaptor { private boolean shouldWeave (String name) { name = name.replace('/','.'); boolean b = (enabled && !generatedClasses.containsKey(name) && shouldWeaveName(name) && shouldWeaveAspect(name)); - return b; + return b && accept(name); } - + + //ATAJ + protected boolean accept(String name) { + return true; + } + private boolean shouldWeaveName (String name) { return !((name.startsWith("org.apache.bcel.") || name.startsWith("org.aspectj.") || name.startsWith("java.") || name.startsWith("javax."))); } - + + /** + * We allow @AJ aspect weaving so that we can add aspectOf() as part of the weaving + * (and not part of the source compilation) + * + * @param name + * @return + */ private boolean shouldWeaveAspect (String name) { ResolvedTypeX type = bcelWorld.resolve(name); - return (type == null || !type.isAspect()); + return (type == null || !type.isAspect() || Ajc5MemberMaker.isAnnotationStyleAspect(type)); } /** @@ -278,7 +290,7 @@ public class WeavingAdaptor { * Processes messages arising from weaver operations. * Tell weaver to abort on any message more severe than warning. */ - private class WeavingAdaptorMessageHandler extends MessageWriter { + protected class WeavingAdaptorMessageHandler extends MessageWriter { private Set ignoring = new HashSet(); private IMessage.Kind failKind; |