aboutsummaryrefslogtreecommitdiffstats
path: root/weaver
diff options
context:
space:
mode:
authoraclement <aclement>2010-08-03 22:24:05 +0000
committeraclement <aclement>2010-08-03 22:24:05 +0000
commitd6f04399f61ca8156968edffda9a39ec276d97a2 (patch)
treea8fe23ac9863f0ffbbc54bacaf81552e7156dd86 /weaver
parent75b983436c75eb0d1d40ba6d61df1ff6ef78aee4 (diff)
downloadaspectj-d6f04399f61ca8156968edffda9a39ec276d97a2.tar.gz
aspectj-d6f04399f61ca8156968edffda9a39ec276d97a2.zip
278496: world managing a set of type delegate resolvers
Diffstat (limited to 'weaver')
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/BcelWorld.java20
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/TypeDelegateResolver.java28
2 files changed, 48 insertions, 0 deletions
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelWorld.java b/weaver/src/org/aspectj/weaver/bcel/BcelWorld.java
index f9579da17..837c19b9b 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelWorld.java
+++ b/weaver/src/org/aspectj/weaver/bcel/BcelWorld.java
@@ -91,6 +91,7 @@ public class BcelWorld extends World implements Repository {
private final BcelWeavingSupport bcelWeavingSupport = new BcelWeavingSupport();
private boolean isXmlConfiguredWorld = false;
private WeavingXmlConfig xmlConfiguration;
+ private List<TypeDelegateResolver> typeDelegateResolvers;
private static Trace trace = TraceFactory.getTraceFactory().getTrace(BcelWorld.class);
@@ -373,6 +374,15 @@ public class BcelWorld extends World implements Repository {
ensureAdvancedConfigurationProcessed();
JavaClass jc = lookupJavaClass(classPath, name);
if (jc == null) {
+ // Anyone else to ask?
+ if (typeDelegateResolvers != null) {
+ for (TypeDelegateResolver tdr : typeDelegateResolvers) {
+ ReferenceTypeDelegate delegate = tdr.getDelegate(ty);
+ if (delegate != null) {
+ return delegate;
+ }
+ }
+ }
return null;
} else {
return buildBcelDelegate(ty, jc, false, false);
@@ -1180,4 +1190,14 @@ public class BcelWorld extends World implements Repository {
return false;
}
+ public void addTypeDelegateResolver(TypeDelegateResolver typeDelegateResolver) {
+ if (typeDelegateResolvers == null) {
+ typeDelegateResolvers = new ArrayList<TypeDelegateResolver>();
+ }
+ typeDelegateResolvers.add(typeDelegateResolver);
+ }
+
+ public void classWriteEvent(char[] classname) {
+ typeMap.classWriteEvent(new String(classname));
+ }
}
diff --git a/weaver/src/org/aspectj/weaver/bcel/TypeDelegateResolver.java b/weaver/src/org/aspectj/weaver/bcel/TypeDelegateResolver.java
new file mode 100644
index 000000000..2a29c927a
--- /dev/null
+++ b/weaver/src/org/aspectj/weaver/bcel/TypeDelegateResolver.java
@@ -0,0 +1,28 @@
+/* *******************************************************************
+ * Copyright (c) 2010 Contributors
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andy Clement, SpringSource
+ * ******************************************************************/
+package org.aspectj.weaver.bcel;
+
+import org.aspectj.weaver.ReferenceType;
+import org.aspectj.weaver.ReferenceTypeDelegate;
+
+/**
+ * A type delegate resolver is able to create type delegates for a named reference type. A type delegate will implement
+ * ReferenceTypeDelegate. There are three kind of delegate already in existence: those created for eclipse structures, those
+ * created for bytecode structures, and those created based on reflection.
+ *
+ * @author Andy Clement
+ */
+public interface TypeDelegateResolver {
+
+ ReferenceTypeDelegate getDelegate(ReferenceType referenceType);
+
+}