Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSrikanth2012-01-20 00:16:26 +0000
committerSrikanth2012-01-20 00:16:26 +0000
commiteb40a119cd5ecacf8e90c38261ec37c99b5a07b7 (patch)
tree4c78be912d46283be5b8205384c98a83fb153bac
parent4fd98abe69a6425880abe243fa431e365710bef2 (diff)
downloadeclipse.jdt.core-eb40a119cd5ecacf8e90c38261ec37c99b5a07b7.tar.gz
eclipse.jdt.core-eb40a119cd5ecacf8e90c38261ec37c99b5a07b7.tar.xz
eclipse.jdt.core-eb40a119cd5ecacf8e90c38261ec37c99b5a07b7.zip
Fixed bug 365582: FUP of bug 361938: Other error code pattern
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTTest.java12
-rw-r--r--org.eclipse.jdt.core/buildnotes_jdt-core.html4
-rw-r--r--org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TryStatement.java4
-rw-r--r--org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/NaiveASTFlattener.java6
4 files changed, 19 insertions, 7 deletions
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTTest.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTTest.java
index 5bb573328a..8970e8f65b 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTTest.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2012 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
@@ -5265,6 +5265,16 @@ public class ASTTest extends org.eclipse.jdt.core.tests.junit.extension.TestCase
* @deprecated (Uses getLeadingComment() which is deprecated)
*/
public void testTryStatement() {
+ if (this.ast.apiLevel() <= AST.JLS3) {
+ // node type introduced in 4.0 API
+ try {
+ final TryStatement x = this.ast.newTryStatement();
+ x.resources();
+ assertTrue("should not be reached if jls level <= JLS3", false);
+ } catch (UnsupportedOperationException e) {
+ // pass
+ }
+ }
long previousCount = this.ast.modificationCount();
final TryStatement x = this.ast.newTryStatement();
assertTrue(this.ast.modificationCount() > previousCount);
diff --git a/org.eclipse.jdt.core/buildnotes_jdt-core.html b/org.eclipse.jdt.core/buildnotes_jdt-core.html
index d6a9403810..7338f1004c 100644
--- a/org.eclipse.jdt.core/buildnotes_jdt-core.html
+++ b/org.eclipse.jdt.core/buildnotes_jdt-core.html
@@ -51,7 +51,9 @@ Eclipse SDK 3.8.0 - %date% - 3.8.0 M5
<h2>What's new in this drop</h2>
<h3>Problem Reports Fixed</h3>
-<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=365662">365662</a>
+<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=365582">365582</a>
+FUP of bug 361938: Other error code pattern
+<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=365662">365662</a>
[compiler][null] warn on contradictory and redundant null annotations
<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=247564">247564</a>
[compiler][null] Detecting null field reference
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TryStatement.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TryStatement.java
index bb4b3220a1..79575e1b11 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TryStatement.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TryStatement.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2012 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
@@ -352,7 +352,7 @@ public class TryStatement extends Statement {
*/
public List resources() {
// more efficient than just calling unsupportedIn2_3() to check
- if (this.resources != null) {
+ if (this.resources == null) {
unsupportedIn2_3();
}
return this.resources;
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/NaiveASTFlattener.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/NaiveASTFlattener.java
index 9394af1005..b53e4187b2 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/NaiveASTFlattener.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/NaiveASTFlattener.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2012 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
@@ -1528,9 +1528,9 @@ public class NaiveASTFlattener extends ASTVisitor {
public boolean visit(TryStatement node) {
printIndent();
this.buffer.append("try ");//$NON-NLS-1$
- List resources = node.resources();
if (node.getAST().apiLevel() >= AST.JLS4) {
- if (!node.resources().isEmpty()) {
+ List resources = node.resources();
+ if (!resources.isEmpty()) {
this.buffer.append('(');
for (Iterator it = resources.iterator(); it.hasNext(); ) {
VariableDeclarationExpression variable = (VariableDeclarationExpression) it.next();

Back to the top