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.

ajc1921.xml 18KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446
  1. <!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]>
  2. <!--
  3. JDK 21 (https://openjdk.org/projects/jdk/21/):
  4. Language features:
  5. JEP 430: String Templates (Preview)
  6. JEP 440: Record Patterns
  7. JEP 441: Pattern Matching for switch
  8. JEP 443: Unnamed Patterns and Variables (Preview)
  9. JEP 445: Unnamed Classes and Instance Main Methods (Preview)
  10. API or JVM only:
  11. JEP 431: Sequenced Collections
  12. JEP 439: Generational ZGC
  13. JEP 442: Foreign Function & Memory API (Third Preview)
  14. JEP 444: Virtual Threads
  15. JEP 446: Scoped Values (Preview)
  16. JEP 448: Vector API (Sixth Incubator)
  17. JEP 449: Deprecate the Windows 32-bit x86 Port for Removal
  18. JEP 451: Prepare to Disallow the Dynamic Loading of Agents
  19. JEP 452: Key Encapsulation Mechanism API
  20. JEP 453: Structured Concurrency (Preview)
  21. -->
  22. <suite>
  23. <!-- Java 21 final, Java 17, 18, 19, 20 preview -->
  24. <ajc-test dir="features1921/java21" vm="21" title="switch pattern matching preview 4 java">
  25. <compile files="SwitchPatternPreview4OK.java" options="-21" />
  26. <run class="SwitchPatternPreview4OK" vmargs="">
  27. <message/>
  28. <stdout>
  29. <line text="null" />
  30. <line text="int 123" />
  31. <line text="long 999" />
  32. <line text="double 12.340000" />
  33. <line text="String foo" />
  34. <line text="[123, foo, 999, 12.34]" />
  35. <line text="Non-circle" />
  36. <line text="Small circle" />
  37. <line text="Large circle" />
  38. <line text="Sealed sub-class A" />
  39. <line text="Sealed sub-class B" />
  40. <line text="Sealed sub-record C" />
  41. <line text="absolute value 1: -1" />
  42. <line text="other integer: 0" />
  43. <line text="positive integer: 42" />
  44. <line text="other integer: -99" />
  45. <line text="positive integer: 123" />
  46. <line text="value unavailable: null" />
  47. <line text="42" />
  48. </stdout>
  49. </run>
  50. </ajc-test>
  51. <!-- Java 21 final, Java 17, 18, 19, 20 preview -->
  52. <ajc-test dir="features1920/java20" vm="21" title="switch pattern matching preview 4 error">
  53. <compile files="SwitchPatternPreview4Error.java" options="-21">
  54. <message kind="error" file="SwitchPatternPreview4Error.java" text="This case label is dominated by one of the preceding case labels"/>
  55. </compile>
  56. </ajc-test>
  57. <!-- Java 21 final, Java 17, 18, 19, 20 preview -->
  58. <ajc-test dir="features1921/java21" vm="21" title="switch pattern matching preview 3 aspect">
  59. <compile files="SwitchPatternPreview3Aspect.aj" options="-21" />
  60. <run class="Application" vmargs="">
  61. <stdout>
  62. <line text="null" />
  63. <line text="int 123" />
  64. <line text="long 999" />
  65. <line text="double 12.340000" />
  66. <line text="String foo" />
  67. <line text="[123, foo, 999, 12.34]" />
  68. <line text="Non-circle" />
  69. <line text="Small circle" />
  70. <line text="Large circle" />
  71. <line text="Sealed sub-class A" />
  72. <line text="Sealed sub-class B" />
  73. <line text="Sealed sub-record C" />
  74. <line text="absolute value 1: -1" />
  75. <line text="other integer: 0" />
  76. <line text="positive integer: 42" />
  77. <line text="other integer: -99" />
  78. <line text="positive integer: 123" />
  79. <line text="value unavailable: null" />
  80. </stdout>
  81. </run>
  82. </ajc-test>
  83. <!-- Java 21 final, Java 17, 18, 19, 20 preview -->
  84. <ajc-test dir="features198/java17" vm="21" title="switch pattern matching error">
  85. <compile files="SwitchPatternError.java" options="-21">
  86. <message kind="error" file="SwitchPatternError.java" text="This case label is dominated by one of the preceding case labels"/>
  87. </compile>
  88. </ajc-test>
  89. <!-- Java 21 final, Java 17, 18, 19, 20 preview -->
  90. <ajc-test dir="features1919/java19" vm="21" title="switch pattern matching preview 3 error 1">
  91. <compile files="SwitchPatternPreview3Error1.java" options="-21">
  92. <!-- No more error message as of Java 21 -->
  93. <!--<message kind="error" file="SwitchPatternPreview3Error1.java" text="This case label is dominated by one of the preceding case labels"/>-->
  94. </compile>
  95. </ajc-test>
  96. <!-- Java 21 final, Java 17, 18, 19, 20 preview -->
  97. <ajc-test dir="features1919/java19" vm="21" title="switch pattern matching preview 3 error 2">
  98. <compile files="SwitchPatternPreview3Error2.java" options="-21">
  99. <message kind="error" file="SwitchPatternPreview3Error2.java" text="This case label is dominated by one of the preceding case labels"/>
  100. </compile>
  101. </ajc-test>
  102. <!-- Java 21 final, Java 19, 20 preview -->
  103. <ajc-test dir="features1919/java19" vm="21" title="record patterns">
  104. <compile files="RecordPatternsPreview1OK.java" options="-21"/>
  105. </ajc-test>
  106. <!-- Java 21 final, Java 19, 20 preview -->
  107. <ajc-test dir="features1919/java19" vm="21" title="record patterns error">
  108. <compile files="RecordPatternsPreview1Error.java" options="-21">
  109. <!-- https://github.com/eclipse-jdt/eclipse.jdt.core/issues/450 (fixed for preview 2 in Eclipse 2023-03, 4.27) -->
  110. <!--
  111. <message kind="error" file="RecordPatternsPreview1Error.java" text="Raw types are not allowed in record patterns"/>
  112. <message kind="error" file="RecordPatternsPreview1Error.java" text="Raw types are not allowed in record patterns"/>
  113. -->
  114. </compile>
  115. <run class="RecordPatternsPreview1Error" vmargs="">
  116. <stdout>
  117. <line text="I'm a box"/>
  118. <line text="I'm a box"/>
  119. </stdout>
  120. </run>
  121. </ajc-test>
  122. <!-- Java 21 final, Java 19, 20 preview -->
  123. <ajc-test dir="features1921/java21" vm="21" title="record patterns exhaustiveness 1">
  124. <compile files="RecordPatternsPreview1ExhaustivenessOK1.java" options="-21"/>
  125. <run class="RecordPatternsPreview1ExhaustivenessOK1" vmargs="">
  126. <stdout>
  127. <line text="y"/>
  128. <line text="a"/>
  129. </stdout>
  130. </run>
  131. </ajc-test>
  132. <!-- Java 21 final, Java 19, 20 preview -->
  133. <ajc-test dir="features1921/java21" vm="21" title="record patterns exhaustiveness aspect">
  134. <compile files="RecordPatternsPreview1ExhaustivenessAspect.aj" options="-21"/>
  135. <run class="RecordPatternsPreview1ExhaustivenessAspect" vmargs="">
  136. <stdout>
  137. <line text="y"/>
  138. <line text="a"/>
  139. <line text="Pair[x=C@000, y=D@000]"/>
  140. </stdout>
  141. </run>
  142. </ajc-test>
  143. <!-- Java 21 final, Java 19, 20 preview -->
  144. <ajc-test dir="features1919/java19" vm="21" title="record patterns aspect">
  145. <compile files="RecordPatternsPreview1Aspect.aj" options="-21"/>
  146. <run class="RecordPatternsPreview1Aspect" vmargs="">
  147. <stdout>
  148. <line text="9"/>
  149. <line text="14"/>
  150. <line text="Doing something with Point[x=2, y=7]"/>
  151. <line text="Upper-left color: RED"/>
  152. <line text="Upper-left color: RED"/>
  153. <line text="Upper-left x coordinate: 1"/>
  154. <line text="Doing something with Rectangle[upperLeft=ColoredPoint[p=Point[x=1, y=6], c=RED], lowerRight=ColoredPoint[p=Point[x=4, y=6], c=BLUE]]"/>
  155. </stdout>
  156. </run>
  157. </ajc-test>
  158. <!-- Java 21 final, Java 19, 20 preview -->
  159. <ajc-test dir="features1919/java19" vm="21" title="record patterns exhaustiveness error">
  160. <compile files="RecordPatternsPreview1ExhaustivenessError.java" options="-21">
  161. <message kind="error" file="RecordPatternsPreview1ExhaustivenessError.java" text="An enhanced switch statement should be exhaustive; a default label expected"/>
  162. </compile>
  163. </ajc-test>
  164. <!-- Java 21 final, Java 19, 20 preview -->
  165. <ajc-test dir="features1919/java19" vm="21" title="record patterns exhaustiveness 2">
  166. <compile files="RecordPatternsPreview1ExhaustivenessOK2.java" options="-21"/>
  167. <run class="RecordPatternsPreview1ExhaustivenessOK2" vmargs="">
  168. <stdout>
  169. <line text="Bob 12"/>
  170. </stdout>
  171. </run>
  172. </ajc-test>
  173. <!-- Java 21 preview -->
  174. <ajc-test dir="features1921/java21" vm="21" title="string patterns">
  175. <compile files="StringPatternsPreview1.java" options="--enable-preview -21"/>
  176. <run class="StringPatternsPreview1" vmargs="--enable-preview">
  177. <stdout ordered="yes">
  178. <line text="Bill Duck"/>
  179. <line text="10 + 20 = 30"/>
  180. <line text="You have a special New Year's sale discount waiting for you!"/>
  181. <line text="Access at 2011-11-11 11:11:11 from localhost/127.0.0.1"/>
  182. <line text="The file _dummy.dat does not exist"/>
  183. <line text="The time is 11:11:11 or roughly eleven after eleven"/>
  184. <line text="apples, oranges, peaches"/>
  185. <line text=""/>
  186. <line text="&lt;html&gt;"/>
  187. <line text=" &lt;head&gt;"/>
  188. <line text=" &lt;title&gt;My Web Page&lt;/title&gt;"/>
  189. <line text=" &lt;/head&gt;"/>
  190. <line text=" &lt;body&gt;"/>
  191. <line text=" &lt;p&gt;Hello, world&lt;/p&gt;"/>
  192. <line text=" &lt;/body&gt;"/>
  193. <line text="&lt;/html&gt;"/>
  194. <line text=""/>
  195. <line text="Description Width Height Area"/>
  196. <line text="Alfa 17.80 31.40 558.92"/>
  197. <line text="Bravo 9.60 12.40 119.04"/>
  198. <line text="Charlie 7.10 11.23 79.73"/>
  199. <line text=" Total 757.69"/>
  200. <line text=""/>
  201. <line text="My name is Joan"/>
  202. </stdout>
  203. </run>
  204. </ajc-test>
  205. <!-- Java 21 preview -->
  206. <ajc-test dir="features1921/java21" vm="21" title="string patterns aspect">
  207. <compile files="StringPatternsPreview1Aspect.aj" options="--enable-preview -21"/>
  208. <run class="StringPatternsPreview1Aspect" vmargs="--enable-preview">
  209. <stdout ordered="yes">
  210. <line text="execution(void StringPatternsPreview1Aspect.main(String[]))"/>
  211. <line text="Bill Duck"/>
  212. <line text="10 + 20 = 30"/>
  213. <line text="You have a special New Year's sale discount waiting for you!"/>
  214. <line text="Access at 2011-11-11 11:11:11 from localhost/127.0.0.1"/>
  215. <line text="The file _dummy.dat does not exist"/>
  216. <line text="The time is 11:11:11 or roughly eleven after eleven"/>
  217. <line text="apples, oranges, peaches"/>
  218. <line text=""/>
  219. <line text="&lt;html&gt;"/>
  220. <line text=" &lt;head&gt;"/>
  221. <line text=" &lt;title&gt;My Web Page&lt;/title&gt;"/>
  222. <line text=" &lt;/head&gt;"/>
  223. <line text=" &lt;body&gt;"/>
  224. <line text=" &lt;p&gt;Hello, world&lt;/p&gt;"/>
  225. <line text=" &lt;/body&gt;"/>
  226. <line text="&lt;/html&gt;"/>
  227. <line text=""/>
  228. <line text="Description Width Height Area"/>
  229. <line text="Alfa 17.80 31.40 558.92"/>
  230. <line text="Bravo 9.60 12.40 119.04"/>
  231. <line text="Charlie 7.10 11.23 79.73"/>
  232. <line text=" Total 757.69"/>
  233. <line text=""/>
  234. <line text="My name is Joan"/>
  235. </stdout>
  236. </run>
  237. </ajc-test>
  238. <!-- Java 21 preview -->
  239. <ajc-test dir="features1921/java21" vm="21" title="unnamed patterns">
  240. <compile files="UnnamedPatternsPreview1.java" options="--enable-preview -21"/>
  241. <run class="UnnamedPatternsPreview1" vmargs="--enable-preview">
  242. <stdout ordered="yes">
  243. <line text="2"/>
  244. <line text="side effect"/>
  245. <line text="0"/>
  246. <line text="1"/>
  247. <line text="java.awt.Point[x=1,y=2]"/>
  248. <line text="java.awt.Point[x=4,y=5]"/>
  249. <line text="java.awt.Point[x=1,y=0]"/>
  250. <line text="java.awt.Point[x=4,y=0]"/>
  251. <line text="Bad number: 123xy"/>
  252. <line text="Doing something within scoped context"/>
  253. <line text="Closing scoped context"/>
  254. <line text="{ONE=NODATA, TWO=NODATA, THREE=NODATA}"/>
  255. </stdout>
  256. </run>
  257. </ajc-test>
  258. <!-- Java 21 preview -->
  259. <ajc-test dir="features1921/java21" vm="21" title="unnamed patterns aspect">
  260. <compile files="UnnamedPatternsPreview1Aspect.aj" options="--enable-preview -21"/>
  261. <run class="UnnamedPatternsPreview1Aspect" vmargs="--enable-preview">
  262. <stdout ordered="yes">
  263. <line text="execution(void UnnamedPatternsPreview1Aspect.main(String[]))"/>
  264. <line text="2"/>
  265. <line text="side effect"/>
  266. <line text="0"/>
  267. <line text="1"/>
  268. <line text="java.awt.Point[x=1,y=2]"/>
  269. <line text="java.awt.Point[x=4,y=5]"/>
  270. <line text="java.awt.Point[x=1,y=0]"/>
  271. <line text="java.awt.Point[x=4,y=0]"/>
  272. <line text="Bad number: 123xy"/>
  273. <line text="Doing something within scoped context"/>
  274. <line text="Closing scoped context"/>
  275. <line text="{ONE=NODATA, TWO=NODATA, THREE=NODATA}"/>
  276. </stdout>
  277. </run>
  278. </ajc-test>
  279. <!-- Java 21 preview -->
  280. <ajc-test dir="new" vm="21" title="underscore can still be used in pointcut patterns on Java 21+ - 1">
  281. <compile files="NotCharInPointcut.java" options="--enable-preview -21">
  282. <message kind="warning" line="51" text="advice defined in A has not been applied [Xlint:adviceDidNotMatch]"/>
  283. <message kind="warning" line="52" text="advice defined in A has not been applied [Xlint:adviceDidNotMatch]"/>
  284. <message kind="warning" line="53" text="advice defined in A has not been applied [Xlint:adviceDidNotMatch]"/>
  285. </compile>
  286. <run class="NotCharInPointcut" vmargs="--enable-preview"/>
  287. </ajc-test>
  288. <!-- Java 21 preview -->
  289. <ajc-test dir="features1921/java21" vm="21" title="underscore can still be used in pointcut patterns on Java 21+ - 2">
  290. <compile files="UnderscoreInPointcutAspect.aj" options="--enable-preview -21"/>
  291. <run class="UnderscoreInPointcutAspect" vmargs="--enable-preview">
  292. <stdout>
  293. <line text="[starts with underscore] execution(int UnderTest._add(int, int)) -> 12, 4"/>
  294. <line text="[contains underscore] execution(int UnderTest._add(int, int)) -> 12, 4"/>
  295. <line text="16"/>
  296. <line text="[starts with underscore] execution(int UnderTest._subtract(int, int)) -> 12, 4"/>
  297. <line text="[contains underscore] execution(int UnderTest._subtract(int, int)) -> 12, 4"/>
  298. <line text="8"/>
  299. <line text="[ends with underscore] execution(int UnderTest.multiply_(int, int)) -> 12, 4"/>
  300. <line text="[contains underscore] execution(int UnderTest.multiply_(int, int)) -> 12, 4"/>
  301. <line text="48"/>
  302. <line text="[ends with underscore] execution(int UnderTest.divide_(int, int)) -> 12, 4"/>
  303. <line text="[contains underscore] execution(int UnderTest.divide_(int, int)) -> 12, 4"/>
  304. <line text="3"/>
  305. <line text="[contains underscore] execution(int UnderTest.power_of(int, int)) -> 3, 3"/>
  306. <line text="27"/>
  307. <line text="[no underscore] execution(int UnderTest.squareRoot(int)) -> 49"/>
  308. <line text="7"/>
  309. </stdout>
  310. </run>
  311. </ajc-test>
  312. <!-- Java 21 preview -->
  313. <ajc-test dir="features1921/java21" vm="21" title="named class with simple main method">
  314. <!-- Compiles without preview mode, but needs preview mode to run -->
  315. <compile files="NamedClassWithSimpleMainMethodPreview1.java" options="-21"/>
  316. <run class="NamedClassWithSimpleMainMethodPreview1" vmargs="--enable-preview">
  317. <stdout>
  318. <line text="Hello world!"/>
  319. </stdout>
  320. </run>
  321. </ajc-test>
  322. <!-- Java 21 preview -->
  323. <ajc-test dir="features1921/java21" vm="21" title="named aspect with simple main method">
  324. <!-- Compiles without preview mode, but needs preview mode to run -->
  325. <compile files="NamedAspectWithSimpleMainMethodPreview1.aj" options="-21"/>
  326. <run class="NamedAspectWithSimpleMainMethodPreview1" vmargs="--enable-preview">
  327. <stdout>
  328. <line text="Hello world!"/>
  329. </stdout>
  330. </run>
  331. </ajc-test>
  332. <!-- Java 21 preview -->
  333. <ajc-test dir="features1921/java21" vm="21" title="unnamed class with simple main method">
  334. <compile files="UnnamedClassWithSimpleMainMethodPreview1.java" options="--enable-preview -21"/>
  335. <run class="UnnamedClassWithSimpleMainMethodPreview1" vmargs="--enable-preview">
  336. <stdout>
  337. <line text="Hello world!"/>
  338. </stdout>
  339. </run>
  340. </ajc-test>
  341. <!-- https://github.com/eclipse-aspectj/aspectj/issues/279, AspectJ 1.9.21.1 -->
  342. <ajc-test dir="bugs1921/github_279" vm="8" title="same class woven concurrently in parallel-capable classloader">
  343. <compile files="Application.java Greeter.java GreeterImpl.java ParallelCapableClassLoader.java" options="-8"/>
  344. <compile files="HelloInterceptor.java" options="-8 -Xlint:ignore"/>
  345. <!-- Problem only reproduces in forked JVM with java agent, hence Ant build -->
  346. <ant file="ant.xml" target="same class woven concurrently in parallel-capable classloader" verbose="true"/>
  347. </ajc-test>
  348. <!--
  349. https://github.com/eclipse-aspectj/aspectj/issues/285, AspectJ 1.9.21.2
  350. See also org.aspectj.systemtest.ajc171.NewFeatures::testSharedCache. This is a quasi negative test missing back in
  351. 1.7.2 when the shared cache was introduced.
  352. -->
  353. <ajc-test dir="bugs1921/github_285" title="shared cache negative test">
  354. <compile files="Unwoven.java" options="-1.5"/>
  355. <run class="Unwoven" ltw="aop.xml" usefullltw="true"
  356. vmargs="-Daj.weaving.cache.enabled=true -Daj.weaving.cache.dir=./ -Daj.weaving.cache.impl=shared">
  357. <stdout>
  358. <line text="Hello world"/>
  359. </stdout>
  360. <!--
  361. Nothing should be printed on stderr, especially no fatal NPE with message
  362. 'Cannot read the array length because "b" is null' and subsequent ajcore.*.txt
  363. -->
  364. <stderr/>
  365. </run>
  366. </ajc-test>
  367. <!--
  368. https://github.com/eclipse-aspectj/aspectj/issues/288,
  369. https://github.com/eclipse-aspectj/aspectj/issues/141, AspectJ 1.9.21.2
  370. -->
  371. <ajc-test dir="bugs1921/github_288" title="memory leak for @AspectJ nested, non-inlined around-advice - AssertionError">
  372. <compile files="NestedAroundClosureMemoryLeakTest.java MemoryHog.java FirstAspect.aj SecondAspect.aj" options="-1.8 -XnoInline"/>
  373. <run class="NestedAroundClosureMemoryLeakTest" vmargs="-ea --add-opens java.base/java.lang=ALL-UNNAMED">
  374. <stdout>
  375. <line text="FirstAspect"/>
  376. <line text="SecondAspect"/>
  377. <line text="Executing task"/>
  378. <line text="Finished executing tasks"/>
  379. <line text="Finished executing GC"/>
  380. <line text="Test passed - all inheritable thread-locals are null after GC"/>
  381. </stdout>
  382. <!-- No AssertionError on stderr-->
  383. <stderr/>
  384. </run>
  385. </ajc-test>
  386. <!--
  387. https://github.com/eclipse-aspectj/aspectj/issues/288,
  388. https://github.com/eclipse-aspectj/aspectj/issues/141, AspectJ 1.9.21.2
  389. -->
  390. <ajc-test dir="bugs1921/github_288" title="memory leak for @AspectJ nested, non-inlined around-advice - OutOfMemoryError">
  391. <compile files="NestedAroundClosureMemoryLeakTest.java MemoryHog.java FirstAspect.aj SecondAspect.aj" options="-1.8 -XnoInline"/>
  392. <run class="NestedAroundClosureMemoryLeakTest" vmargs="-ea --add-opens java.base/java.lang=ALL-UNNAMED -Xmx512M" options="oom">
  393. <stdout>
  394. <line text="FirstAspect"/>
  395. <line text="SecondAspect"/>
  396. <line text="Executing task"/>
  397. <line text="FirstAspect"/>
  398. <line text="SecondAspect"/>
  399. <line text="Executing task"/>
  400. <line text="FirstAspect"/>
  401. <line text="SecondAspect"/>
  402. <line text="Executing task"/>
  403. <line text="FirstAspect"/>
  404. <line text="SecondAspect"/>
  405. <line text="Executing task"/>
  406. <line text="FirstAspect"/>
  407. <line text="SecondAspect"/>
  408. <line text="Executing task"/>
  409. <line text="Finished executing tasks"/>
  410. <line text="Finished executing GC"/>
  411. <line text="Test passed - no OutOfMemoryError due to inheritable thread-locals memory leak"/>
  412. </stdout>
  413. <!-- No fatal OutOfMemoryError on stderr -->
  414. <stderr/>
  415. </run>
  416. </ajc-test>
  417. </suite>