--- /dev/null
+/* *******************************************************************
+ * Copyright (c) 2007 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:
+ * Linton Ye https://bugs.eclipse.org/bugs/show_bug.cgi?id=193065
+ * ******************************************************************/
+
+package org.aspectj.weaver;
+
+import java.util.Collection;
+
+public interface CustomMungerFactory {
+ public Collection/*ShadowMunger*/ createCustomShadowMungers(ResolvedType aspectType);
+ public Collection/*ConcreteTypeMunger*/ createCustomTypeMungers(ResolvedType aspectType);
+// public Collection<Declare> createCustomDeclares(ResolvedType aspectType);
+}
public int hardSize() {
return tMap.size();
}
+
+ public ResolvedType[] getAllTypes() {
+ List/*ResolvedType*/ results = new ArrayList();
+
+ collectTypes(expendableMap, results);
+ collectTypes(tMap, results);
+ return (ResolvedType[]) results.toArray(new ResolvedType[results.size()]);
+ }
+
+ private void collectTypes(Map map, List/*ResolvedType*/ results) {
+ for (Iterator iterator = map.keySet().iterator(); iterator.hasNext();) {
+ String key = (String) iterator.next();
+ ResolvedType type = get((String)key);
+ if (type!=null) results.add(type);
+ else System.err.println("null!:"+key);
+ }
+ }
+
+
}
/** Reference types we don't intend to weave may be ejected from
public boolean isASMAround() {
return isASMAround;
}
+
+ public ResolvedType[] getAllTypes() {
+ return typeMap.getAllTypes();
+ }
+
}
\ No newline at end of file
import org.aspectj.weaver.BCException;
import org.aspectj.weaver.ConcreteTypeMunger;
import org.aspectj.weaver.CrosscuttingMembersSet;
+import org.aspectj.weaver.CustomMungerFactory;
import org.aspectj.weaver.IClassFileProvider;
import org.aspectj.weaver.IWeaveRequestor;
import org.aspectj.weaver.IWeaver;
private List declareParentsList = null; // setup by prepareForWeave
private ZipOutputStream zipOutputStream;
+ private CustomMungerFactory customMungerFactory;
// ----
typeMungerList = xcutSet.getTypeMungers();
lateTypeMungerList = xcutSet.getLateTypeMungers();
declareParentsList = xcutSet.getDeclareParents();
+
+ addCustomMungers();
// The ordering here used to be based on a string compare on toString() for the two mungers -
// that breaks for the @AJ style where advice names aren't programmatically generated. So we
if (trace.isTraceEnabled()) trace.exit("prepareForWeave");
}
+ private void addCustomMungers() {
+ if (customMungerFactory != null) {
+ for (Iterator i = addedClasses.iterator(); i.hasNext();) {
+ UnwovenClassFile jc = (UnwovenClassFile) i.next();
+ String name = jc.getClassName();
+ ResolvedType type = world.resolve(name);
+ if (type.isAspect()) {
+ Collection/*ShadowMunger*/ shadowMungers = customMungerFactory.createCustomShadowMungers(type);
+ if (shadowMungers != null) {
+ shadowMungerList.addAll(shadowMungers);
+ }
+ Collection/*ConcreteTypeMunger*/ typeMungers = customMungerFactory
+ .createCustomTypeMungers(type);
+ if (typeMungers != null)
+ typeMungerList.addAll(typeMungers);
+ }
+ }
+ }
+ }
+
+ public void setCustomMungerFactory(CustomMungerFactory factory) {
+ customMungerFactory = factory;
+ }
+
/*
* Rewrite all of the pointcuts in the world into their most efficient
* form for subsequent matching. Also ensure that if pc1.equals(pc2)