I want to do specific action when System.currentTimeMillis()
is called. I use AspectJ as below to do that.
public aspect CurrentTimeInMillisMethodCallChanger {
long around():
call(public static native long java.lang.System.currentTimeMillis()) {
//provide my own implementation
}
}
This program works fine when System.currentTimeMillis()
is called in any method of the application.
However, when System.currentTimeMillis()
is called from method inside a jar file then around is not executed. I used within(packageofJarFile.*)
, but it does not work.
I am using Eclipse.
Please let me know what I need to add to the above code to support call from (specific) jar file as well ?