aboutsummaryrefslogtreecommitdiffstats
path: root/weaver
diff options
context:
space:
mode:
authorAndy Clement <andrew.clement@gmail.com>2013-01-21 10:46:15 -0800
committerAndy Clement <andrew.clement@gmail.com>2013-01-21 10:46:15 -0800
commit96ebaaed65fe5d507cae3d56126d76f217a9f13a (patch)
tree38321d9e9b8417f452434752a97c6e46fdbeabfa /weaver
parentefef2f31fe1b535e156332909d3e5ef47ab4a1d9 (diff)
downloadaspectj-96ebaaed65fe5d507cae3d56126d76f217a9f13a.tar.gz
aspectj-96ebaaed65fe5d507cae3d56126d76f217a9f13a.zip
398588 fix
Diffstat (limited to 'weaver')
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/BcelWorld.java51
1 files changed, 27 insertions, 24 deletions
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelWorld.java b/weaver/src/org/aspectj/weaver/bcel/BcelWorld.java
index c46c68985..7bf873bb1 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelWorld.java
+++ b/weaver/src/org/aspectj/weaver/bcel/BcelWorld.java
@@ -1000,41 +1000,44 @@ public class BcelWorld extends World implements Repository {
@Override
public boolean hasUnsatisfiedDependency(ResolvedType aspectType) {
- if (!aspectRequiredTypesProcessed) {
- if (aspectRequiredTypes != null) {
- List<String> forRemoval = new ArrayList<String>();
- for (Map.Entry<String, String> entry : aspectRequiredTypes.entrySet()) {
- ResolvedType rt = this.resolve(UnresolvedType.forName(entry.getValue()));
- if (!rt.isMissing()) {
- forRemoval.add(entry.getKey());
- } else {
- if (!getMessageHandler().isIgnoring(IMessage.INFO)) {
- getMessageHandler().handleMessage(
- MessageUtil.info("deactivating aspect '" + aspectType.getName() + "' as it requires type '"
- + rt.getName() + "' which cannot be found on the classpath"));
- }
+ if (aspectRequiredTypes == null) {
+ // no aspects require anything, so there can be no unsatisfied dependencies
+ return false;
+ }
+ String aspectName = aspectType.getName();
+ if (!aspectRequiredTypesProcessed.contains(aspectName)) {
+ String requiredTypeName = aspectRequiredTypes.get(aspectName);
+ if (requiredTypeName==null) {
+ aspectRequiredTypesProcessed.add(aspectName);
+ return false;
+ } else {
+ ResolvedType rt = resolve(UnresolvedType.forName(requiredTypeName));
+ if (!rt.isMissing()) {
+ aspectRequiredTypesProcessed.add(aspectName);
+ aspectRequiredTypes.remove(aspectName);
+ return false;
+ } else {
+ if (!getMessageHandler().isIgnoring(IMessage.INFO)) {
+ getMessageHandler().handleMessage(
+ MessageUtil.info("deactivating aspect '" + aspectName + "' as it requires type '"
+ + requiredTypeName + "' which cannot be found on the classpath"));
}
- }
- for (String key : forRemoval) {
- aspectRequiredTypes.remove(key);
+ aspectRequiredTypesProcessed.add(aspectName);
+ return true;
}
}
- aspectRequiredTypesProcessed = true;
- }
- if (aspectRequiredTypes == null) {
- return false;
}
- return aspectRequiredTypes.containsKey(aspectType.getName());
+ return aspectRequiredTypes.containsKey(aspectName);
}
- private boolean aspectRequiredTypesProcessed = false;
+ private List<String> aspectRequiredTypesProcessed = new ArrayList<String>();
private Map<String, String> aspectRequiredTypes = null;
- public void addAspectRequires(String name, String requiredType) {
+ public void addAspectRequires(String aspectClassName, String requiredType) {
if (aspectRequiredTypes == null) {
aspectRequiredTypes = new HashMap<String, String>();
}
- aspectRequiredTypes.put(name, requiredType);
+ aspectRequiredTypes.put(aspectClassName, requiredType);
}
/**