<
aspect xmlns:src="
http://www.sdml.info/srcML/src"
xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
xmlns="
http://control.ee.ethz.ch/XWeaver/AspectX"
xsi:schemaLocation="
http://control.ee.ethz.ch/XWeaver/AspectX ../../../../src/xsd/aspectX.xsd"
name="
AddDeclarations">
<
description>
This aspect tests the weaving rule <
code>
accessModifierBlock_add_declaration</
code>
. It contains five
advices that inserts various combinations of member variable declarations to the code.
It adds the member variable multiple times if there are more access modifiers in the class.
<
author>
I. Birrer</
author>
</
description>
<
advice type="
add"
name="
addPrivate_1">
<
description>
Inserts private member variable to all classes.</
description>
<
pointcut type="
src:private" />
<
codeModifier type="
declaration">
<
text>
int privateVar_1;</
text>
</
codeModifier>
</
advice>
<
advice type="
add"
name="
addPrivate_2">
<
description>
Inserts private member variable to all classes that have
explicit <
code>
public</
code>
declarations.</
description>
<
pointcut type="
src:private"
constraint="
not(@type)" />
<
codeModifier type="
declaration">
<
text>
int privateVar_2;</
text>
</
codeModifier>
</
advice>
<
advice type="
add"
name="
addPublic_1">
<
description>
Inserts public member variable to all classes.</
description>
<
pointcut type="
src:public" />
<
codeModifier type="
declaration">
<
text>
int publicVar_1;</
text>
</
codeModifier>
</
advice>
<
advice type="
add"
name="
addPublic_2">
<
description>
Inserts public member variable to all classes.</
description>
<
pointcut type="
src:public" />
<
codeModifier type="
declaration">
<
text>
int publicVar_2;</
text>
</
codeModifier>
</
advice>
<
advice type="
add"
name="
addProtected">
<
description>
Inserts two protected member variables to all classes.
This advice contains two code modifiers.</
description>
<
pointcut type="
src:protected" />
<
codeModifier type="
declaration">
<
text>
int protectedVar_1;</
text>
</
codeModifier>
<
codeModifier type="
declaration">
<
text>
int protectedVar_2;</
text>
</
codeModifier>
</
advice>
</
aspect>
v