Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: b4135bddffe998d1feadebb80070f596d353aaf0 (plain) (blame)
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
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
/*******************************************************************************
 * Copyright (c) 2000, 2009 IBM Corporation and others.
 * 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
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.jdt.core.tests.performance;

import java.io.PrintStream;
import java.text.NumberFormat;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import junit.framework.*;

import org.eclipse.jdt.core.*;
import org.eclipse.jdt.core.compiler.IProblem;
import org.eclipse.jdt.core.dom.*;
import org.eclipse.jdt.core.tests.model.AbstractJavaModelTests;

/**
 */
public class FullSourceWorkspaceASTTests extends FullSourceWorkspaceTests {

    // Tests counter
    private static int TESTS_COUNT = 0;
	private final static int ITERATIONS_COUNT = 10;
	int nodesCount = 0;

    // Log files
    private static PrintStream[] LOG_STREAMS = new PrintStream[DIM_NAMES.length];

	/**
	 * @param name
	 */
	public FullSourceWorkspaceASTTests(String name) {
		super(name);
	}

	static {
//		TESTS_PREFIX = "testDomAstCreationJLS2";
	}

	public static Test suite() {
        Test suite = buildSuite(testClass());
        TESTS_COUNT = suite.countTestCases();
        createPrintStream(testClass(), LOG_STREAMS, TESTS_COUNT, null);
        return suite;
    }

    private static Class testClass() {
        return FullSourceWorkspaceASTTests.class;
    }

    protected void setUp() throws Exception {
		AbstractJavaModelTests.waitUntilIndexesReady();
		super.setUp();
	}

	/* (non-Javadoc)
     * @see junit.framework.TestCase#tearDown()
     */
    protected void tearDown() throws Exception {

		// End of execution => one test less
        TESTS_COUNT--;

        // Log perf result
        if (LOG_DIR != null) {
            logPerfResult(LOG_STREAMS, TESTS_COUNT);
        }

		// Print statistics
        if (TESTS_COUNT == 0) {
			System.out.println("-------------------------------------");
			System.out.println("DOM/AST creation performance test statistics:");
			NumberFormat intFormat = NumberFormat.getIntegerInstance();
			System.out.println("  - "+intFormat.format(this.nodesCount)+" nodes have been parsed.");
			System.out.println("-------------------------------------\n");
        }

		// Call super at the end as it close print streams
        super.tearDown();
	}

	/**
	 * Comment Mapper visitor
	 */
	class CommentMapperASTVisitor extends ASTVisitor {
		CompilationUnit compilationUnit;
		int nodes = 0;
		int extendedStartPositions = 0;
		int extendedEndPositions = 0;

