Closed albertogoffi closed 4 years ago
DId you infer this problem only by looking at the tutorial's instructions? Because I suspect I found a bug in them. At point 6. of the tutorial, the command to weave the aspects is:
java -cp aspectjtools-1.8.9.jar:aspectjweaver-1.8.9.jar:aspectjrt-1.8.9.jar:src org.aspectj.tools.ajc.Main -inpath aspects:test -outjar weaved_testsuite.jar -showWeaveInfo -source 1.8 -target 1.8
But using this, AspectJ outputs the following complaint:
/TestCaseAspect.java [warning] no match for this type name: org.junit.Test [Xlint:invalidAbsoluteTypeName]
Which is fixed by including junit in the classpath. Running:
java -cp aspectjtools-1.8.9.jar:aspectjweaver-1.8.9.jar:aspectjrt-1.8.9.jar:junit-4.12.jar:src org.aspectj.tools.ajc.Main -inpath aspects:test -outjar weaved_testsuite.jar -showWeaveInfo -source 1.8 -target 1.8
Gives no error, and point 7. of the tutorial gives the expected output.
If what I wrote is confirmed I can fix the tutorial and close this pull request.
If what I wrote is confirmed I can fix the tutorial and close this pull request.
Just checked. I confirm your analysis. Thank you. Tutorial issue has been fixed in commit ab0ca3c163f1819ec6e0bd21538205f5d7db447e.
The pointcut
execution(@org.junit.Test * *(..))
was supposed to target every method annotated withorg.junit.Test
. However, this was not the case. In particular, running the tutorial instructions showed that the pointcut wasn't matching any method.As temporary solution, we use a way more generic pointcut
execution(* *(..))
. We should find a more efficient pointcut though.