Hi. I'm having some difficulty using the -XaddSerialVersionUID feature for abstract classes - it doesn't seem to work.
First, what seems to work, then what doesn't.
public class B implements Serializable
{
public void foo() throws Exception {
FileOutputStream fos = new FileOutputStream("foo");
fos.write(1);
fos.write("foo".getBytes());
}
}
--------------------------------------------------
When I get the serialVersionUID, I get something like -66037966...
Now, I have a aspect like the following:
-----------------------------------------------
import org.aspectj.lang.*;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
aspect FileOutput
{
pointcut writeByte(byte[] b):
call(void (FileOutputStream||FileWriter).write(byte[])) && args(b);
void around(byte[] b): writeByte(b)
{
byte[] result = fileOutput(b, thisJoinPoint.getSignature());
proceed(result);
}
byte[] fileOutput(byte[] b, Signature sig)
{
return b;
}
}
--------------------------------------------------
When I weave with -XaddSerialVersionUID, then I get the same serialVersionUID -66037966...
So far, so good.
However, when I modify B.class to be abstract, then suddenly the "-XaddSerialVersionUID" doesn't give the same serialVerisonUID as the one before weaving.
B.class (abstract): 365003300....
B.class (abstract) with File.aj, with -XserialVersionUID: -66037966....
The funny thing is, the abstract class's weaved serialVersionUID is the same as weaved non-abstract class.
What's going on here? How can I fix this problem? I'm willing to fix aspectj sourcecode if needed if someone can point me where to change.
Thanks.