Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

ltw-tests.xml 17KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485
  1. <!-- Load-time weaving tests -->
  2. <ajc-test dir="ltw"
  3. title="Ensure 1st aspect is rewoven when weaving 2nd aspect"
  4. keywords="reweavable">
  5. <compile
  6. files="Main.java, Aspect1.aj"
  7. outjar="main1.jar"
  8. options="-showWeaveInfo"
  9. >
  10. <message kind="weave" text="method-execution(void Main.test1())' in Type 'Main' (Main.java:17) advised by before advice from 'Aspect1' (Aspect1.aj:16)"/>
  11. </compile>
  12. <compile
  13. classpath="main1.jar"
  14. files="Aspect2.aj"
  15. outjar="aspect2.jar"
  16. options="-showWeaveInfo"
  17. >
  18. </compile>
  19. <run class="Main" ltw="aop-ltwreweavable.xml">
  20. <stdout>
  21. <line text="Main.main"/>
  22. <line text="Main.test1"/>
  23. <line text="Main.test2"/>
  24. </stdout>
  25. <stderr>
  26. <line text="weaveinfo Join point 'method-execution(void Main.test1())' in Type 'Main' (Main.java:17) advised by before advice from 'Aspect1' (Aspect1.aj:16)"/>
  27. <line text="weaveinfo Join point 'method-execution(void Main.test2())' in Type 'Main' (Main.java:21) advised by before advice from 'Aspect2' (Aspect2.aj:16)"/>
  28. <line text="Aspect1.before_test1"/>
  29. <line text="Aspect2.before_test2"/>
  30. </stderr>
  31. </run>
  32. </ajc-test>
  33. <ajc-test dir="ltw"
  34. title="Ensure valid aop.xml file is generated"
  35. keywords="-outxml">
  36. <compile
  37. files="Main.java"
  38. outjar="main.jar"
  39. >
  40. </compile>
  41. <compile
  42. classpath="main.jar"
  43. files="Aspect1.aj, Aspect2.aj, pakkage/Aspect3.aj"
  44. outxmlfile="META-INF/aop.xml"
  45. >
  46. </compile>
  47. <run class="Main" ltw="">
  48. <stdout>
  49. <line text="Main.main"/>
  50. <line text="Main.test1"/>
  51. <line text="Main.test2"/>
  52. </stdout>
  53. <stderr>
  54. <line text="Aspect1.before_test1"/>
  55. <line text="Aspect2.before_test2"/>
  56. <line text="pakkage.Aspect3.before_test2"/>
  57. </stderr>
  58. </run>
  59. </ajc-test>
  60. <ajc-test dir="ltw"
  61. title="Ensure valid aop.xml is generated for -outjar"
  62. keywords="-outxml">
  63. <compile
  64. files="Main.java"
  65. outjar="main.jar"
  66. >
  67. </compile>
  68. <compile
  69. classpath="main.jar"
  70. files="Aspect1.aj, Aspect2.aj, pakkage/Aspect3.aj"
  71. outjar="aspects.jar"
  72. options="-outxml"
  73. >
  74. </compile>
  75. <run class="Main" ltw="">
  76. <stdout>
  77. <line text="Main.main"/>
  78. <line text="Main.test1"/>
  79. <line text="Main.test2"/>
  80. </stdout>
  81. <stderr>
  82. <line text="Aspect1.before_test1"/>
  83. <line text="Aspect2.before_test2"/>
  84. <line text="pakkage.Aspect3.before_test2"/>
  85. </stderr>
  86. </run>
  87. </ajc-test>
  88. <ajc-test dir="ltw"
  89. title="Ensure no weaving without visible aop.xml"
  90. keywords="reweavable">
  91. <compile
  92. files="TestMain.java, Main.java"
  93. >
  94. </compile>
  95. <run class="TestMain" ltw="">
  96. <stdout>
  97. <line text="Main.main"/>
  98. <line text="Main.test1"/>
  99. <line text="Main.test2"/>
  100. </stdout>
  101. <stderr>
  102. <line text="info AspectJ Weaver Version"/>
  103. <line text="info register classloader org.aspectj.weaver.loadtime.WeavingURLClassLoader"/>
  104. <line text="info no configuration found. Disabling weaver for class loader org.aspectj.weaver.loadtime.WeavingURLClassLoader"/>
  105. </stderr>
  106. </run>
  107. </ajc-test>
  108. <ajc-test dir="ltw"
  109. title="Define concrete sub-aspect using aop.xml"
  110. keywords="aop.xml">
  111. <compile
  112. files="Main.java"
  113. outjar="main.jar"
  114. >
  115. </compile>
  116. <compile
  117. classpath="main1.jar"
  118. files="AbstractSuperAspect.aj"
  119. outjar="aspect.jar"
  120. >
  121. </compile>
  122. <run class="Main" ltw="aop-defineaspect.xml">
  123. <stdout>
  124. <line text="Main.main"/>
  125. <line text="Main.test1"/>
  126. <line text="Main.test2"/>
  127. </stdout>
  128. <stderr>
  129. <line text="info AspectJ Weaver Version"/>
  130. <line text="info register classloader"/>
  131. <line text="info using"/>
  132. <line text="info generating class 'ConcreteAspect'"/>
  133. <line text="info weaving 'Main'"/>
  134. <line text="AbstractSuperAspect.before_test1"/>
  135. </stderr>
  136. </run>
  137. </ajc-test>
  138. <ajc-test dir="ltw"
  139. title="Use abstract aspect for ITD using aop.xml"
  140. keywords="abstract aspect, ITD">
  141. <compile
  142. files="TestITDMethod.java"
  143. >
  144. </compile>
  145. <compile
  146. files="AbstractAspect.aj"
  147. >
  148. <message kind="warning" text="this affected type is not exposed to the weaver: TestITDMethod"/>
  149. </compile>
  150. <run class="TestITDMethod" options="test" ltw="aop-abstractaspect.xml">
  151. <stdout>
  152. <line text="TestITDMethod.main"/>
  153. </stdout>
  154. <stderr>
  155. <line text="weaveinfo Type 'TestITDMethod' (TestITDMethod.java) has intertyped method from 'AbstractAspect' (AbstractAspect.aj:'void TestITDMethod.test()')"/>
  156. <line text="AbstractAspect_TestITDMethod.test"/>
  157. </stderr>
  158. </run>
  159. </ajc-test>
  160. <ajc-test dir="ltw"
  161. title="Ensure a subset of inherited aspects is used for weaving"
  162. keywords="aspects, include">
  163. <compile
  164. files="Main.java"
  165. outjar="main.jar"
  166. >
  167. </compile>
  168. <compile
  169. classpath="main.jar"
  170. files="Aspect1.aj, Aspect2.aj, pakkage/Aspect3.aj"
  171. outjar="aspects.jar"
  172. options="-outxml"
  173. >
  174. </compile>
  175. <run class="Main" ltw="aop-aspectsinclude.xml">
  176. <stdout>
  177. <line text="Main.main"/>
  178. <line text="Main.test1"/>
  179. <line text="Main.test2"/>
  180. </stdout>
  181. <stderr>
  182. <line text="pakkage.Aspect3.before_test2"/>
  183. </stderr>
  184. </run>
  185. </ajc-test>
  186. <ajc-test dir="ltw"
  187. title="Ensure weaver lint warning issued when an aspect is not used for weaving"
  188. keywords="aspects, include, lint">
  189. <compile
  190. files="Main.java"
  191. outjar="main.jar"
  192. >
  193. </compile>
  194. <compile
  195. classpath="main.jar"
  196. files="Aspect1.aj, Aspect2.aj, pakkage/Aspect3.aj"
  197. outjar="aspects.jar"
  198. options="-outxml"
  199. >
  200. </compile>
  201. <run class="Main" ltw="aop-aspectsincludewithlintwarning.xml">
  202. <stdout>
  203. <line text="Main.main"/>
  204. <line text="Main.test1"/>
  205. <line text="Main.test2"/>
  206. </stdout>
  207. <stderr>
  208. <line text="warning aspect Aspect1 exluded for class loader org.aspectj.weaver.loadtime.WeavingURLClassLoader [Xlint:aspectExcludedByConfiguration]"/>
  209. <line text="warning aspect Aspect2 exluded for class loader org.aspectj.weaver.loadtime.WeavingURLClassLoader [Xlint:aspectExcludedByConfiguration]"/>
  210. <line text="pakkage.Aspect3.before_test2"/>
  211. </stderr>
  212. </run>
  213. </ajc-test>
  214. <ajc-test dir="ltw"
  215. title="Empty Xlint.properties file"
  216. keywords="xlint, ltw">
  217. <compile
  218. files="Main.java"
  219. >
  220. </compile>
  221. <run class="Main" ltw="aop-xlintfile.xml" xlintfile="Xlint-empty.properties">
  222. <stderr>
  223. </stderr>
  224. </run>
  225. </ajc-test>
  226. <ajc-test dir="ltw"
  227. title="Warning with missing Xlint.properties file"
  228. keywords="xlint, ltw">
  229. <compile
  230. files="Main.java"
  231. >
  232. </compile>
  233. <run class="Main" ltw="aop-xlintfile.xml">
  234. <stderr>
  235. <line text="warning Cannot access resource for -Xlintfile:Xlint-empty.properties"/>
  236. </stderr>
  237. </run>
  238. </ajc-test>
  239. <ajc-test dir="ltw"
  240. title="Warning when advice doesn't match suppressed for LTW"
  241. keywords="xlint, ltw">
  242. <compile
  243. files="Main.java"
  244. >
  245. </compile>
  246. <compile
  247. files="Aspect3.aj"
  248. >
  249. </compile>
  250. <run class="Main" ltw="aop-nomatch.xml">
  251. <stderr>
  252. <line text="info AspectJ Weaver Version"/>
  253. <line text="info register classloader"/>
  254. <line text="info using"/>
  255. <line text="info register aspect Aspect3"/>
  256. <line text="info weaving 'Main'"/>
  257. </stderr>
  258. </run>
  259. </ajc-test>
  260. <ajc-test dir="ltw"
  261. title="Override suppressing of warning when advice doesn't match using -Xlintfile"
  262. keywords="xlint, ltw">
  263. <compile
  264. files="Main.java"
  265. >
  266. </compile>
  267. <compile
  268. files="Aspect3.aj"
  269. >
  270. </compile>
  271. <run class="Main" ltw="aop-nomatchxlintfile.xml" xlintfile="Xlint-nomatch.properties">
  272. <stderr>
  273. <line text="info AspectJ Weaver Version"/>
  274. <line text="info register classloader"/>
  275. <line text="info using"/>
  276. <line text="info register aspect Aspect3"/>
  277. <line text="info weaving 'Main'"/>
  278. <!-- will never come out for LTW, due to pipelining change pr146781 -->
  279. <!--line text="advice defined in Aspect3 has not been applied [Xlint:adviceDidNotMatch]"/-->
  280. </stderr>
  281. </run>
  282. </ajc-test>
  283. <ajc-test dir="ltw"
  284. title="Warning when advice doesn't match using -Xlint:default"
  285. keywords="xlint, ltw">
  286. <compile
  287. files="Main.java"
  288. >
  289. </compile>
  290. <compile
  291. files="Aspect3.aj"
  292. >
  293. </compile>
  294. <run class="Main" ltw="aop-nomatchxlint.xml">
  295. <stderr>
  296. <line text="info AspectJ Weaver Version"/>
  297. <line text="info register classloader"/>
  298. <line text="info using"/>
  299. <line text="info register aspect Aspect3"/>
  300. <line text="info weaving 'Main'"/>
  301. <!-- will never come out for LTW, due to pipelining change pr146781 -->
  302. <!--line text="advice defined in Aspect3 has not been applied [Xlint:adviceDidNotMatch]"/-->
  303. </stderr>
  304. </run>
  305. </ajc-test>
  306. <ajc-test dir="ltw"
  307. title="Override suppressing of warning when advice doesn't match using -Xlint:warning"
  308. keywords="xlint, ltw">
  309. <compile
  310. files="Main.java"
  311. >
  312. </compile>
  313. <compile
  314. files="Aspect3.aj"
  315. >
  316. </compile>
  317. <run class="Main" ltw="aop-nomatchxlint.xml">
  318. <stderr>
  319. <line text="info AspectJ Weaver Version"/>
  320. <line text="info register classloader"/>
  321. <line text="info using"/>
  322. <line text="info register aspect Aspect3"/>
  323. <line text="info weaving 'Main'"/>
  324. <!-- will never come out for LTW, due to pipelining change pr146781 -->
  325. <!--line text="advice defined in Aspect3 has not been applied [Xlint:adviceDidNotMatch]"/-->
  326. </stderr>
  327. </run>
  328. </ajc-test>
  329. <!-- based on "Ensure 1st aspect is rewoven when weaving 2nd aspect" -->
  330. <ajc-test dir="ltw"
  331. title="Nonstandard jar file extensions" pr="137235">
  332. <compile
  333. files="folder.jar/Main.java, folder.jar/Aspect1.aj"
  334. outjar="folder.jar/main1.zip"
  335. options="-showWeaveInfo"
  336. >
  337. <message kind="weave" text="method-execution(void Main.test1())' in Type 'Main' (Main.java:17) advised by before advice from 'Aspect1' (Aspect1.aj:16)"/>
  338. </compile>
  339. <compile
  340. classpath="$sandbox/folder.jar/main1.zip"
  341. files="Aspect2.aj"
  342. outjar="aspect2Jar"
  343. options="-showWeaveInfo"
  344. >
  345. </compile>
  346. <run class="Main" ltw="aop-ltwreweavable.xml" classpath="$sandbox/folder.jar/main1.zip,$sandbox/aspect2Jar">
  347. <stdout>
  348. <line text="Main.main"/>
  349. <line text="Main.test1"/>
  350. <line text="Main.test2"/>
  351. </stdout>
  352. <stderr>
  353. <line text="weaveinfo Join point 'method-execution(void Main.test1())' in Type 'Main' (Main.java:17) advised by before advice from 'Aspect1' (Aspect1.aj:16)"/>
  354. <line text="weaveinfo Join point 'method-execution(void Main.test2())' in Type 'Main' (Main.java:21) advised by before advice from 'Aspect2' (Aspect2.aj:16)"/>
  355. <line text="Aspect1.before_test1"/>
  356. <line text="Aspect2.before_test2"/>
  357. </stderr>
  358. </run>
  359. </ajc-test>
  360. <ajc-test dir="ltw"
  361. title="Odd zip on classpath" pr="137235">
  362. <compile
  363. files="folder.jar/Main.java, folder.jar/Aspect1.aj"
  364. outjar="folder.jar/main1.archive"
  365. options="-showWeaveInfo"
  366. >
  367. <message kind="weave" text="method-execution(void Main.test1())' in Type 'Main' (Main.java:17) advised by before advice from 'Aspect1' (Aspect1.aj:16)"/>
  368. </compile>
  369. <compile
  370. classpath="$sandbox/folder.jar/main1.archive"
  371. files="Aspect2.aj"
  372. outjar="aspect2Jar"
  373. options="-showWeaveInfo"
  374. >
  375. </compile>
  376. <run class="Main" ltw="aop-ltwreweavable.xml" classpath="$sandbox/folder.jar/main1.archive,$sandbox/aspect2Jar">
  377. <stdout>
  378. <line text="Main.main"/>
  379. <line text="Main.test1"/>
  380. <line text="Main.test2"/>
  381. </stdout>
  382. <stderr>
  383. <line text="weaveinfo Join point 'method-execution(void Main.test1())' in Type 'Main' (Main.java:17) advised by before advice from 'Aspect1' (Aspect1.aj:16)"/>
  384. <line text="weaveinfo Join point 'method-execution(void Main.test2())' in Type 'Main' (Main.java:21) advised by before advice from 'Aspect2' (Aspect2.aj:16)"/>
  385. <line text="Aspect1.before_test1"/>
  386. <line text="Aspect2.before_test2"/>
  387. </stderr>
  388. </run>
  389. </ajc-test>
  390. <!--
  391. commented out: reported in another bugzilla bug...
  392. <ajc-test dir="ltw/hier"
  393. title="Separate compilation with ltw: declare parents and call"
  394. keywords="ltw">
  395. <compile
  396. files="util/A.aj,util/T.aj"
  397. />
  398. <compile
  399. files="child/Executor.aj,child/Advisor.aj,top/SimpleMain.aj"
  400. >
  401. <message kind="warning" text="this affected type is not exposed to the weaver: util.A"/>
  402. </compile>
  403. <run class="top.SimpleMain" ltw="aop-single.xml">
  404. <stdout>
  405. <line text="T call"/>
  406. </stdout>
  407. <stderr>
  408. <line text="weaveinfo Extending interface set for type 'util.A' (A.aj) to include 'util.T' (Advisor.aj)"/>
  409. < - - TODO: fix up any errors in the expected output when the join point actually matches - - >
  410. <line text="weaveinfo Join point 'method-call(void A.foo())' in Type 'child.Executor' (Executor.aj:19) advised by before advice from 'child.Advisor' (Advisor.aj:20)"/>
  411. </stderr>
  412. </run>
  413. </ajc-test>
  414. <ajc-test dir="ltw/hier"
  415. title="Child loader aspect won't weave parent loader: declare parents and call"
  416. keywords="ltw">
  417. <compile
  418. files="top/HierMain.aj"
  419. />
  420. <compile
  421. files="util/A.aj,util/T.aj"
  422. outjar="util.jar"
  423. />
  424. <compile
  425. files="child/Executor.aj,child/Advisor.aj"
  426. classpath="util.jar"
  427. options="-outxml"
  428. outjar="child.zip"
  429. >
  430. <message kind="warning" text="this affected type is not exposed to the weaver: util.A"/>
  431. </compile>
  432. < - - limitation: to turn on load-time weaving we HAVE to have a top-level aop.xml file
  433. since we don't want any top-level aspects, we deploy an empty one!
  434. the important aop.xml file in this test was created with -outxml and lives in child.jar - - >
  435. <run class="top.HierMain" ltw="null-aop.xml">
  436. <stdout/>
  437. <stderr>
  438. <line text="info AspectJ Weaver Version"/>
  439. <line text="info register classloader"/>
  440. <line text="info using"/>
  441. <line text="info weaving 'top.HierMain'"/>
  442. <line text="info AspectJ Weaver Version"/>
  443. <line text="info register classloader"/>
  444. <line text="info using"/>
  445. <line text="info using file:"/>
  446. <line text="info register aspect child.Advisor"/>
  447. <line text="info weaving 'child.Executor'"/>
  448. <line text="info weaving 'util.A'"/>
  449. </stderr>
  450. </run>
  451. </ajc-test>
  452. -->
  453. <ajc-test dir="ltw" title="JDK14 LTW with XML" keywords="ltw">
  454. <compile files="HelloWorld.java" options="-outjar hello.jar"/>
  455. <compile files="ExceptionHandler.aj" options="-outxml -outjar handler.jar"/>
  456. <ant file="ant.xml" target="JDK14 LTW with XML" verbose="true"/>
  457. </ajc-test>
  458. <ajc-test dir="ltw" title="JDK14 LTW with ASPECTPATH" keywords="ltw">
  459. <compile files="HelloWorld.java" options="-outjar hello.jar"/>
  460. <compile files="ExceptionHandler.aj" options="-outjar handler.jar"/>
  461. <ant file="ant.xml" target="JDK14 LTW with ASPECTPATH" verbose="true"/>
  462. </ajc-test>