View | Details | Raw Unified | Return to bug 193065 | Differences between
and this patch

Collapse All | Expand All

(-).project (-1 / +2 lines)
Lines 11-22 Link Here
11
	</projects>
11
	</projects>
12
	<buildSpec>
12
	<buildSpec>
13
		<buildCommand>
13
		<buildCommand>
14
			<name>org.eclipse.jdt.core.javabuilder</name>
14
			<name>org.eclipse.ajdt.core.ajbuilder</name>
15
			<arguments>
15
			<arguments>
16
			</arguments>
16
			</arguments>
17
		</buildCommand>
17
		</buildCommand>
18
	</buildSpec>
18
	</buildSpec>
19
	<natures>
19
	<natures>
20
		<nature>org.eclipse.ajdt.ui.ajnature</nature>
20
		<nature>org.eclipse.jdt.core.javanature</nature>
21
		<nature>org.eclipse.jdt.core.javanature</nature>
21
	</natures>
22
	</natures>
22
</projectDescription>
23
</projectDescription>
(-).classpath (-4 / +5 lines)
Lines 2-16 Link Here
2
<classpath>
2
<classpath>
3
	<classpathentry kind="src" path="src"/>
3
	<classpathentry kind="src" path="src"/>
4
	<classpathentry kind="src" path="testsrc"/>
4
	<classpathentry kind="src" path="testsrc"/>
5
	<classpathentry sourcepath="JRE_SRC" kind="var" path="JRE_LIB"/>
5
	<classpathentry kind="var" path="JRE_LIB" sourcepath="JRE_SRC"/>
6
	<classpathentry kind="src" path="/runtime"/>
6
	<classpathentry kind="src" path="/runtime"/>
7
	<classpathentry sourcepath="/lib/junit/src.jar" kind="lib" path="/lib/junit/junit.jar"/>
7
	<classpathentry kind="lib" path="/lib/junit/junit.jar" sourcepath="/lib/junit/src.jar"/>
8
	<classpathentry kind="src" path="/util"/>
8
	<classpathentry kind="src" path="/util"/>
9
	<classpathentry kind="src" path="/testing-util"/>
9
	<classpathentry kind="src" path="/testing-util"/>
10
	<classpathentry kind="src" path="/bridge"/>
10
	<classpathentry kind="src" path="/bridge"/>
11
	<classpathentry kind="src" path="/asm"/>
11
	<classpathentry kind="src" path="/asm"/>
12
	<classpathentry combineaccessrules="false" kind="src" path="/aspectj5rt"/>
12
	<classpathentry combineaccessrules="false" kind="src" path="/aspectj5rt"/>
13
	<classpathentry sourcepath="/lib/bcel/bcel-src.zip" kind="lib" path="/lib/bcel/bcel.jar"/>
13
	<classpathentry kind="lib" path="/lib/bcel/bcel.jar" sourcepath="/lib/bcel/bcel-src.zip"/>
14
	<classpathentry sourcepath="/lib/commons/commons-src.zip" kind="lib" path="/lib/commons/commons.jar"/>
14
	<classpathentry kind="lib" path="/lib/commons/commons.jar" sourcepath="/lib/commons/commons-src.zip"/>
15
	<classpathentry kind="con" path="org.eclipse.ajdt.core.ASPECTJRT_CONTAINER"/>
15
	<classpathentry kind="output" path="bin"/>
16
	<classpathentry kind="output" path="bin"/>
16
</classpath>
17
</classpath>
(-)src/org/aspectj/weaver/CustomMungerFactory.java (+13 lines)
Added Link Here
1
package org.aspectj.weaver;
2
3
import java.util.Collection;
4
5
import org.aspectj.weaver.AjAttribute.TypeMunger;
6
import org.aspectj.weaver.patterns.Declare;
7
8
public interface CustomMungerFactory {
9
	public Collection<TypeMunger> createCustomTypeMungers(ResolvedType aspectType);
10
	public Collection<ShadowMunger> createCustomShadowMungers(ResolvedType aspectType);
11
	public Collection<Declare> createCustomDeclares(ResolvedType aspectType);
12
13
}
(-)src/org/aspectj/weaver/CustomMungerExtension.aj (+49 lines)
Added Link Here
1
package org.aspectj.weaver;
2
3
import java.util.ArrayList;
4
import java.util.Collection;
5
import java.util.List;
6
7
import org.aspectj.weaver.AjAttribute.TypeMunger;
8
import org.aspectj.weaver.patterns.Declare;
9
10
public privileged aspect CustomMungerExtension {
11
12
	private List<CustomMungerFactory> customMungerFactories = new ArrayList<CustomMungerFactory>();
13
	private boolean enabled = false;
14
15
	pointcut addOrReplaceAspect(ResolvedType aspectType, boolean inWeavingPhase):
16
	  execution(* CrosscuttingMembersSet.addOrReplaceAspect(..)) && args(aspectType, inWeavingPhase);
17
18
	after(ResolvedType aspectType, boolean inWeavingPhase,
19
			CrosscuttingMembersSet xSet):
20
		addOrReplaceAspect(aspectType, inWeavingPhase) && this(xSet) {
21
		if (inWeavingPhase && isEnabled()) {
22
			CrosscuttingMembers xcut = (CrosscuttingMembers) xSet.members
23
					.get(aspectType);
24
			for (CustomMungerFactory factory : customMungerFactories) {
25
				Collection<TypeMunger> customTypeMungers = factory.createCustomTypeMungers(aspectType);
26
				if (customTypeMungers != null)
27
					xcut.addTypeMungers(customTypeMungers);
28
				Collection<ShadowMunger> customShadowMungers = factory.createCustomShadowMungers(aspectType);
29
				if (customShadowMungers != null)
30
					xcut.addShadowMungers(customShadowMungers);
31
				Collection<Declare> customDeclare = factory.createCustomDeclares(aspectType);
32
				if (customDeclare != null)
33
					xcut.addDeclares(customDeclare);
34
			}
35
		}
36
	}
37
38
	public boolean isEnabled() {
39
		return enabled;
40
	}
41
	
42
	public void setEnabled(boolean enabled) {
43
		this.enabled = enabled;
44
	}
45
46
	public void addCustomMungerFactory(CustomMungerFactory factory) {
47
		customMungerFactories.add(factory);
48
	}
49
}

Return to bug 193065