Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 154425 Details for
Bug 297757
Cannot get bindings for IType corresponding to parameterized anonymous type
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix + regression test
patch_297757.txt (text/plain), 4.05 KB, created by
Olivier Thomann
on 2009-12-14 12:40:46 EST
(
hide
)
Description:
Proposed fix + regression test
Filename:
MIME Type:
Creator:
Olivier Thomann
Created:
2009-12-14 12:40:46 EST
Size:
4.05 KB
patch
obsolete
>### 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<V, E extends Exception> {\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, E extends Exception> V execute(IScriptRunnable<V, E> 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<Object, RuntimeException>() {\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<TV;TE;>;\n" + >+ "Lp/Environment;\n" + >+ "LX$90;", >+ bindings); >+ } >+ >+ /* > * Ensures that the correct IBindings are created for a given set of IJavaElement > * (top level type) > */
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 297757
: 154425