		public CommentMapperASTVisitor(CompilationUnit unit) {
			this.compilationUnit = unit;
		}
		protected boolean visitNode(ASTNode node) {
			// get node positions and extended positions
			int nodeStart = node.getStartPosition();
			int nodeEnd = node.getLength() - 1 - nodeStart;
			int extendedStart = this.compilationUnit.getExtendedStartPosition(node);
			int extendedEnd = this.compilationUnit.getExtendedLength(node) - 1 - extendedStart;
			// update counters
			if (extendedStart < nodeStart) this.extendedStartPositions++;
			if (extendedEnd > nodeEnd) this.extendedEndPositions++;
			this.nodes++;
			return true;
		}
		protected void endVisitNode(ASTNode node) {
			// do nothing
		}
		public boolean visit(AnonymousClassDeclaration node) {
			return visitNode(node);
		}
		public boolean visit(ArrayAccess node) {
			return visitNode(node);
		}
		public boolean visit(ArrayCreation node) {
			return visitNode(node);
		}
		public boolean visit(ArrayInitializer node) {
			return visitNode(node);
		}
		public boolean visit(ArrayType node) {
			visitNode(node);
			return false;
		}
		public boolean visit(AssertStatement node) {
			return visitNode(node);
		}
		public boolean visit(Assignment node) {
			return visitNode(node);
		}
		public boolean visit(Block node) {
			return visitNode(node);
		}
		public boolean visit(BooleanLiteral node) {
			return visitNode(node);
		}
		public boolean visit(BreakStatement node) {
			return visitNode(node);
		}
		public boolean visit(CastExpression node) {
			return visitNode(node);
		}
		public boolean visit(CatchClause node) {
			return visitNode(node);
		}
		public boolean visit(CharacterLiteral node) {
			return visitNode(node);
		}
		public boolean visit(ClassInstanceCreation node) {
			return visitNode(node);
		}
		public boolean visit(CompilationUnit node) {
			return visitNode(node);
		}
		public boolean visit(ConditionalExpression node) {
			return visitNode(node);
		}
		public boolean visit(ConstructorInvocation node) {
			return visitNode(node);
		}
		public boolean visit(ContinueStatement node) {
			return visitNode(node);
		}
		public boolean visit(DoStatement node) {
			return visitNode(node);
		}
		public boolean visit(EmptyStatement node) {
			return visitNode(node);
		}
		public boolean visit(ExpressionStatement node) {
			return visitNode(node);
		}
		public boolean visit(FieldAccess node) {
			return visitNode(node);
		}
		public boolean visit(FieldDeclaration node) {
			return visitNode(node);
		}
		public boolean visit(ForStatement node) {
			return visitNode(node);
		}
		public boolean visit(IfStatement node) {
			return visitNode(node);
		}
		public boolean visit(ImportDeclaration node) {
			return visitNode(node);
		}
		public boolean visit(InfixExpression node) {
			return visitNode(node);
		}
		public boolean visit(InstanceofExpression node) {
			return visitNode(node);
		}
		public boolean visit(Initializer node) {
			return visitNode(node);
		}
		public boolean visit(Javadoc node) {
			// do not visit Javadoc tags by default. Use constructor with
			// boolean to enable.
			if (super.visit(node)) { return visitNode(node); }
			return false;
		}
		public boolean visit(LabeledStatement node) {
			return visitNode(node);
		}
		public boolean visit(MethodDeclaration node) {
			return visitNode(node);
		}
		public boolean visit(MethodInvocation node) {
			return visitNode(node);
		}
		public boolean visit(NullLiteral node) {
			return visitNode(node);
		}
		public boolean visit(NumberLiteral node) {
			return visitNode(node);
		}
		public boolean visit(PackageDeclaration node) {
			return visitNode(node);
		}
		public boolean visit(ParenthesizedExpression node) {
			return visitNode(node);
		}
		public boolean visit(PostfixExpression node) {
			return visitNode(node);
		}
		public boolean visit(PrefixExpression node) {
			return visitNode(node);
		}
		public boolean visit(PrimitiveType node) {
			return visitNode(node);
		}
		public boolean visit(QualifiedName node) {
			return visitNode(node);
		}
		public boolean visit(ReturnStatement node) {
			return visitNode(node);
		}
		public boolean visit(SimpleName node) {
			return visitNode(node);
		}
		public boolean visit(SimpleType node) {
			return visitNode(node);
		}
		public boolean visit(StringLiteral node) {
			return visitNode(node);
		}
		public boolean visit(SuperConstructorInvocation node) {
			return visitNode(node);
		}
		public boolean visit(SuperFieldAccess node) {
			return visitNode(node);
		}
		public boolean visit(SuperMethodInvocation node) {
			return visitNode(node);
		}
		public boolean visit(SwitchCase node) {
			return visitNode(node);
		}
		public boolean visit(SwitchStatement node) {
			return visitNode(node);
		}
		public boolean visit(SynchronizedStatement node) {
			return visitNode(node);
		}
		public boolean visit(ThisExpression node) {
			return visitNode(node);
		}
		public boolean visit(ThrowStatement node) {
			return visitNode(node);
		}
		public boolean visit(TryStatement node) {
			return visitNode(node);
		}
		public boolean visit(TypeDeclaration node) {
			return visitNode(node);
		}
		public boolean visit(TypeDeclarationStatement node) {
			return visitNode(node);
		}
		public boolean visit(TypeLiteral node) {
			return visitNode(node);
		}
		public boolean visit(SingleVariableDeclaration node) {
			return visitNode(node);
		}
		public boolean visit(VariableDeclarationExpression node) {
			return visitNode(node);
		}
		public boolean visit(VariableDeclarationStatement node) {
			return visitNode(node);
		}
		public boolean visit(VariableDeclarationFragment node) {
			return visitNode(node);
		}
		public boolean visit(WhileStatement node) {
			return visitNode(node);
		}
		/* since 3.0 */
		public boolean visit(BlockComment node) {
			return visitNode(node);
		}
		public boolean visit(LineComment node) {
			return visitNode(node);
		}
		public boolean visit(MemberRef node) {
			return visitNode(node);
		}
		public boolean visit(MethodRef node) {
			return visitNode(node);
		}
		public boolean visit(MethodRefParameter node) {
			return visitNode(node);
		}
		public boolean visit(TagElement node) {
			return visitNode(node);
		}
		public boolean visit(TextElement node) {
			return visitNode(node);
		}
		public void endVisit(AnonymousClassDeclaration node) {
			endVisitNode(node);
		}
		public void endVisit(ArrayAccess node) {
			endVisitNode(node);
		}
		public void endVisit(ArrayCreation node) {
			endVisitNode(node);
		}
		public void endVisit(ArrayInitializer node) {
			endVisitNode(node);
		}
		public void endVisit(ArrayType node) {
			endVisitNode(node);
		}
		public void endVisit(AssertStatement node) {
			endVisitNode(node);
		}
		public void endVisit(Assignment node) {
			endVisitNode(node);
		}
		public void endVisit(Block node) {
			endVisitNode(node);
		}
		public void endVisit(BooleanLiteral node) {
			endVisitNode(node);
		}
		public void endVisit(BreakStatement node) {
			endVisitNode(node);
		}
		public void endVisit(CastExpression node) {
			endVisitNode(node);
		}
		public void endVisit(CatchClause node) {
			endVisitNode(node);
		}
		public void endVisit(CharacterLiteral node) {
			endVisitNode(node);
		}
		public void endVisit(ClassInstanceCreation node) {
			endVisitNode(node);
		}
		public void endVisit(CompilationUnit node) {
			endVisitNode(node);
		}
		public void endVisit(ConditionalExpression node) {
			endVisitNode(node);
		}
		public void endVisit(ConstructorInvocation node) {
			endVisitNode(node);
		}
		public void endVisit(ContinueStatement node) {
			endVisitNode(node);
		}
		public void endVisit(DoStatement node) {
			endVisitNode(node);
		}
		public void endVisit(EmptyStatement node) {
			endVisitNode(node);
		}
		public void endVisit(ExpressionStatement node) {
			endVisitNode(node);
		}
		public void endVisit(FieldAccess node) {
			endVisitNode(node);
		}
		public void endVisit(FieldDeclaration node) {
			endVisitNode(node);
		}
		public void endVisit(ForStatement node) {
			endVisitNode(node);
		}
		public void endVisit(IfStatement node) {
			endVisitNode(node);
		}
		public void endVisit(ImportDeclaration node) {
			endVisitNode(node);
		}
		public void endVisit(InfixExpression node) {
			endVisitNode(node);
		}
		public void endVisit(InstanceofExpression node) {
			endVisitNode(node);
		}
		public void endVisit(Initializer node) {
			endVisitNode(node);
		}
		public void endVisit(Javadoc node) {
			endVisitNode(node);
		}
		public void endVisit(LabeledStatement node) {
			endVisitNode(node);
		}
		public void endVisit(MethodDeclaration node) {
			endVisitNode(node);
		}
		public void endVisit(MethodInvocation node) {
			endVisitNode(node);
		}
		public void endVisit(NullLiteral node) {
			endVisitNode(node);
		}
		public void endVisit(NumberLiteral node) {
			endVisitNode(node);
		}
		public void endVisit(PackageDeclaration node) {
			endVisitNode(node);
		}
		public void endVisit(ParenthesizedExpression node) {
			endVisitNode(node);
		}
		public void endVisit(PostfixExpression node) {
			endVisitNode(node);
		}
		public void endVisit(PrefixExpression node) {
			endVisitNode(node);
		}
		public void endVisit(PrimitiveType node) {
			endVisitNode(node);
		}
		public void endVisit(QualifiedName node) {
			endVisitNode(node);
		}
		public void endVisit(ReturnStatement node) {
			endVisitNode(node);
		}
		public void endVisit(SimpleName node) {
			endVisitNode(node);
		}
		public void endVisit(SimpleType node) {
			endVisitNode(node);
		}
		public void endVisit(StringLiteral node) {
			endVisitNode(node);
		}
		public void endVisit(SuperConstructorInvocation node) {
			endVisitNode(node);
		}
		public void endVisit(SuperFieldAccess node) {
			endVisitNode(node);
		}
		public void endVisit(SuperMethodInvocation node) {
			endVisitNode(node);
		}
		public void endVisit(SwitchCase node) {
			endVisitNode(node);
		}
		public void endVisit(SwitchStatement node) {
			endVisitNode(node);
		}
		public void endVisit(SynchronizedStatement node) {
			endVisitNode(node);
		}
		public void endVisit(ThisExpression node) {
			endVisitNode(node);
		}
		public void endVisit(ThrowStatement node) {
			endVisitNode(node);
		}
		public void endVisit(TryStatement node) {
			endVisitNode(node);
		}
		public void endVisit(TypeDeclaration node) {
			endVisitNode(node);
		}
		public void endVisit(TypeDeclarationStatement node) {
			endVisitNode(node);
		}
		public void endVisit(TypeLiteral node) {
			endVisitNode(node);
		}
		public void endVisit(SingleVariableDeclaration node) {
			endVisitNode(node);
		}
		public void endVisit(VariableDeclarationExpression node) {
			endVisitNode(node);
		}
		public void endVisit(VariableDeclarationStatement node) {
			endVisitNode(node);
		}
		public void endVisit(VariableDeclarationFragment node) {
			endVisitNode(node);
		}
		public void endVisit(WhileStatement node) {
			endVisitNode(node);
		}
		/* since 3.0 */
		public void endVisit(BlockComment node) {
			endVisitNode(node);
		}
		public void endVisit(LineComment node) {
			endVisitNode(node);
		}
		public void endVisit(MemberRef node) {
			endVisitNode(node);
		}
		public void endVisit(MethodRef node) {
			endVisitNode(node);
		}
		public void endVisit(MethodRefParameter node) {
			endVisitNode(node);
		}
		public void endVisit(TagElement node) {
			endVisitNode(node);
		}
		public void endVisit(TextElement node) {
			endVisitNode(node);
		}
	}

