1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
|
<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]>
<!--
JDK 21 (https://openjdk.org/projects/jdk/21/):
Language features:
JEP 430: String Templates (Preview)
JEP 440: Record Patterns
JEP 441: Pattern Matching for switch
JEP 443: Unnamed Patterns and Variables (Preview)
JEP 445: Unnamed Classes and Instance Main Methods (Preview)
API or JVM only:
JEP 431: Sequenced Collections
JEP 439: Generational ZGC
JEP 442: Foreign Function & Memory API (Third Preview)
JEP 444: Virtual Threads
JEP 446: Scoped Values (Preview)
JEP 448: Vector API (Sixth Incubator)
JEP 449: Deprecate the Windows 32-bit x86 Port for Removal
JEP 451: Prepare to Disallow the Dynamic Loading of Agents
JEP 452: Key Encapsulation Mechanism API
JEP 453: Structured Concurrency (Preview)
-->
<suite>
<!-- Java 21 final, Java 17, 18, 19, 20 preview -->
<ajc-test dir="features1921/java21" vm="21" title="switch pattern matching preview 4 java">
<compile files="SwitchPatternPreview4OK.java" options="-21" />
<run class="SwitchPatternPreview4OK" vmargs="">
<message/>
<stdout>
<line text="null" />
<line text="int 123" />
<line text="long 999" />
<line text="double 12.340000" />
<line text="String foo" />
<line text="[123, foo, 999, 12.34]" />
<line text="Non-circle" />
<line text="Small circle" />
<line text="Large circle" />
<line text="Sealed sub-class A" />
<line text="Sealed sub-class B" />
<line text="Sealed sub-record C" />
<line text="absolute value 1: -1" />
<line text="other integer: 0" />
<line text="positive integer: 42" />
<line text="other integer: -99" />
<line text="positive integer: 123" />
<line text="value unavailable: null" />
<line text="42" />
</stdout>
</run>
</ajc-test>
<!-- Java 21 final, Java 17, 18, 19, 20 preview -->
<ajc-test dir="features1920/java20" vm="21" title="switch pattern matching preview 4 error">
<compile files="SwitchPatternPreview4Error.java" options="-21">
<!-- TODO: Add correct compiler error message, as soon as JDT Core supports it -->
<message kind="error" file="SwitchPatternPreview4Error.java" text="This case label is dominated by one of the preceding case labels"/>
</compile>
</ajc-test>
<!-- Java 21 final, Java 17, 18, 19, 20 preview -->
<ajc-test dir="features1921/java21" vm="21" title="switch pattern matching preview 3 aspect">
<compile files="SwitchPatternPreview3Aspect.aj" options="-21" />
<run class="Application" vmargs="">
<stdout>
<line text="null" />
<line text="int 123" />
<line text="long 999" />
<line text="double 12.340000" />
<line text="String foo" />
<line text="[123, foo, 999, 12.34]" />
<line text="Non-circle" />
<line text="Small circle" />
<line text="Large circle" />
<line text="Sealed sub-class A" />
<line text="Sealed sub-class B" />
<line text="Sealed sub-record C" />
<line text="absolute value 1: -1" />
<line text="other integer: 0" />
<line text="positive integer: 42" />
<line text="other integer: -99" />
<line text="positive integer: 123" />
<line text="value unavailable: null" />
</stdout>
</run>
</ajc-test>
<!-- Java 21 final, Java 17, 18, 19, 20 preview -->
<ajc-test dir="features198/java17" vm="21" title="switch pattern matching error">
<compile files="SwitchPatternError.java" options="-21">
<!-- TODO: Add correct compiler error message, as soon as JDT Core supports it -->
<message kind="error" file="SwitchPatternError.java" text="This case label is dominated by one of the preceding case labels"/>
</compile>
</ajc-test>
<!-- Java 21 final, Java 17, 18, 19, 20 preview -->
<ajc-test dir="features1919/java19" vm="21" title="switch pattern matching preview 3 error 1">
<compile files="SwitchPatternPreview3Error1.java" options="-21">
<!-- No more error message as of Java 21 -->
<!--<message kind="error" file="SwitchPatternPreview3Error1.java" text="This case label is dominated by one of the preceding case labels"/>-->
</compile>
</ajc-test>
<!-- Java 21 final, Java 17, 18, 19, 20 preview -->
<ajc-test dir="features1919/java19" vm="21" title="switch pattern matching preview 3 error 2">
<compile files="SwitchPatternPreview3Error2.java" options="-21">
<!-- TODO: Add correct compiler error message, as soon as JDT Core supports it -->
<message kind="error" file="SwitchPatternPreview3Error2.java" text="This case label is dominated by one of the preceding case labels"/>
</compile>
</ajc-test>
<!-- Java 21 final, Java 19, 20 preview -->
<ajc-test dir="features1919/java19" vm="21" title="record patterns">
<compile files="RecordPatternsPreview1OK.java" options="-21"/>
</ajc-test>
<!-- Java 21 final, Java 19, 20 preview -->
<ajc-test dir="features1919/java19" vm="21" title="record patterns error">
<compile files="RecordPatternsPreview1Error.java" options="-21">
<!-- https://github.com/eclipse-jdt/eclipse.jdt.core/issues/450 (fixed for preview 2 in Eclipse 2023-03, 4.27) -->
<!--
<message kind="error" file="RecordPatternsPreview1Error.java" text="Raw types are not allowed in record patterns"/>
<message kind="error" file="RecordPatternsPreview1Error.java" text="Raw types are not allowed in record patterns"/>
-->
</compile>
<run class="RecordPatternsPreview1Error" vmargs="">
<stdout>
<line text="I'm a box"/>
<line text="I'm a box"/>
</stdout>
</run>
</ajc-test>
<!-- Java 21 final, Java 19, 20 preview -->
<ajc-test dir="features1921/java21" vm="21" title="record patterns exhaustiveness 1">
<compile files="RecordPatternsPreview1ExhaustivenessOK1.java" options="-21"/>
<run class="RecordPatternsPreview1ExhaustivenessOK1" vmargs="">
<stdout>
<line text="y"/>
<line text="a"/>
</stdout>
</run>
</ajc-test>
<!-- Java 21 final, Java 19, 20 preview -->
<ajc-test dir="features1921/java21" vm="21" title="record patterns exhaustiveness aspect">
<compile files="RecordPatternsPreview1ExhaustivenessAspect.aj" options="-21"/>
<run class="RecordPatternsPreview1ExhaustivenessAspect" vmargs="">
<stdout>
<line text="y"/>
<line text="a"/>
<line text="Pair[x=C@000, y=D@000]"/>
</stdout>
</run>
</ajc-test>
<!-- Java 21 final, Java 19, 20 preview -->
<ajc-test dir="features1919/java19" vm="21" title="record patterns aspect">
<compile files="RecordPatternsPreview1Aspect.aj" options="-21"/>
<run class="RecordPatternsPreview1Aspect" vmargs="">
<stdout>
<line text="9"/>
<line text="14"/>
<line text="Doing something with Point[x=2, y=7]"/>
<line text="Upper-left color: RED"/>
<line text="Upper-left color: RED"/>
<line text="Upper-left x coordinate: 1"/>
<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]]"/>
</stdout>
</run>
</ajc-test>
<!-- Java 21 final, Java 19, 20 preview -->
<ajc-test dir="features1919/java19" vm="21" title="record patterns exhaustiveness error">
<compile files="RecordPatternsPreview1ExhaustivenessError.java" options="-21">
<message kind="error" file="RecordPatternsPreview1ExhaustivenessError.java" text="An enhanced switch statement should be exhaustive; a default label expected"/>
</compile>
</ajc-test>
<!-- Java 21 final, Java 19, 20 preview -->
<ajc-test dir="features1919/java19" vm="21" title="record patterns exhaustiveness 2">
<compile files="RecordPatternsPreview1ExhaustivenessOK2.java" options="-21"/>
<run class="RecordPatternsPreview1ExhaustivenessOK2" vmargs="">
<stdout>
<line text="Bob 12"/>
</stdout>
</run>
</ajc-test>
<!-- Java 21 preview -->
<ajc-test dir="features1921/java21" vm="21" title="string patterns">
<compile files="StringPatternsPreview1.java" options="--enable-preview -21"/>
<run class="StringPatternsPreview1" vmargs="--enable-preview">
<stdout ordered="yes">
<line text="Bill Duck"/>
<line text="10 + 20 = 30"/>
<line text="You have a special New Year's sale discount waiting for you!"/>
<line text="Access at 2011-11-11 11:11:11 from localhost/127.0.0.1"/>
<line text="The file _dummy.dat does not exist"/>
<line text="The time is 11:11:11 or roughly eleven after eleven"/>
<line text="apples, oranges, peaches"/>
<line text=""/>
<line text="<html>"/>
<line text=" <head>"/>
<line text=" <title>My Web Page</title>"/>
<line text=" </head>"/>
<line text=" <body>"/>
<line text=" <p>Hello, world</p>"/>
<line text=" </body>"/>
<line text="</html>"/>
<line text=""/>
<line text="Description Width Height Area"/>
<line text="Alfa 17.80 31.40 558.92"/>
<line text="Bravo 9.60 12.40 119.04"/>
<line text="Charlie 7.10 11.23 79.73"/>
<line text=" Total 757.69"/>
<line text=""/>
<line text="My name is Joan"/>
</stdout>
</run>
</ajc-test>
<!-- Java 21 preview -->
<ajc-test dir="features1921/java21" vm="21" title="string patterns aspect">
<compile files="StringPatternsPreview1Aspect.aj" options="--enable-preview -21"/>
<run class="StringPatternsPreview1Aspect" vmargs="--enable-preview">
<stdout ordered="yes">
<line text="execution(void StringPatternsPreview1Aspect.main(String[]))"/>
<line text="Bill Duck"/>
<line text="10 + 20 = 30"/>
<line text="You have a special New Year's sale discount waiting for you!"/>
<line text="Access at 2011-11-11 11:11:11 from localhost/127.0.0.1"/>
<line text="The file _dummy.dat does not exist"/>
<line text="The time is 11:11:11 or roughly eleven after eleven"/>
<line text="apples, oranges, peaches"/>
<line text=""/>
<line text="<html>"/>
<line text=" <head>"/>
<line text=" <title>My Web Page</title>"/>
<line text=" </head>"/>
<line text=" <body>"/>
<line text=" <p>Hello, world</p>"/>
<line text=" </body>"/>
<line text="</html>"/>
<line text=""/>
<line text="Description Width Height Area"/>
<line text="Alfa 17.80 31.40 558.92"/>
<line text="Bravo 9.60 12.40 119.04"/>
<line text="Charlie 7.10 11.23 79.73"/>
<line text=" Total 757.69"/>
<line text=""/>
<line text="My name is Joan"/>
</stdout>
</run>
</ajc-test>
<!-- Java 21 preview -->
<!-- TODO: Activate after https://github.com/eclipse-jdt/eclipse.jdt.core/issues/893 is done -->
<ajc-test dir="features1921/java21" vm="21" title="unnamed patterns">
<compile files="UnnamedPatternsPreview1.java" options="--enable-preview -21"/>
<run class="UnnamedPatternsPreview1" vmargs="--enable-preview">
<stdout ordered="yes">
<line text="0"/>
<line text="1"/>
<line text="java.awt.Point[x=1,y=2]"/>
<line text="java.awt.Point[x=4,y=5]"/>
<line text="java.awt.Point[x=1,y=0]"/>
<line text="java.awt.Point[x=4,y=0]"/>
<line text="Bad number: 123xy"/>
<line text="Doing something within scoped context"/>
<line text="Closing scoped context"/>
<line text="{ONE=NODATA, TWO=NODATA, THREE=NODATA}"/>
</stdout>
</run>
</ajc-test>
<!-- Java 21 preview -->
<!-- TODO: Activate after https://github.com/eclipse-jdt/eclipse.jdt.core/issues/893 is done -->
<ajc-test dir="features1921/java21" vm="21" title="unnamed patterns aspect">
<compile files="UnnamedPatternsPreview1Aspect.java" options="--enable-preview -21"/>
<run class="UnnamedPatternsPreview1Aspect" vmargs="--enable-preview">
<stdout ordered="yes">
<line text="execution(void UnnamedPatternsPreview1Aspect.main(String[]))"/>
<line text="0"/>
<line text="1"/>
<line text="java.awt.Point[x=1,y=2]"/>
<line text="java.awt.Point[x=4,y=5]"/>
<line text="java.awt.Point[x=1,y=0]"/>
<line text="java.awt.Point[x=4,y=0]"/>
<line text="Bad number: 123xy"/>
<line text="Doing something within scoped context"/>
<line text="Closing scoped context"/>
<line text="{ONE=NODATA, TWO=NODATA, THREE=NODATA}"/>
</stdout>
</run>
</ajc-test>
<!-- Java 21 preview -->
<ajc-test dir="features1921/java21" vm="21" title="named class with simple main method">
<!-- Compiles without preview mode, but needs preview mode to run -->
<compile files="NamedClassWithSimpleMainMethodPreview1.java" options="-21"/>
<run class="NamedClassWithSimpleMainMethodPreview1" vmargs="--enable-preview">
<stdout>
<line text="Hello world!"/>
</stdout>
</run>
</ajc-test>
<!-- Java 21 preview -->
<ajc-test dir="features1921/java21" vm="21" title="named aspect with simple main method">
<!-- Compiles without preview mode, but needs preview mode to run -->
<compile files="NamedAspectWithSimpleMainMethodPreview1.aj" options="-21"/>
<run class="NamedAspectWithSimpleMainMethodPreview1" vmargs="--enable-preview">
<stdout>
<line text="Hello world!"/>
</stdout>
</run>
</ajc-test>
<!-- Java 21 preview -->
<!-- TODO: Activate after https://github.com/eclipse-jdt/eclipse.jdt.core/issues/1106 is done -->
<ajc-test dir="features1921/java21" vm="21" title="unnamed class with simple main method">
<compile files="UnnamedClassWithSimpleMainMethodPreview1.java" options="--enable-preview -21"/>
<run class="UnnamedClassWithSimpleMainMethodPreview1" vmargs="--enable-preview">
<stdout>
<line text="Hello world!"/>
</stdout>
</run>
</ajc-test>
<!-- https://github.com/eclipse-aspectj/aspectj/issues/279, AspectJ 1.9.21.1 -->
<ajc-test dir="bugs1921/github_279" vm="8" title="same class woven concurrently in parallel-capable classloader">
<compile files="Application.java Greeter.java GreeterImpl.java ParallelCapableClassLoader.java" options="-8"/>
<compile files="HelloInterceptor.java" options="-8 -Xlint:ignore"/>
<!-- Problem only reproduces in forked JVM with java agent, hence Ant build -->
<ant file="ant.xml" target="same class woven concurrently in parallel-capable classloader" verbose="true"/>
</ajc-test>
</suite>
|