### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: model/org/eclipse/jdt/internal/core/util/DOMFinder.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/DOMFinder.java,v retrieving revision 1.7 diff -u -r1.7 DOMFinder.java --- model/org/eclipse/jdt/internal/core/util/DOMFinder.java 27 Jun 2008 16:03:57 -0000 1.7 +++ model/org/eclipse/jdt/internal/core/util/DOMFinder.java 14 Dec 2009 17:43:51 -0000 @@ -30,6 +30,7 @@ import org.eclipse.jdt.core.dom.MethodDeclaration; import org.eclipse.jdt.core.dom.NormalAnnotation; import org.eclipse.jdt.core.dom.PackageDeclaration; +import org.eclipse.jdt.core.dom.ParameterizedType; import org.eclipse.jdt.core.dom.SingleMemberAnnotation; import org.eclipse.jdt.core.dom.TypeDeclaration; import org.eclipse.jdt.core.dom.TypeParameter; @@ -90,6 +91,9 @@ switch (parent.getNodeType()) { case ASTNode.CLASS_INSTANCE_CREATION: name = ((ClassInstanceCreation) parent).getType(); + if (name.getNodeType() == ASTNode.PARAMETERIZED_TYPE) { + name = ((ParameterizedType) name).getType(); + } break; case ASTNode.ENUM_CONSTANT_DECLARATION: name = ((EnumConstantDeclaration) parent).getName(); #P org.eclipse.jdt.core.tests.model Index: src/org/eclipse/jdt/core/tests/dom/ASTModelBridgeTests.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTModelBridgeTests.java,v retrieving revision 1.62 diff -u -r1.62 ASTModelBridgeTests.java --- src/org/eclipse/jdt/core/tests/dom/ASTModelBridgeTests.java 23 Oct 2008 13:56:39 -0000 1.62 +++ src/org/eclipse/jdt/core/tests/dom/ASTModelBridgeTests.java 14 Dec 2009 17:43:52 -0000 @@ -44,7 +44,7 @@ // All specified tests which do not belong to the class are skipped... static { // TESTS_PREFIX = "testBug86380"; -// TESTS_NAMES = new String[] { "testCreateBindings19" }; +// TESTS_NAMES = new String[] { "testCreateBindings23" }; // TESTS_NUMBERS = new int[] { 83230 }; // TESTS_RANGE = new int[] { 83304, -1 }; } @@ -664,6 +664,58 @@ } /* + * https://bugs.eclipse.org/bugs/show_bug.cgi?id=297757 + */ + public void testCreateBindings23() throws JavaModelException { + ASTParser parser = ASTParser.newParser(AST.JLS3); + parser.setProject(getJavaProject("P")); + WorkingCopyOwner owner = new WorkingCopyOwner() {}; + this.workingCopies = new ICompilationUnit[3]; + this.workingCopies[0] = getWorkingCopy( + "/P/src/p/IScriptRunnable.java", + "package p;\n" + + "public interface IScriptRunnable {\n" + + " public V run(Object cx, Object scope) throws E;\n" + + "}", + owner + ); + this.workingCopies[1] = getWorkingCopy( + "/P/src/p/Environment.java", + "package p;\n" + + "public interface Environment {\n" + + " public V execute(IScriptRunnable code) throws E;\n" + + "}", + owner + ); + this.workingCopies[2] = getWorkingCopy( + "/P/src/X.java", + "import p.*;\n" + + "public class X {\n" + + " p.Environment env;\n" + + " private void test() {\n" + + " env.execute(new IScriptRunnable() {\n" + + " public Object run(Object cx, Object scope) throws RuntimeException {\n" + + " return null;\n" + + " }\n" + + " });\n" + + " }\n" + + "}", + owner + ); + IJavaElement[] elements = new IJavaElement[] { + this.workingCopies[0].getType("IScriptRunnable"), + this.workingCopies[1].getType("Environment"), + this.workingCopies[2].getType("X").getMethod("test", new String[0]).getType("", 1) + }; + IBinding[] bindings = parser.createBindings(elements, null); + assertBindingsEqual( + "Lp/IScriptRunnable;\n" + + "Lp/Environment;\n" + + "LX$90;", + bindings); + } + + /* * Ensures that the correct IBindings are created for a given set of IJavaElement * (top level type) */