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

(-)a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTTest.java (-1 / +11 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 5265-5270 public class ASTTest extends org.eclipse.jdt.core.tests.junit.extension.TestCase Link Here
5265
	 * @deprecated (Uses getLeadingComment() which is deprecated)
5265
	 * @deprecated (Uses getLeadingComment() which is deprecated)
5266
	 */
5266
	 */
5267
	public void testTryStatement() {
5267
	public void testTryStatement() {
5268
		if (this.ast.apiLevel() <= AST.JLS3) {
5269
			// node type introduced in 4.0 API
5270
			try {
5271
				final TryStatement x = this.ast.newTryStatement();
5272
				x.resources();
5273
				assertTrue("should not be reached if jls level <= JLS3", false);
5274
			} catch (UnsupportedOperationException e) {
5275
				// pass
5276
			}
5277
		}
5268
		long previousCount = this.ast.modificationCount();
5278
		long previousCount = this.ast.modificationCount();
5269
		final TryStatement x = this.ast.newTryStatement();
5279
		final TryStatement x = this.ast.newTryStatement();
5270
		assertTrue(this.ast.modificationCount() > previousCount);
5280
		assertTrue(this.ast.modificationCount() > previousCount);
(-)a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TryStatement.java (-2 / +2 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 352-358 public class TryStatement extends Statement { Link Here
352
	 */
352
	 */
353
	public List resources() {
353
	public List resources() {
354
		// more efficient than just calling unsupportedIn2_3() to check
354
		// more efficient than just calling unsupportedIn2_3() to check
355
		if (this.resources != null) {
355
		if (this.resources == null) {
356
			unsupportedIn2_3();
356
			unsupportedIn2_3();
357
		}
357
		}
358
		return this.resources;
358
		return this.resources;
(-)a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/NaiveASTFlattener.java (-3 / +3 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 1528-1536 public class NaiveASTFlattener extends ASTVisitor { Link Here
1528
	public boolean visit(TryStatement node) {
1528
	public boolean visit(TryStatement node) {
1529
		printIndent();
1529
		printIndent();
1530
		this.buffer.append("try ");//$NON-NLS-1$
1530
		this.buffer.append("try ");//$NON-NLS-1$
1531
		List resources = node.resources();
1532
		if (node.getAST().apiLevel() >= AST.JLS4) {
1531
		if (node.getAST().apiLevel() >= AST.JLS4) {
1533
			if (!node.resources().isEmpty()) {
1532
			List resources = node.resources();
1533
			if (!resources.isEmpty()) {
1534
				this.buffer.append('(');
1534
				this.buffer.append('(');
1535
				for (Iterator it = resources.iterator(); it.hasNext(); ) {
1535
				for (Iterator it = resources.iterator(); it.hasNext(); ) {
1536
					VariableDeclarationExpression variable = (VariableDeclarationExpression) it.next();
1536
					VariableDeclarationExpression variable = (VariableDeclarationExpression) it.next();

Return to bug 365582