Hi there
I was to compile a simple test using abc, but I got the following exception:
"abc.weaving.weaver.AroundWeaver$InternalAroundError: ARD around weaver
internal error"
This exception was thrown by AroundWeaver.java at line 1874. Does this
mean a bug in the compiler? Please consider the base code:
public class A {
int notPositive;
int notNegative;
public A() {
setNotNegative(0);
setNotPositive(0);
}
public int getNotNegative() {
return notNegative;
}
public void setNotNegative(int value) {
this.notNegative = value;
System.out.println("notNegative was set to " + this.notNegative);
}
public int getNotPositive() {
return notPositive;
}
public void setNotPositive(int value) {
this.notPositive = value;
System.out.println("notPositive was set to " + this.notPositive);
}
public void exchange() {
int x = getNotPositive();
setNotPositive(this.notNegative);
setNotNegative(x);
}
}
public class Test {
public static void main(String[] args) {
A a = new A();
a.setNotNegative(1);
a.setNotPositive(-1);
a.exchange();
}
}
And then the aspects:
public aspect RangeCheckAspectV1 {
pointcut notPositiveSet(int val)
: call(* A.setNotPositive(..)) && args(val);
pointcut notNegativeSet(int val)
: call(* A.setNotNegative(..)) && args(val);
void around(int val) : notPositiveSet(val) {
if (val > 0)
proceed(0);
else
proceed(val);
}
void around(int val) : notNegativeSet(val) {
if (val < 0)
proceed(0);
else
proceed(val);
}
}
public aspect RangeCheckAspectV2 {
pointcut notPositiveSet(int val)
: set(* A.notPositive) && args(val);
pointcut notNegativeSet(int val)
: set(* A.notNegative) && args(val);
void around(int val) : notPositiveSet(val) {
if (val > 0)
proceed(0);
else
proceed(val);
}
void around(int val) : notNegativeSet(val) {
if (val < 0)
proceed(0);
else
proceed(val);
}
}
By compiling the base code along with RangeAspectV1, I get the expected
result, both with ajc and abc. However, a separated attempt to compile
the base code along with RangeCheckAspectV2 causes the exception
described above -- it compiles successfully in ajc, though.
The only conclusion I have arrived with this test is that there may be a
problem in the weaving of field-set advices, since that is the only
difference between the different versions of RangeCheckAspect.
I hope this helps!
Received on Fri Oct 14 20:39:42 2005
This archive was generated by hypermail 2.1.8 : Fri Oct 14 2005 - 21:20:08 BST