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
341
|
/* *******************************************************************
* Copyright (c) 2004 IBM Corporation
* All rights reserved.
* This program and the accompanying materials are made available
* under the terms of the Eclipse Public License v1.0
* which accompanies this distribution and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* ******************************************************************/
package org.aspectj.systemtest.ajc121;
import java.net.URL;
import org.aspectj.testing.XMLBasedAjcTestCase;
import junit.framework.Test;
public class Ajc121Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
public static Test suite() {
return XMLBasedAjcTestCase.loadSuite(Ajc121Tests.class);
}
protected URL getSpecFile() {
return getClassResource("ajc121.xml");
}
public void test001(){
runTest("false ambiguous binding error (introduced in 1.2rc2)");
}
public void test002(){
runTest("An if() pointcut inside a perthis() clauses an ABORT - null pointer exception in ajc");
}
public void test003(){
runTest("An if() pointcut inside a perthis() clauses an ABORT - null pointer exception in ajc");
}
public void test004(){
runTest("An if() pointcut inside a perthis() clauses an ABORT - null pointer exception in ajc");
}
public void test005(){
runTest("compiler aborts with 'conflicting dominates orders' with circular declare precedences");
}
public void test006(){
runTest("'can't bind type' message has $ for . in type name for declare soft");
}
public void test007(){
runTest("Hiding of Instance Methods by static methods");
}
public void test008(){
runTest("if(false) optimisation");
}
public void test009(){
runTest("if(true) optimisation");
}
public void test010(){
runTest("java.lang.NullPointerException in WeaverMessageHandler class");
}
public void test011(){
runTest("ClassCastException at BcelRenderer.java:169");
}
public void test012(){
runTest("Front-end bug, shouldn't allow patterns of the form foo.., should be foo..*");
}
public void test013() {
runTest("Nullpointer-Exception when defining a withincode() pointcut");
}
public void test014() {
runTest("NPE, Incorrect XLint:unmatchedSuperTypeInCall warning");
}
public void test015_invalidXlint() { // keywords: "laurie hendren"
runTest("invalid warning indicating no match when a match really occurs");
}
public void test016_ByteConversionInstructions() {
runTest("RuntimeException thrown: Could not find instruction: org.apache.bcel.generic.B2I");
String output = getLastRunResult().getStdErr();
assertTrue("Expected to find [b2] in this output but didn't:"+output, output.contains("[b2]"));
assertTrue("Expected to find [b127] in this output but didn't:"+output, output.contains("[b127]"));
assertTrue("Expected to find [b0] in this output but didn't:"+output, output.contains("[b0]"));
assertTrue("Expected to find [c65] in this output but didn't:"+output, output.contains("[c65]"));
assertTrue("Expected to find [c66] in this output but didn't:"+output, output.contains("[c66]"));
assertTrue("Expected to find [c67] in this output but didn't:"+output, output.contains("[c67]"));
assertTrue("Expected to find [s1] in this output but didn't:"+output, output.contains("[s1]"));
assertTrue("Expected to find [s32767] in this output but didn't:"+output, output.contains("[s32767]"));
assertTrue("Expected to find [b0] in this output but didn't:"+output, output.contains("[b0]"));
}
public void test017_PrivateMethodCallsInAroundAdvice() {
runTest("Cannot advise private method call in around advice");
System.err.println(getLastRunResult().getStdErr());
}
public void test018_PrivateFieldSetsInAroundAdvice() {
runTest("Cannot advise private field sets in around advice");
System.err.println(getLastRunResult().getStdErr());
}
public void test019_PrivateFieldGetsInAroundAdvice() {
runTest("Cannot advise private field gets in around advice");
System.err.println(getLastRunResult().getStdErr());
}
// test takes over 5 minutes to run, so not included in normal suite run
// public void test020_branchTargetOffsetTooLargeForShort() {
// runTest("Branch target offset too large for short");
// }
// public void test021_BcelFailureWithVeryLargeClasses() {
// runTest("Weaver fails in BCEL for large classes");
// }
//
// public void test022_BcelFailureWithVeryLargeClasses_Binary() {
// runTest("Weaver fails in BCEL for large classes (binary)");
// }
public void test023_proceedInAround1() {
runTest("proceed used as method name in around advice (1)");
}
public void test024_proceedInAround2() {
runTest("proceed used as method name in around advice (2)");
}
public void test025_proceedInAround3() {
runTest("proceed used as method name in around advice (3)");
}
public void test026_bindingThisAndTargetToTheSameFormal() {
runTest("ajc crashes when compiling the following program (binding this() and target())");
}
public void test027_itdsOnInnerClassesAsStatic() {
runTest("ITDs on inner classes should be static context");
}
public void test028_itdsAndInitializers() {
runTest("resolution of IT field inits");
}
public void test029_falseInvalidAbsoluteTypeName() {
runTest("Valid but inaccessible type names should not be flagged by XLint:invalidAbsoluteTypeName");
}
public void test030_privateITDinitialisersBeingMatched() {
runTest("intertype initialisers should match field set pointcuts");
}
public void test031_privateITDinitialisersBeingMatched_OxfordTest() {
runTest("intertype initialisers should match field set pointcuts (oxford testcase)");
//System.err.println(">"+getLastRunResult().getStdErr());
String exp = ":set field set(int C.n):set field set(int C.m):get field get(int C.n):set field set(int C.n)";
assertTrue("Expected output '"+exp+"' but got "+getLastRunResult().getStdErr(),
getLastRunResult().getStdErr().equals(exp));
}
public void test032_stringConcatForDEOW() {
runTest("Compile time declarations (warning and error) do not accept string concatenation (with +)");
}
public void test033_stringConcatForDEOWErrorCase() {
runTest("Compile time declarations (warning and error) do not accept string concatenation (with +) (2)");
}
public void test034_scopeForITDS_pr61768() {
runTest("scope for inter-type methods");
}
public void test035_innerAspectCallsPrivateMethod_pr71372() {
runTest("NoSuchMethodError calling private method from around advice in inner aspect");
String s = getLastRunResult().getStdErr();
assertTrue("Expected ':before:around' but got "+s,
s.equals(":before:around"));
}
public void test036_innerAspectCallsPrivateMethod_pr71372_2() {
runTest("NoSuchMethodError calling private method from around advice in inner aspect (2)");
String s = getLastRunResult().getStdErr();
assertTrue("Expected ':before:around' but got "+s,
s.equals(":before:around"));
}
public void test037_innerAspectCallsPrivateMethod_pr71372_3() {
runTest("NoSuchMethodError calling private method from around advice in inner aspect (3)");
String s = getLastRunResult().getStdErr();
assertTrue("Expected ':before:around' but got "+s,
s.equals(":before:around"));
}
public void test038_innerAspectCallsPrivateMethod_pr71372_4() {
runTest("NoSuchMethodError calling private method from around advice in inner aspect (4)");
String s = getLastRunResult().getStdErr();
assertTrue("Expected ':before:around' but got "+s,
s.equals(":before:around"));
}
public void test039_privilegedAspectAccessingPrivateMethods_pr67579() {
runTest("NPE on privileged aspect error");
}
public void test040_privilegedAspectAccessingPrivateMethods_pr67579_2() {
runTest("NPE on privileged aspect error (2)");
}
public void test041_ITDaccessingPrivateMethod_pr67578() {
runTest("Privileged Aspect Access Problem Across Packages");
}
public void test042_ITDaccessingPrivateMethod_pr67578_2() {
runTest("Privileged Aspect Access Problem Across Packages (2)");
}
public void test043_pr62642_ExceptionInInitializerError() {
runTest("proper handling of ExceptionInIntializer inside clinit in presence of after throwing advice");
String s = getLastRunResult().getStdErr();
assertTrue("Output should contain java.lang.ExceptionInInitializerError but is '"+s+"'",
s.contains("java.lang.ExceptionInInitializerError"));
// No getCause on 1.3 JVMs
// assertTrue("Output should contain 'CAUSE=org.aspectj.lang.NoAspectBoundException' but is '"+s+"'",
// s.indexOf("CAUSE=org.aspectj.lang.NoAspectBoundException")!=-1);
}
public void test044_ITDnameClashes() {
runTest("ITD name clashes with private members");
}
public void test045_ITDprotectedVisibility() {
runTest("Inconsistency in scoping of protected members in ITDs");
}
public void test045_wrongLineForExecutionJoinPoint() {
runTest("wrong line for method execution join point");
}
public void test046_interfaceITD_pr70794_1() {
runTest("The introduction on interface causes the interface implementation class error (1)");
}
public void test047_interfaceITD_pr70794_2() {
runTest("The introduction on interface causes the interface implementation class error (2)");
}
public void test048_interfaceITD_pr70794_3() {
runTest("The introduction on interface causes the interface implementation class error (3)");
}
public void test049_interfaceITD_pr70794_4() {
runTest("The introduction on interface causes the interface implementation class error (4)");
}
public void test050_typePatternMatchingWithArrays() {
runTest("declare warning warns at wrong points");
}
public void test052_bogusMessage1() {
runTest("Bogus error message: The abstract method ajc$pointcut$$tracingScope$a2 in type Tracing can only be defined by an abstract class (1)");
}
public void test053_bogusMessage2() {
runTest("Bogus error message: The abstract method ajc$pointcut$$tracingScope$a2 in type Tracing can only be defined by an abstract class (2)");
}
public void test054_cnfe() {
runTest("passing null to array arguments confuzes static join point signature. (1)");
}
public void test055_cnfe() {
runTest("passing null to array arguments confuzes static join point signature. (2)");
}
public void test056_arrayCloning() {
runTest("around advice throws java.lang.VerifyError at runtime");
}
public void test057_decSoftWithSuper() {
runTest("declare soft can cause programs with invalid exception behaviour to be generated");
}
public void test058_npeOnTJPerror() {
runTest("NPE on thisJoinPoint mistake");
}
public void test059_cflowOptimization_counters() {
runTest("Optimization of cflow - counters (1)");
}
public void test060_cflowOptimization_counters() {
runTest("Optimization of cflow - shared counters (2)");
}
public void test061_cflowOptimization_counters() {
runTest("Optimization of cflow - shared stacks (3)");
}
public void test062_cflowOptimization_counters() {
runTest("Optimization of cflow - counters (4)");
}
public void test063_cflowOptimization_countersWithAbstractPcuts() {
runTest("Optimization of cflow - counters with abstract pointcuts (5)");
}
public void test064() {
runTest("Anonymous classes unaware of introductions into abstract classes");
}
private int countLines(String s) {
int lines = 0;
int idx = 0;
while (s.indexOf("\n",idx)!=-1) {
lines++;
idx = s.indexOf("\n",idx)+1;
}
return lines;
}
public void test065() {
runTest("before,after not (cflow(within(Trace*))) prints nothing");
String s = getLastRunResult().getStdErr();
int lines = countLines(s);
assertTrue("The actual output does not match the expected output. Expected 102 lines but got "+
lines+" lines. Actual output =\n"+s,lines==102);
// IF YOU WANT TO SEE THE EXPECTED OUTPUT, LOOK IN THE TEST PROGRAM bugs/WhatsGoingOn.java
}
}
|