From 2251050afdb26ea2521c584fa79d74bd4698ebd9 Mon Sep 17 00:00:00 2001 From: aclement Date: Wed, 16 Jun 2010 18:14:07 +0000 Subject: 310506: optional aspects --- .../aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'loadtime') diff --git a/loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java b/loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java index 0db0220c4..134de582f 100644 --- a/loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java +++ b/loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java @@ -451,6 +451,15 @@ public class ClassLoaderWeavingAdaptor extends WeavingAdaptor { info("register aspect " + aspectClassName); // System.err.println("? ClassLoaderWeavingAdaptor.registerAspects() aspectName=" + aspectClassName + // ", loader=" + loader + ", bundle=" + weavingContext.getClassLoaderName()); + String requiredType = definition.getAspectRequires(aspectClassName); + if (requiredType != null) { + // This aspect expresses that it requires a type to be around, otherwise it should 'switch off' + ((BcelWorld) weaver.getWorld()).addAspectRequires(aspectClassName, requiredType); + } + String definedScope = definition.getScopeForAspect(aspectClassName); + if (definedScope != null) { + ((BcelWorld) weaver.getWorld()).addScopedAspect(aspectClassName, definedScope); + } // ResolvedType aspect = weaver.addLibraryAspect(aspectClassName); @@ -461,10 +470,6 @@ public class ClassLoaderWeavingAdaptor extends WeavingAdaptor { namespace = namespace.append(";").append(aspectClassName); } - String definedScope = definition.getScopeForAspect(aspectClassName); - if (definedScope != null) { - ((BcelWorld) weaver.getWorld()).addScopedAspect(aspectClassName, definedScope); - } } else { // warn("aspect excluded: " + aspectClassName); lint("aspectExcludedByConfiguration", new String[] { aspectClassName, getClassLoaderName(loader) }); -- cgit v1.2.3