Index: ASTConverter15Test.java =================================================================== RCS file: /home/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter15Test.java,v retrieving revision 1.78 diff -u -r1.78 ASTConverter15Test.java --- ASTConverter15Test.java 14 Dec 2004 18:45:24 -0000 1.78 +++ ASTConverter15Test.java 15 Dec 2004 03:27:16 -0000 @@ -88,7 +88,7 @@ return new Suite(ASTConverter15Test.class); } TestSuite suite = new Suite(ASTConverter15Test.class.getName()); - suite.addTest(new ASTConverter15Test("test0092")); + suite.addTest(new ASTConverter15Test("test0093")); return suite; } @@ -2811,6 +2811,41 @@ workingCopy, false); assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType()); + } finally { + if (workingCopy != null) + workingCopy.discardWorkingCopy(); + } + } + + /* + * https://bugs.eclipse.org/bugs/show_bug.cgi?id=81023 + */ + public void test0093() throws JavaModelException { + ICompilationUnit workingCopy = null; + try { + String contents = + "public class Test {\n" + + " public Test(U u) {\n" + + " }\n" + + "\n" + + " void bar() {\n" + + " new Test(null) {};\n" + + " }\n" + + "}"; + workingCopy = getWorkingCopy("/Converter15/src/Test.java", true/*resolve*/); + ASTNode node = buildAST( + contents, + workingCopy); + assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType()); + CompilationUnit compilationUnit = (CompilationUnit) node; + node = getASTNode(compilationUnit, 0, 1, 0); + assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType()); + ExpressionStatement statement = (ExpressionStatement) node; + Expression expression = statement.getExpression(); + checkSourceRange(expression, "new Test(null) {}", contents.toCharArray()); + ITypeBinding typeBinding = expression.resolveTypeBinding(); + IJavaElement element = typeBinding.getJavaElement(); + assertNotNull("No java element", element); } finally { if (workingCopy != null) workingCopy.discardWorkingCopy();