You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

synchronization.xml 31KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651
  1. <!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]>
  2. <!-- AspectJ v1.5.1 Tests -->
  3. <suite>
  4. <ajc-test dir="features152/synchronization" title="basic">
  5. <compile files="Basic.java" options="-1.5 -showWeaveInfo -Xjoinpoints:synchronization">
  6. </compile>
  7. <run class="Basic">
  8. <stderr>
  9. <line text="methodWithSyncBlock1"/>
  10. <line text="staticMethodWithSyncBlock1"/>
  11. <line text="methodWithSyncBlock2"/>
  12. <line text="staticMethodWithSyncBlock2"/>
  13. </stderr>
  14. </run>
  15. </ajc-test>
  16. <ajc-test dir="features152/synchronization" title="basic - within">
  17. <compile files="Basic2.java" options="-1.5 -Xjoinpoints:synchronization">
  18. </compile>
  19. <run class="Basic2">
  20. <stderr>
  21. <line text="methodWithSyncBlock1"/>
  22. <line text="Advice running at lock(Object)"/>
  23. <line text="Advice running at unlock(Object)"/>
  24. <line text="staticMethodWithSyncBlock1"/>
  25. <line text="Advice running at lock(Object)"/>
  26. <line text="Advice running at unlock(Object)"/>
  27. <line text="methodWithSyncBlock2"/>
  28. <line text="Advice running at lock(Object)"/>
  29. <line text="Advice running at unlock(Object)"/>
  30. <line text="staticMethodWithSyncBlock2"/>
  31. <line text="Advice running at lock(Object)"/>
  32. <line text="Advice running at unlock(Object)"/>
  33. </stderr>
  34. </run>
  35. </ajc-test>
  36. <ajc-test dir="features152/synchronization" title="basic - within plus args">
  37. <compile files="Basic3.java" options="-1.5 -Xjoinpoints:synchronization">
  38. </compile>
  39. <run class="Basic3">
  40. <stderr>
  41. <line text="methodWithSyncBlock1"/>
  42. <line text="Advice running at lock(Object) with this of type class Basic3 with value Basic3@"/>
  43. <line text="Advice running at unlock(Object) with this of type class Basic3 with value Basic3@"/>
  44. <line text="staticMethodWithSyncBlock1"/>
  45. <line text="Advice running at lock(Object) with this of type class Basic3 with value Basic3@"/>
  46. <line text="Advice running at unlock(Object) with this of type class Basic3 with value Basic3@"/>
  47. <line text="methodWithSyncBlock2"/>
  48. <line text="Advice running at lock(Object) with this of type class Basic3 with value Basic3@"/>
  49. <line text="Advice running at unlock(Object) with this of type class Basic3 with value Basic3@"/>
  50. <line text="staticMethodWithSyncBlock2"/>
  51. <line text="Advice running at lock(Object) with this of type class Basic3 with value Basic3@"/>
  52. <line text="Advice running at unlock(Object) with this of type class Basic3 with value Basic3@"/>
  53. </stderr>
  54. </run>
  55. </ajc-test>
  56. <ajc-test dir="features152/synchronization" title="basic - within plus this">
  57. <compile files="Basic4.java" options="-1.5 -Xjoinpoints:synchronization">
  58. </compile>
  59. <run class="Basic4">
  60. <stderr>
  61. <line text="methodWithSyncBlock1"/>
  62. <line text="Advice running at lock(Object) with args of type class Basic4 with value Basic4@"/>
  63. <line text="Advice running at unlock(Object) with args of type class Basic4 with value Basic4@"/>
  64. <line text="staticMethodWithSyncBlock1"/>
  65. <line text="Advice running at lock(Object) with args of type class java.lang.Class with value class Basic4"/>
  66. <line text="Advice running at unlock(Object) with args of type class java.lang.Class with value class Basic4"/>
  67. <line text="methodWithSyncBlock2"/>
  68. <line text="Advice running at lock(Object) with args of type class Basic4 with value Basic4@"/>
  69. <line text="Advice running at unlock(Object) with args of type class Basic4 with value Basic4@"/>
  70. <line text="staticMethodWithSyncBlock2"/>
  71. <line text="Advice running at lock(Object) with args of type class java.lang.Class with value class Basic4"/>
  72. <line text="Advice running at unlock(Object) with args of type class java.lang.Class with value class Basic4"/>
  73. </stderr>
  74. </run>
  75. </ajc-test>
  76. <ajc-test dir="features152/synchronization" title="basic - within plus target">
  77. <compile files="Basic5.java" options="-1.5 -Xjoinpoints:synchronization">
  78. </compile>
  79. <run class="Basic5">
  80. <stderr>
  81. <line text="Advice running at void Basic5.methodWithSyncBlock1() with target of type class Basic5 with value Basic5@"/>
  82. <line text="Advice running at void Basic5.methodWithSyncBlock1() with target of type class Basic5 with value Basic5@"/>
  83. <line text="methodWithSyncBlock1"/>
  84. <line text="Advice running at void Basic5.staticMethodWithSyncBlock1() with target of type class Basic5 with value Basic5@"/>
  85. <line text="Advice running at void Basic5.staticMethodWithSyncBlock1() with target of type class Basic5 with value Basic5@"/>
  86. <line text="staticMethodWithSyncBlock1"/>
  87. <line text="Advice running at void Basic5.methodWithSyncBlock2() with target of type class Basic5 with value Basic5@"/>
  88. <line text="Advice running at void Basic5.methodWithSyncBlock2() with target of type class Basic5 with value Basic5@"/>
  89. <line text="methodWithSyncBlock2"/>
  90. <line text="Advice running at void Basic5.staticMethodWithSyncBlock2() with target of type class Basic5 with value Basic5@"/>
  91. <line text="Advice running at void Basic5.staticMethodWithSyncBlock2() with target of type class Basic5 with value Basic5@"/>
  92. <line text="staticMethodWithSyncBlock2"/>
  93. </stderr>
  94. </run>
  95. </ajc-test>
  96. <ajc-test dir="features152/synchronization" title="a useful program">
  97. <compile files="Useful1.java" options="-1.5 -Xjoinpoints:synchronization">
  98. </compile>
  99. <run class="Useful1">
  100. <stderr>
  101. <line text="Average lock taking time over 2000"/>
  102. <line text="We did time something!"/>
  103. </stderr>
  104. </run>
  105. </ajc-test>
  106. <ajc-test dir="features152/synchronization" title="parsing - lock">
  107. <compile files="Parsing1.java" options="-1.5 -Xjoinpoints:synchronization">
  108. <message kind="warning" line="5" text="advice defined in Parsing1 has not been applied [Xlint:adviceDidNotMatch]"/>
  109. </compile>
  110. </ajc-test>
  111. <ajc-test dir="features152/synchronization" title="parsing - unlock">
  112. <compile files="Parsing2.java" options="-1.5 -Xjoinpoints:synchronization">
  113. <message kind="warning" line="5" text="advice defined in Parsing2 has not been applied [Xlint:adviceDidNotMatch]"/>
  114. </compile>
  115. </ajc-test>
  116. <ajc-test dir="features152/synchronization" title="parsing - error - lock">
  117. <compile files="Parsing1.java" options="-1.5">
  118. <message kind="warning" line="5" text="advice defined in Parsing1 has not been applied [Xlint:adviceDidNotMatch]"/>
  119. <!-- this next warning comes out twice because we unpack the attributes twice... -->
  120. <message kind="warning" line="5" text="lock() pointcut designator cannot be used without the option -Xjoinpoints:synchronization"/>
  121. </compile>
  122. </ajc-test>
  123. <ajc-test dir="features152/synchronization" title="parsing - error - unlock">
  124. <compile files="Parsing2.java" options="-1.5">
  125. <message kind="warning" line="5" text="advice defined in Parsing2 has not been applied [Xlint:adviceDidNotMatch]"/>
  126. <!-- this next warning comes out twice because we unpack the attributes twice... -->
  127. <message kind="warning" line="5" text="unlock() pointcut designator cannot be used without the option -Xjoinpoints:synchronization"/>
  128. </compile>
  129. </ajc-test>
  130. <ajc-test dir="features152/synchronization" title="parsing and matching - lock and static context">
  131. <compile files="ParsingAndMatching1.java" options="-1.5 -Xjoinpoints:synchronization"/>
  132. <run class="ParsingAndMatching1">
  133. <stderr>
  134. <line text="Advice running at ParsingAndMatching1.java:14"/>
  135. <line text="static method running"/>
  136. </stderr>
  137. </run>
  138. </ajc-test>
  139. <ajc-test dir="features152/synchronization" title="using lock with LTW - missing flag">
  140. <compile files="LockAspect1.java" options="-1.5">
  141. <message kind="warning" line="6" text="lock() pointcut designator cannot be used without the option -Xjoinpoints:synchronization"/>
  142. </compile>
  143. <compile files="BasicProgram1.java" options="-1.5"/>
  144. <run class="BasicProgram1" ltw="aop1.xml">
  145. <stderr>
  146. <!-- warning is something like 'warning at C:\temp\ajcSandbox\ajcTest61975.tmp\LockAspect1.java:6::0 lock() pointcut designator cannot be used without the option -Xjoinpoints:synchronization'/-->
  147. <line text="warning at "/>
  148. <line text="nonstatic method running"/>
  149. <line text="static method running"/>
  150. </stderr>
  151. </run>
  152. </ajc-test>
  153. <ajc-test dir="features152/synchronization/transformed" title="transform with LTW">
  154. <compile files="CaptureLock.aj" options="-1.5"/>
  155. <compile files="Program.java" options="-1.5"/>
  156. <run class="Program" ltw="aop1.xml">
  157. <stdout>
  158. <line text="Before a lock or unlock"/>
  159. <line text="hello from b()"/>
  160. <line text="Before a lock or unlock"/>
  161. <line text="Before a lock or unlock"/>
  162. <line text="bang in c()"/>
  163. <line text="Before a lock or unlock"/>
  164. <line text="Before a lock or unlock"/>
  165. <line text="hello from d()"/>
  166. <line text="Before a lock or unlock"/>
  167. <line text="hello from block in d()"/>
  168. <line text="Before a lock or unlock"/>
  169. <line text="Before a lock or unlock"/>
  170. </stdout>
  171. </run>
  172. </ajc-test>
  173. <ajc-test dir="features152/synchronization" title="using lock with LTW">
  174. <compile files="LockAspect1.java" options="-1.5 -Xjoinpoints:synchronization"/>
  175. <compile files="BasicProgram1.java" options="-1.5 -Xjoinpoints:synchronization"/>
  176. <run class="BasicProgram1" ltw="aop3.xml">
  177. <stderr>
  178. <line text="Join point 'lock(void java.lang.Object.&lt;lock&gt;(java.lang.Object))' in Type 'BasicProgram1' (BasicProgram1.java:11) advised by before advice from 'LockAspect1' (LockAspect1.java:6)"/>
  179. <line text="see also:"/>
  180. <line text="Join point 'lock(void java.lang.Object.&lt;lock&gt;(java.lang.Object))' in Type 'BasicProgram1' (BasicProgram1.java:17) advised by before advice from 'LockAspect1' (LockAspect1.java:6)"/>
  181. <line text="see also:"/>
  182. <line text="Lock advice running at BasicProgram1.java:17"/>
  183. <line text="nonstatic method running"/>
  184. <line text="Lock advice running at BasicProgram1.java:11"/>
  185. <line text="static method running"/>
  186. </stderr>
  187. </run>
  188. </ajc-test>
  189. <ajc-test dir="features152/synchronization" title="using unlock with LTW">
  190. <compile files="UnlockAspect1.java" options="-1.5 -Xjoinpoints:synchronization"/>
  191. <compile files="BasicProgram1.java" options="-1.5 -Xjoinpoints:synchronization"/>
  192. <run class="BasicProgram1" ltw="aop4.xml">
  193. <stderr>
  194. <line text="Join point 'unlock(void java.lang.Object.&lt;unlock&gt;(java.lang.Object))' in Type 'BasicProgram1' (BasicProgram1.java:11) advised by before advice from 'UnlockAspect1' (UnlockAspect1.java:6)"/>
  195. <line text="see also:"/>
  196. <line text="Join point 'unlock(void java.lang.Object.&lt;unlock&gt;(java.lang.Object))' in Type 'BasicProgram1' (BasicProgram1.java:17) advised by before advice from 'UnlockAspect1' (UnlockAspect1.java:6)"/>
  197. <line text="see also:"/>
  198. <line text="nonstatic method running"/>
  199. <line text="Unlock advice running at BasicProgram1.java:17"/>
  200. <line text="static method running"/>
  201. <line text="Unlock advice running at BasicProgram1.java:11"/>
  202. </stderr>
  203. </run>
  204. </ajc-test>
  205. <ajc-test dir="features152/synchronization" title="using unlock with LTW - missing flag">
  206. <compile files="UnlockAspect1.java" options="-1.5">
  207. <message kind="warning" line="6" text="unlock() pointcut designator cannot be used without the option -Xjoinpoints:synchronization"/>
  208. </compile>
  209. <compile files="BasicProgram1.java" options="-1.5"/>
  210. <run class="BasicProgram1" ltw="aop2.xml">
  211. <stderr>
  212. <line text="warning at "/>
  213. <line text="nonstatic method running"/>
  214. <line text="static method running"/>
  215. </stderr>
  216. </run>
  217. </ajc-test>
  218. <ajc-test dir="features152/synchronization" title="parsing and matching - unlock and static context">
  219. <compile files="ParsingAndMatching2.java" options="-1.5 -Xjoinpoints:synchronization"/>
  220. <run class="ParsingAndMatching2">
  221. <stderr>
  222. <line text="static method running"/>
  223. <line text="Advice running at ParsingAndMatching2.java:14"/>
  224. </stderr>
  225. </run>
  226. </ajc-test>
  227. <ajc-test dir="features152/synchronization" title="parsing and matching - lock and non-static context">
  228. <compile files="ParsingAndMatching3.java" options="-1.5 -Xjoinpoints:synchronization"/>
  229. <run class="ParsingAndMatching3">
  230. <stderr>
  231. <line text="Advice running at ParsingAndMatching3.java:15"/>
  232. <line text="non-static method running"/>
  233. </stderr>
  234. </run>
  235. </ajc-test>
  236. <ajc-test dir="features152/synchronization" title="parsing and matching - unlock and non-static context">
  237. <compile files="ParsingAndMatching4.java" options="-1.5 -Xjoinpoints:synchronization"/>
  238. <run class="ParsingAndMatching4">
  239. <stderr>
  240. <line text="non-static method running"/>
  241. <line text="Advice running at ParsingAndMatching4.java:15"/>
  242. </stderr>
  243. </run>
  244. </ajc-test>
  245. <ajc-test dir="features152/synchronization" title="a useful program - with lock">
  246. <compile files="Useful2.java" options="-1.5 -showWeaveInfo -Xjoinpoints:synchronization">
  247. <message kind="weave" text="Join point 'method-execution(void Useful2.main(java.lang.String[]))' in Type 'Useful2' (Useful2.java:33) advised by afterReturning advice from 'LockMonitor' (Useful2.java:25)"/>
  248. <message kind="weave" text="Join point 'lock(void java.lang.Object.&lt;lock&gt;(java.lang.Object))' in Type 'Useful2' (Useful2.java:42) advised by before advice from 'LockMonitor' (Useful2.java:9) [with runtime test]"/>
  249. <message kind="weave" text="Join point 'unlock(void java.lang.Object.&lt;unlock&gt;(java.lang.Object))' in Type 'Useful2' (Useful2.java:42) advised by after advice from 'LockMonitor' (Useful2.java:14) [with runtime test]"/>
  250. <!-- hope we aren't getting double messages out -->
  251. </compile>
  252. <run class="Useful2">
  253. <stderr>
  254. <line text="Average time spent with lock over"/>
  255. </stderr>
  256. </run>
  257. </ajc-test>
  258. <ajc-test dir="features152/synchronization" title="combining pcds - lock and this">
  259. <compile files="CombiningPCDs1.java" options="-1.5 -Xjoinpoints:synchronization"/>
  260. <run class="CombiningPCDs1">
  261. <stderr>
  262. <line text="static method running"/>
  263. <line text="advice running at CombiningPCDs1.java:17"/>
  264. <line text="non-static method running"/>
  265. </stderr>
  266. </run>
  267. </ajc-test>
  268. <ajc-test dir="features152/synchronization" title="combining pcds - unlock and this">
  269. <compile files="CombiningPCDs2.java" options="-1.5 -Xjoinpoints:synchronization"/>
  270. <run class="CombiningPCDs2">
  271. <stderr>
  272. <line text="static method running"/>
  273. <line text="non-static method running"/>
  274. <line text="advice running at CombiningPCDs2.java:17"/>
  275. </stderr>
  276. </run>
  277. </ajc-test>
  278. <ajc-test dir="features152/synchronization" title="thisjoinpoint - monitor entry">
  279. <compile files="ThisJoinPointLock.java" options="-1.5 -Xjoinpoints:synchronization"/>
  280. <run class="ThisJoinPointLock">
  281. <stderr>
  282. <line text="match.toString(): lock(lock(Object))"/>
  283. <line text="match.toShortString(): lock(lock(Object))"/>
  284. <line text="match.toLongString(): lock(lock(java.lang.Object))"/>
  285. </stderr>
  286. </run>
  287. </ajc-test>
  288. <ajc-test dir="features152/synchronization" title="thisjoinpoint - monitor exit">
  289. <compile files="ThisJoinPointUnlock.java" options="-1.5 -Xjoinpoints:synchronization"/>
  290. <run class="ThisJoinPointUnlock">
  291. <stderr>
  292. <line text="match.toString(): unlock(unlock(Object))"/>
  293. <line text="match.toShortString(): unlock(unlock(Object))"/>
  294. <line text="match.toLongString(): unlock(unlock(java.lang.Object))"/>
  295. </stderr>
  296. </run>
  297. </ajc-test>
  298. <ajc-test dir="features152/synchronization" title="prevent double unlock weaving messages and model contents">
  299. <compile files="ThisJoinPointUnlock.java" options="-1.5 -Xjoinpoints:synchronization -showWeaveInfo -emacssym">
  300. <message kind="weave" text="Join point 'lock(void java.lang.Object.&lt;lock&gt;(java.lang.Object))' in Type 'ThisJoinPointUnlock' (ThisJoinPointUnlock.java:38) advised by before advice from 'TJPAspect' (ThisJoinPointUnlock.java:4)"/>
  301. <message kind="weave" text="Join point 'method-call(void ThisJoinPointUnlock.staticMethod())' in Type 'ThisJoinPointUnlock' (ThisJoinPointUnlock.java:39) advised by before advice from 'TJPAspect' (ThisJoinPointUnlock.java:4)"/>
  302. <message kind="weave" text="Join point 'unlock(void java.lang.Object.&lt;unlock&gt;(java.lang.Object))' in Type 'ThisJoinPointUnlock' (ThisJoinPointUnlock.java:38) advised by before advice from 'TJPAspect' (ThisJoinPointUnlock.java:4)"/>
  303. </compile>
  304. </ajc-test>
  305. <ajc-test dir="features152/synchronization" title="before advice - lock">
  306. <compile files="BeforeLock.java" options="-1.5 -Xjoinpoints:synchronization"/>
  307. <run class="BeforeLock">
  308. <stderr>
  309. <line text="before() lock: advice running at BeforeLock.java:26"/>
  310. <line text="static method running"/>
  311. <line text="before(Foo) lock: advice running at BeforeLock.java:21"/>
  312. <line text="before() lock: advice running at BeforeLock.java:21"/>
  313. <line text="non-static method running"/>
  314. </stderr>
  315. </run>
  316. </ajc-test>
  317. <ajc-test dir="features152/synchronization" title="before advice - unlock">
  318. <compile files="BeforeUnlock.java" options="-1.5 -Xjoinpoints:synchronization"/>
  319. <run class="BeforeUnlock">
  320. <stderr>
  321. <line text="static method running"/>
  322. <line text="before() unlock: advice running at BeforeUnlock.java:26"/>
  323. <line text="non-static method running"/>
  324. <line text="before(Foo) unlock: advice running at BeforeUnlock.java:21"/>
  325. <line text="before() unlock: advice running at BeforeUnlock.java:21"/>
  326. </stderr>
  327. </run>
  328. </ajc-test>
  329. <ajc-test dir="features152/synchronization" title="after advice - lock">
  330. <compile files="AfterLock.java" options="-1.5 -Xjoinpoints:synchronization"/>
  331. <run class="AfterLock">
  332. <stderr>
  333. <line text="after() lock: advice running at AfterLock.java:26"/>
  334. <line text="static method running"/>
  335. <line text="after(Foo) lock: advice running at AfterLock.java:21"/>
  336. <line text="after() lock: advice running at AfterLock.java:21"/>
  337. <line text="non-static method running"/>
  338. </stderr>
  339. </run>
  340. </ajc-test>
  341. <ajc-test dir="features152/synchronization" title="after advice - unlock">
  342. <compile files="AfterUnlock.java" options="-1.5 -Xjoinpoints:synchronization"/>
  343. <run class="AfterUnlock">
  344. <stderr>
  345. <line text="static method running"/>
  346. <line text="after() unlock: advice running at AfterUnlock.java:26"/>
  347. <line text="non-static method running"/>
  348. <line text="after(Foo) unlock: advice running at AfterUnlock.java:21"/>
  349. <line text="after() unlock: advice running at AfterUnlock.java:21"/>
  350. </stderr>
  351. </run>
  352. </ajc-test>
  353. <ajc-test dir="features152/synchronization" title="around advice - lock">
  354. <compile files="AroundLock.java" options="-1.5 -Xjoinpoints:synchronization">
  355. <message kind="warning" line="11" text="Around advice is not supported on the lock and unlock join points (compiler limitation)"/>
  356. <message kind="warning" line="17" text="Around advice is not supported on the lock and unlock join points (compiler limitation)"/>
  357. <message kind="warning" line="31" text="Around advice is not supported on the lock and unlock join points (compiler limitation)"/>
  358. <message kind="warning" line="36" text="Around advice is not supported on the lock and unlock join points (compiler limitation)"/>
  359. <message kind="warning" line="11" text="advice defined in AroundLock has not been applied [Xlint:adviceDidNotMatch]"/>
  360. <message kind="warning" line="17" text="advice defined in AroundLock has not been applied [Xlint:adviceDidNotMatch]"/>
  361. </compile>
  362. <run class="AroundLock">
  363. <stderr>
  364. <!--line text="around() lock: advice running at AroundLock.java:26"/-->
  365. <line text="static method running"/>
  366. <!--line text="around(Foo) lock: advice running at AroundLock.java:21"/>
  367. <line text="around() lock: advice running at AroundLock.java:21"/-->
  368. <line text="non-static method running"/>
  369. </stderr>
  370. </run>
  371. </ajc-test>
  372. <ajc-test dir="features152/synchronization" title="around advice - unlock">
  373. <compile files="AroundUnlock.java" options="-1.5 -Xjoinpoints:synchronization">
  374. <message kind="warning" line="5" text="Around advice is not supported on the lock and unlock join points (compiler limitation)"/>
  375. <message kind="warning" line="10" text="Around advice is not supported on the lock and unlock join points (compiler limitation)"/>
  376. <message kind="warning" line="23" text="Around advice is not supported on the lock and unlock join points (compiler limitation)"/>
  377. <message kind="warning" line="28" text="Around advice is not supported on the lock and unlock join points (compiler limitation)"/>
  378. <message kind="warning" line="5" text="advice defined in AroundUnlock has not been applied [Xlint:adviceDidNotMatch]"/>
  379. <message kind="warning" line="10" text="advice defined in AroundUnlock has not been applied [Xlint:adviceDidNotMatch]"/>
  380. </compile>
  381. <run class="AroundUnlock">
  382. <stderr>
  383. <!--line text="around() unlock: advice running at AroundUnlock.java:26"/-->
  384. <line text="static method running"/>
  385. <!--line text="around(Foo) unlock: advice running at AroundUnlock.java:21"/-->
  386. <!--line text="around() unlock: advice running at AroundUnlock.java:21"/-->
  387. <line text="non-static method running"/>
  388. </stderr>
  389. </run>
  390. </ajc-test>
  391. <ajc-test dir="features152/synchronization/transformed" title="investigation">
  392. <compile files="Investigation.java">
  393. </compile>
  394. </ajc-test>
  395. <ajc-test dir="features152/synchronization/transformed" title="One">
  396. <compile files="One.java -Xjoinpoints:synchronization">
  397. </compile>
  398. <run class="One"/><!-- will check verification ... -->
  399. </ajc-test>
  400. <ajc-test dir="features152/synchronization/transformed" title="Two">
  401. <compile files="Two.java -Xjoinpoints:synchronization">
  402. <message kind="warning" line="14" text="advice matching the synchronized method shadow 'method-execution(void C.ma())' will be executed outside the lock rather than inside (compiler limitation) [Xlint"/>
  403. </compile>
  404. <run class="Two">
  405. <stderr>
  406. <line text="execution advice running"/>
  407. <line text="hello"/>
  408. </stderr>
  409. </run>
  410. </ajc-test>
  411. <ajc-test dir="features152/synchronization/transformed" title="Two - xlintoff">
  412. <compile files="Two.java -Xjoinpoints:synchronization -Xlint:ignore"/>
  413. <run class="Two">
  414. <stderr>
  415. <line text="execution advice running"/>
  416. <line text="hello"/>
  417. </stderr>
  418. </run>
  419. </ajc-test>
  420. <ajc-test dir="features152/synchronization/transformed" title="Three">
  421. <compile files="Three.java -Xjoinpoints:synchronization">
  422. <message kind="warning" line="20" text="advice matching the synchronized method shadow 'method-execution(void C.m3())' will be executed outside the lock rather than inside (compiler limitation) [Xlint"/>
  423. <message kind="warning" line="24" text="advice matching the synchronized method shadow 'method-execution(void C.m32())' will be executed outside the lock rather than inside (compiler limitation) [Xlint"/>
  424. </compile>
  425. <run class="Three">
  426. <stderr>
  427. <line text="hello"/>
  428. <line text="execution advice running"/>
  429. <line text="hello"/>
  430. <line text="execution advice running2"/>
  431. <line text="hello"/>
  432. <line text="execution advice running3"/>
  433. <line text="hello"/>
  434. <line text="execution advice running4"/>
  435. </stderr>
  436. </run>
  437. </ajc-test>
  438. <ajc-test dir="features152/synchronization/transformed" title="Four">
  439. <compile files="Four.java -Xjoinpoints:synchronization">
  440. <message kind="warning" line="16" text="advice matching the synchronized method shadow 'method-execution(void C.m())' will be executed outside the lock rather than inside (compiler limitation) [Xlint"/>
  441. <message kind="warning" line="20" text="advice matching the synchronized method shadow 'method-execution(void C.m2())' will be executed outside the lock rather than inside (compiler limitation) [Xlint"/>
  442. </compile>
  443. <run class="Four">
  444. <stderr>
  445. <line text="hello"/>
  446. <line text="execution advice running"/>
  447. <line text="hello"/>
  448. <line text="execution advice running2"/>
  449. </stderr>
  450. </run>
  451. </ajc-test>
  452. <ajc-test dir="features152/synchronization/transformed" title="Five - Java5">
  453. <compile files="Five.java -1.5 -Xjoinpoints:synchronization">
  454. </compile>
  455. <run class="Five">
  456. <stderr>
  457. <line text="test"/>
  458. <line text="hello"/>
  459. <line text="test"/>
  460. <line text="hello"/>
  461. <line text="test"/>
  462. <line text="hello"/>
  463. <line text="test"/>
  464. <line text="hello"/>
  465. </stderr>
  466. </run>
  467. </ajc-test>
  468. <ajc-test dir="features152/synchronization/transformed" title="Six - preJava5">
  469. <compile files="Six.java -Xjoinpoints:synchronization">
  470. </compile>
  471. <run class="Six">
  472. <stderr>
  473. <line text="test"/>
  474. <line text="hello"/>
  475. <line text="test"/>
  476. <line text="hello"/>
  477. </stderr>
  478. </run>
  479. </ajc-test>
  480. <ajc-test dir="features152/synchronization/transformed" title="lock pcd on transformed non-static method">
  481. <compile files="Seven.java -Xjoinpoints:synchronization">
  482. </compile>
  483. <run class="Seven">
  484. <stderr>
  485. <line text="Locking occurring at lock(lock(Object))"/>
  486. <line text="Seven.java"/>
  487. <line text="hello"/>
  488. </stderr>
  489. </run>
  490. </ajc-test>
  491. <ajc-test dir="features152/synchronization/transformed" title="unlock pcd on transformed non-static method">
  492. <compile files="Eight.java -Xjoinpoints:synchronization">
  493. </compile>
  494. <run class="Eight">
  495. <stderr>
  496. <line text="hello"/>
  497. <line text="Unlocking occurring at unlock(unlock(Object))"/>
  498. <line text="Eight.java"/>
  499. </stderr>
  500. </run>
  501. </ajc-test>
  502. <ajc-test dir="features152/synchronization/transformed" title="lock pcd on transformed static method - J5">
  503. <compile files="Nine.java -1.5 -Xjoinpoints:synchronization">
  504. </compile>
  505. <run class="Nine">
  506. <stderr>
  507. <line text="Locking occurring at lock(lock(Object))"/>
  508. <line text="Nine.java"/>
  509. <line text="hello"/>
  510. </stderr>
  511. </run>
  512. </ajc-test>
  513. <ajc-test dir="features152/synchronization/transformed" title="unlock pcd on transformed static method - J5">
  514. <compile files="Ten.java -1.5 -Xjoinpoints:synchronization">
  515. </compile>
  516. <run class="Ten">
  517. <stderr>
  518. <line text="hello"/>
  519. <line text="Unlocking occurring at unlock(unlock(Object))"/>
  520. <line text="Ten.java"/>
  521. </stderr>
  522. </run>
  523. </ajc-test>
  524. <ajc-test dir="features152/synchronization/transformed" title="lock pcd on transformed static method - preJ5">
  525. <compile files="Eleven.java -Xjoinpoints:synchronization">
  526. </compile>
  527. <run class="Eleven">
  528. <stderr>
  529. <line text="Locking occurring at lock(lock(Object))"/>
  530. <line text="Eleven.java"/>
  531. <line text="hello"/>
  532. </stderr>
  533. </run>
  534. </ajc-test>
  535. <ajc-test dir="features152/synchronization/transformed" title="unlock pcd on transformed static method - preJ5">
  536. <compile files="Twelve.java" options="-Xjoinpoints:synchronization">
  537. </compile>
  538. <run class="Twelve">
  539. <stderr>
  540. <line text="hello"/>
  541. <line text="Unlocking occurring at unlock(unlock(Object))"/>
  542. <line text="Twelve.java"/>
  543. </stderr>
  544. </run>
  545. </ajc-test>
  546. <ajc-test dir="features152/synchronization/transformed" title="transform static method - preJ5">
  547. <compile files="Fifteen.java" options="-Xjoinpoints:synchronization -1.4">
  548. </compile>
  549. <run class="Fifteen">
  550. <stderr>
  551. <line text="Locking occurring at lock(lock(Object))"/>
  552. <line text="Fifteen.java"/>
  553. <line text="hello"/>
  554. </stderr>
  555. </run>
  556. </ajc-test>
  557. <ajc-test dir="features152/synchronization/transformed" title="transform static method - packages - preJ5">
  558. <compile files="Sixteen.java" options="-Xjoinpoints:synchronization -1.4">
  559. </compile>
  560. <run class="a.b.c.d.Sixteen">
  561. <stderr>
  562. <line text="Locking occurring at lock(lock(Object))"/>
  563. <line text="Sixteen.java"/>
  564. <line text="hello"/>
  565. </stderr>
  566. </run>
  567. </ajc-test>
  568. <ajc-test dir="features152/synchronization" title="obtaining locked object through getArgs">
  569. <compile files="LockingWithTJP.java" options="-Xjoinpoints:synchronization">
  570. </compile>
  571. <run class="LockingWithTJP">
  572. <stderr>
  573. <line text="before() lock: advice running at LockingWithTJP.java:18"/>
  574. <line text="Locked on LockingWithTJP$Foo"/>
  575. <line text="non-static method running"/>
  576. <line text="before() lock: advice running at LockingWithTJP.java:23"/>
  577. <line text="Locked on class java.lang.String"/>
  578. <line text="static method running"/>
  579. </stderr>
  580. </run>
  581. </ajc-test>
  582. <ajc-test dir="features152/synchronization/transformed" title="other targeters">
  583. <compile files="OtherTargeters.java" options="-Xjoinpoints:synchronization">
  584. <message kind="warning" line="8" text="advice matching the synchronized "/>
  585. </compile>
  586. <run class="OtherTargeters">
  587. <stderr>
  588. <line text="advice running"/>
  589. <line text="foo() running"/>
  590. </stderr>
  591. </run>
  592. </ajc-test>
  593. <ajc-test dir="features152/synchronization/transformed" title="joinpoints enabled but no lock">
  594. <compile files="Fourteen.java" options="-Xjoinpoints:synchronization">
  595. <!--message kind="warning" line="8" text="advice matching the synchronized "/-->
  596. </compile>
  597. <run class="Fourteen"/>
  598. </ajc-test>
  599. </suite>