	/**
	 * Create AST nodes tree for a given compilation unit at a JLS given level
	 *
	 * @deprecated
	 */
	private void createAST(ICompilationUnit unit, int astLevel) throws JavaModelException {

		// Warm up
		for (int i = 0; i < 2; i++) {
			ASTParser parser = ASTParser.newParser(astLevel);
			parser.setSource(unit);
			parser.setResolveBindings(false);
			parser.createAST(null);
		}

		// Measures
		int measures = MEASURES_COUNT * 2;
		int iterations = ITERATIONS_COUNT >> 1;
		for (int i = 0; i < measures; i++) {
			ASTNode result = null;
			runGc();
			startMeasuring();
			for (int j=0; j<iterations; j++) {
				ASTParser parser = ASTParser.newParser(astLevel);
				parser.setSource(unit);
				parser.setResolveBindings(false);
				result = parser.createAST(null);
			}
			stopMeasuring();
			assertEquals("Wrong type for node"+result, result.getNodeType(), ASTNode.COMPILATION_UNIT);
			CompilationUnit compilationUnit = (CompilationUnit) result;
			CommentMapperASTVisitor visitor = new CommentMapperASTVisitor(compilationUnit);
			compilationUnit.accept(visitor);
			this.nodesCount += visitor.nodes * iterations;
		}

		// Commit
		commitMeasurements();
		assertPerformance();
	}

