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 114960 Details for
Bug 249567
Incorrect behavior of Util.getUnresolvedJavaElement(...) method
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix and regression test
249567.txt (text/plain), 3.26 KB, created by
Jerome Lanneluc
on 2008-10-13 13:07:39 EDT
(
hide
)
Description:
Proposed fix and regression test
Filename:
MIME Type:
Creator:
Jerome Lanneluc
Created:
2008-10-13 13:07:39 EDT
Size:
3.26 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: model/org/eclipse/jdt/internal/core/util/Util.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Util.java,v >retrieving revision 1.123 >diff -u -r1.123 Util.java >--- model/org/eclipse/jdt/internal/core/util/Util.java 12 Sep 2008 11:46:24 -0000 1.123 >+++ model/org/eclipse/jdt/internal/core/util/Util.java 13 Oct 2008 17:07:01 -0000 >@@ -1365,11 +1365,16 @@ > if (isInnerBinaryTypeConstructor) > parameterSignatures[0] = new String(enclosingType.genericTypeSignature()).replace('/', '.'); > for (int i = 0; i < length; i++) { >- parameterSignatures[declaringIndex + i] = new String(parameters[i].genericTypeSignature()).replace('/', '.'); >+ String signature = new String(parameters[i].genericTypeSignature()).replace('/', '.'); >+ if (!isBinary && signature.length() > 1 && signature.charAt(0) == Signature.C_RESOLVED) >+ signature = Signature.C_UNRESOLVED + signature.substring(1); >+ parameterSignatures[declaringIndex + i] = signature; > } > IMethod result = declaringType.getMethod(selector, parameterSignatures); > if (isBinary) > return (JavaElement) result; >+ if (result.exists()) // if perfect match (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=249567 ) >+ return (JavaElement) result; > IMethod[] methods = null; > try { > methods = declaringType.getMethods(); >#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.59 >diff -u -r1.59 ASTModelBridgeTests.java >--- src/org/eclipse/jdt/core/tests/dom/ASTModelBridgeTests.java 27 Jun 2008 16:02:37 -0000 1.59 >+++ src/org/eclipse/jdt/core/tests/dom/ASTModelBridgeTests.java 13 Oct 2008 17:07:02 -0000 >@@ -1728,6 +1728,46 @@ > element > ); > } >+ >+ /* >+ * Ensures that the IJavaElement of an IBinding representing a method is correct. >+ * (regression test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=249567 ) >+ */ >+ public void testMethod12() throws Exception { >+ try { >+ createFolder("/P/src/p1"); >+ createFile( >+ "/P/src/p1/X249567.java", >+ "package p1;\n" + >+ "public class X249567 {}" >+ ); >+ createFolder("/P/src/p2"); >+ createFile( >+ "/P/src/p2/X249567.java", >+ "package p2;\n" + >+ "public class X249567 {}" >+ ); >+ ASTNode node = buildAST( >+ "public class X {\n" + >+ " void foo(p1.X249567 x) {\n" + >+ " }\n" + >+ " /*start*/void foo(p2.X249567 x) {\n" + >+ " }/*end*/\n" + >+ "}" >+ ); >+ IBinding binding = ((MethodDeclaration) node).resolveBinding(); >+ IJavaElement element = binding.getJavaElement(); >+ assertElementEquals( >+ "Unexpected Java element", >+ "foo(p2.X249567) [in X [in [Working copy] X.java [in <default> [in src [in P]]]]]", >+ element >+ ); >+ } finally { >+ deleteFolder("/P/src/p1"); >+ deleteFolder("/P/src/p2"); >+ } >+ } >+ > /* > * Ensures that the IJavaElement of an IBinding representing a package is correct. > */
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 249567
:
114960
|
115025