Community
Participate
Working Groups
AJDT seems to evaluate advices incorrectly. It shows too much advices in eclipse, but they are not advised in reality. This becomes a problem for us, because when our advice handles checked exceptions, we get error markers in eclipse. I have attached a small test case showing the problem.
Created attachment 203749 [details] Screenshot of Main output vs eclipse advices Here's a screenshot of the problem
Created attachment 203750 [details] Eclipse project Didn't find this attachment, so i upload it again, just in case
I understand the confusion, but this is the expected behavior. In your example project, notice how there is a '?' in the advice markers. This means that the application cannot be completely determined at compile time (ie- there is a runtime test). Look at your pointcut: pointcut getName(Friend this_) : execution(String getName(..)) && this(this_); It says that the runtime type of this_ must implement Friend and it must have a getName() method. Consider this class: class YesAFriend extends NotAFriend implements Friend { } For calls to getName() when the instance is of type YesAFriend, this advice will apply. And that is why there is a runtime test of NotAFriend.getName().