	/**
	 * @deprecated To reduce deprecated warnings
	 */
	public void testPerfDomAstCreationJLS2() throws JavaModelException {
		tagAsSummary("DOM AST tree for one file using JLS2", false); // do NOT put in fingerprint

		ICompilationUnit unit = getCompilationUnit("org.eclipse.jdt.core", "org.eclipse.jdt.internal.compiler.parser", "Parser.java");
		Hashtable options = JavaCore.getOptions();
		options.put(JavaCore.COMPILER_PB_NON_NLS_STRING_LITERAL, JavaCore.IGNORE);
		JavaCore.setOptions(options);
		createAST(unit, AST.JLS2);
	}

	/**
	 * Performance DOM/AST creation on the entire workspace using JLS3.
	 */
	public void testPerfDomAstCreationJLS3() throws JavaModelException {
		tagAsSummary("DOM AST tree for one file using JLS3", false); // do NOT put in fingerprint

		ICompilationUnit unit = getCompilationUnit("org.eclipse.jdt.core", "org.eclipse.jdt.internal.compiler.parser", "Parser.java");
		createAST(unit, AST.JLS3);
	}

	/*
	 * Create AST nodes tree for all compilation units of all projects
	 */
	private int runAllProjectsAstCreation(int astLevel) throws JavaModelException {
		int unitsCount = 0;
		startMeasuring();
		if (DEBUG) System.out.println("Creating AST hierarchy for all units of projects:");
		for (int i = 0; i < ALL_PROJECTS.length; i++) {
			// Get project compilation units
			if (DEBUG) System.out.print("\t- "+ALL_PROJECTS[i].getElementName());
			List units = getProjectCompilationUnits(ALL_PROJECTS[i]);
			int size = units.size();
			if (size == 0) {
				if (DEBUG) System.out.println(": empty!");
				continue;
			}
			unitsCount += size;
			List unitsArrays = splitListInSmallArrays(units, 20);
			int n = unitsArrays.size();
			if (DEBUG)
				if (n==1)
					System.out.print(": "+size+" units to proceed ("+n+" step): ");
				else
					System.out.print(": "+size+" units to proceed ("+n+" steps): ");
			while (unitsArrays.size() > 0) {
				ICompilationUnit[] unitsArray = (ICompilationUnit[]) unitsArrays.remove(0);
				if (DEBUG) System.out.print('.');
				int length = unitsArray.length;
				CompilationUnit[] compilationUnits = new CompilationUnit[length];
				// Create AST tree
				for (int ptr=0; ptr<length; ptr++) {
					ICompilationUnit unit = unitsArray[ptr];
					unitsArray[ptr] = null; // release memory handle
					ASTParser parser = ASTParser.newParser(astLevel);
					parser.setSource(unit);
					parser.setResolveBindings(false);
					ASTNode result = parser.createAST(null);
					assertEquals("Wrong type for node"+result, result.getNodeType(), ASTNode.COMPILATION_UNIT);
					compilationUnits[ptr] = (CompilationUnit) result;
				}
			}
			if (DEBUG) System.out.println(" done!");
		}
		stopMeasuring();
		commitMeasurements();
		assertPerformance();
		return unitsCount;
	}

