diff options
author | mkersten <mkersten> | 2004-08-18 23:38:38 +0000 |
---|---|---|
committer | mkersten <mkersten> | 2004-08-18 23:38:38 +0000 |
commit | 9be4b2e3694e69244a003d1b279f91d79eb2abe8 (patch) | |
tree | 904c348e647654c4fa5a6c3bda568268e581282e /org.aspectj.ajdt.core | |
parent | f335d93e363941f212bb3126339a3bca505a69f2 (diff) | |
download | aspectj-9be4b2e3694e69244a003d1b279f91d79eb2abe8.tar.gz aspectj-9be4b2e3694e69244a003d1b279f91d79eb2abe8.zip |
Added support for clients to extend the ASM relationships in order to add
new relationships (such as the example in the sandbox that adds additional
declared-parents relationships). There is no structural change to the compiler
or weaver. The AsmRelationshipProvider is now accessed by getDefault()
instead of statically, and its instance can be reset to be a subtype.
Diffstat (limited to 'org.aspectj.ajdt.core')
2 files changed, 19 insertions, 3 deletions
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java index 0acbb6465..110d7539e 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java @@ -329,7 +329,7 @@ public class AjLookupEnvironment extends LookupEnvironment { // (When done at weave time, it is done by invoking addRelationship() on // AsmRelationshipProvider (see BCELTypeMunger) if (!ResolvedTypeMunger.persistSourceLocation) // Do it up front if we bloody have to - AsmInterTypeRelationshipProvider.addRelationship(onType, munger); + AsmInterTypeRelationshipProvider.getDefault().addRelationship(onType, munger); } } @@ -362,7 +362,7 @@ public class AjLookupEnvironment extends LookupEnvironment { onType + ": " + dangerousInterfaces.get(parent), onType.getSourceLocation(), null); } - AsmRelationshipProvider.addDeclareParentsRelationship(declareParents.getSourceLocation(),factory.fromEclipse(sourceType)); + AsmRelationshipProvider.getDefault().addDeclareParentsRelationship(declareParents.getSourceLocation(),factory.fromEclipse(sourceType), newParents); addParent(sourceType, parent); } } diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AsmInterTypeRelationshipProvider.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AsmInterTypeRelationshipProvider.java index bb97a6ddd..ad43d9ee9 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AsmInterTypeRelationshipProvider.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AsmInterTypeRelationshipProvider.java @@ -19,14 +19,18 @@ import org.aspectj.asm.internal.ProgramElement; import org.aspectj.weaver.*; /** + * !!! is this class still being used? + * * @author Mik Kersten */ public class AsmInterTypeRelationshipProvider { + protected static AsmInterTypeRelationshipProvider INSTANCE = new AsmInterTypeRelationshipProvider(); + public static final String INTER_TYPE_DECLARES = "declared on"; public static final String INTER_TYPE_DECLARED_BY = "aspect declarations"; - public static void addRelationship( + public void addRelationship( ResolvedTypeX onType, EclipseTypeMunger munger) { @@ -63,4 +67,16 @@ public class AsmInterTypeRelationshipProvider { } } } + + public static AsmInterTypeRelationshipProvider getDefault() { + return INSTANCE; + } + + /** + * Reset the instance of this class, intended for extensibility. + * This enables a subclass to become used as the default instance. + */ + public static void setDefault(AsmInterTypeRelationshipProvider instance) { + INSTANCE = instance; + } } |