View | Details | Raw Unified | Return to bug 245563
Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/ast/ForeachStatement.java (-2 / +8 lines)
Lines 373-379 Link Here
373
		printIndent(indent, output).append("for ("); //$NON-NLS-1$
373
		printIndent(indent, output).append("for ("); //$NON-NLS-1$
374
		this.elementVariable.printAsExpression(0, output);
374
		this.elementVariable.printAsExpression(0, output);
375
		output.append(" : ");//$NON-NLS-1$
375
		output.append(" : ");//$NON-NLS-1$
376
		this.collection.print(0, output).append(") "); //$NON-NLS-1$
376
		if (this.collection != null) {
377
			this.collection.print(0, output).append(") "); //$NON-NLS-1$
378
		} else {
379
			output.append(')');
380
		}
377
		//block
381
		//block
378
		if (this.action == null) {
382
		if (this.action == null) {
379
			output.append(';');
383
			output.append(';');
Lines 525-531 Link Here
525
529
526
		if (visitor.visit(this, blockScope)) {
530
		if (visitor.visit(this, blockScope)) {
527
			this.elementVariable.traverse(visitor, this.scope);
531
			this.elementVariable.traverse(visitor, this.scope);
528
			this.collection.traverse(visitor, this.scope);
532
			if (this.collection != null) {
533
				this.collection.traverse(visitor, this.scope);
534
			}
529
			if (this.action != null) {
535
			if (this.action != null) {
530
				this.action.traverse(visitor, this.scope);
536
				this.action.traverse(visitor, this.scope);
531
			}
537
			}
(-)src/org/eclipse/jdt/core/tests/dom/ASTConverter15Test.java (-1 / +28 lines)
Lines 46-52 Link Here
46
	}
46
	}
47
47
48
	static {
48
	static {
49
//		TESTS_NUMBERS = new int[] { 322 };
49
//		TESTS_NUMBERS = new int[] { 323 };
50
//		TESTS_RANGE = new int[] { 308, -1 };
50
//		TESTS_RANGE = new int[] { 308, -1 };
51
//		TESTS_NAMES = new String[] {"test0204"};
51
//		TESTS_NAMES = new String[] {"test0204"};
52
	}
52
	}
Lines 10342-10345 Link Here
10342
		IMemberValuePairBinding pairBinding = memberValuePairBindings[0];
10342
		IMemberValuePairBinding pairBinding = memberValuePairBindings[0];
10343
		assertNull("Got a value", pairBinding.getValue());
10343
		assertNull("Got a value", pairBinding.getValue());
10344
	}
10344
	}
10345
	/*
10346
	 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=245563
10347
	 */
10348
	public void test0323() throws JavaModelException {
10349
		String contents =
10350
			"class X {\n" + 
10351
			"	{\n" + 
10352
			"		for(Object obj:\n" +
10353
			"			new Object[]{\n" +
10354
			"				new Object(){\n" + 
10355
			"					int field=method(\n" +
10356
			"					});\n" + 
10357
			"				}\n" +
10358
			"			});\n" + 
10359
			"	}\n" + 
10360
			"	int method(int...args){\n" +
10361
			"		return args.length;\n" +
10362
			"	}\n" + 
10363
			"}\n" + 
10364
			"";
10365
		this.workingCopy = getWorkingCopy(
10366
				"/Converter15/src/test0322/X.java",
10367
				contents,
10368
				true/*resolve*/
10369
			);
10370
		assertNotNull("No node", buildAST(contents, workingCopy, false, true, true));
10371
	}
10345
}
10372
}

Return to bug 245563