	/**
	 * @deprecated To reduce deprecated warnings
	 */
	public void testWkspDomAstCreationJLS2() throws JavaModelException {
		tagAsSummary("DOM AST tree for workspace files (JLS2)", false); // do NOT put in fingerprint
		runAllProjectsAstCreation(AST.JLS2);
	}

	/*
	 * Create AST nodes for all compilation unit of a given project
	 */
	private void runAstCreation(IJavaProject javaProject) throws JavaModelException {
		if (DEBUG) System.out.println("Creating AST for project" + javaProject.getElementName());
		ASTParser parser = ASTParser.newParser(AST.JLS3);
		parser.setResolveBindings(true);
		parser.setProject(javaProject);

		Map options= javaProject.getOptions(true);
		// turn all errors and warnings into ignore. The customizable set of compiler
		// options only contains additional Eclipse options. The standard JDK compiler
		// options can't be changed anyway.
		for (Iterator iter= options.keySet().iterator(); iter.hasNext();) {
			String key= (String)iter.next();
			String value= (String)options.get(key);
			if ("error".equals(value) || "warning".equals(value)) {  //$NON-NLS-1$//$NON-NLS-2$
				// System.out.println("Ignoring - " + key);
				options.put(key, "ignore"); //$NON-NLS-1$
			} else if ("enabled".equals(value)) {
				// System.out.println("	- disabling " + key);
				options.put(key, "disabled");
			}
		}
		options.put(JavaCore.COMPILER_TASK_TAGS, "");
		parser.setCompilerOptions(options);

		List units = getProjectCompilationUnits(javaProject);
		ICompilationUnit[] compilationUnits = new ICompilationUnit[units.size()];
		units.toArray(compilationUnits);

		if (PRINT) {
			System.out.println("	- options: "+options);
			System.out.println("	- "+compilationUnits.length+" units will be parsed in "+javaProject.getElementName()+" project");
		}

		// warm up
		parser.createASTs(compilationUnits, new String[0], new ASTRequestor() {
				public void acceptAST(ICompilationUnit source, CompilationUnit ast) {
					IProblem[] problems = ast.getProblems();
					int length = problems.length;
					if (length > 0) {
						StringBuffer buffer = new StringBuffer();
						for (int i=0; i<length; i++) {
							buffer.append(problems[i].getMessage());
							buffer.append('\n');
						}
						assertEquals("Unexpected problems: "+buffer.toString(), 0, length);
					}
				}
			},
			null);

		// Measures
		int measures = MEASURES_COUNT * 2;
		for (int i = 0; i < measures; i++) {
			runGc();
			startMeasuring();
			parser.createASTs(compilationUnits, new String[0], new ASTRequestor() {/* do nothing*/}, null);
			stopMeasuring();
		}
		commitMeasurements();
		assertPerformance();
	}

	/**
	 * Create AST nodes tree for all compilation units in JUnit project.
	 *
	 * @throws JavaModelException
	 */
	public void testDomAstCreationProjectJLS3() throws JavaModelException {
		tagAsSummary("DOM AST tree for project files (JLS3)", true); // put in fingerprint
		runAstCreation(getProject("org.eclipse.search"));
	}
}

Back to the top