diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST3_2.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST3_2.java index 080fd86..fa06a4c 100644 --- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST3_2.java +++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST3_2.java @@ -10613,4 +10613,23 @@ assertEquals("wrong tag name", "@literal", element.getTagName()); checkSourceRange((TextElement) element.fragments().get(0), " stars**** ", source); } + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=361938 + public void test0722() throws JavaModelException { + String source = "public class X {\n" + + " X(){\n" + + " try {\n" + + " }\n" + + " finally {\n" + + " }\n" + + " }\n" + + "}\n"; + + ASTParser parser = ASTParser.newParser(AST.JLS3); + parser.setKind(ASTParser.K_COMPILATION_UNIT); + parser.setSource(source.toCharArray()); + CompilationUnit resultCompilationUnit = (CompilationUnit) parser.createAST(null); + Object o = resultCompilationUnit.types().get(0); + System.out.println(o.toString()); + assertEquals(o.toString(), source); + } } \ No newline at end of file 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 bd85911..bb4b322 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 @@ -352,7 +352,7 @@ */ 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;